本文档包含用于更新现有 4.16.01 安装以使用 Apigee 的最新 RPM 和支持文件的过程。此过程使用 update.sh 实用程序执行更新。
哪些 Edge 版本可以更新到最新的 4.16.01 版本
您只能将现有的 Apigee Edge 4.16.01.x 版安装更新到最新的 4.16.01 版本。
如果您目前运行的是 Edge 4.15.07.0x 版或更早版本,则必须先迁移到 4.16.01。如需了解如何从 4.15.07.0x 或更早版本迁移到 4.16.01 版,请参阅 Apigee Edge 4.16.01 安装指南,该指南可在 Apigee ftp 网站 ftp://ftp.apigee.com/ 上找到。
谁可以执行更新
运行更新的用户应与最初安装 Edge 的用户相同,或以根用户身份运行。
安装 Edge RPM 后,任何用户都可以对其进行配置。
更新所需的磁盘可用空间
在执行更新之前,请确保您至少有 1 GB 的可用磁盘空间。
从 4.16.01.x 自动传播属性设置
如果您通过修改 /opt/apigee/customer/application 中的 .properties 文件设置了任何属性,则更新会保留这些值。
更新前提条件
在升级 Apigee Edge 之前,请先满足以下前提条件:
- 备份所有节点
在更新之前,出于安全原因,建议您对所有节点执行完整备份。使用当前 Edge 版本的步骤执行备份。
这样,您就可以制定备用方案,以防新版本更新无法正常运行。如需详细了解备份,请参阅 Apigee Edge 4.16.01 操作指南,该指南可在 Apigee FTP 网站上找到:ftp://ftp.apigee.com/。 - 确保 Edge 正在运行
使用以下命令确保 Edge 在更新过程中启动并运行:
> /<inst_root>/apigee/apigee-service/bin/apigee-all status
处理失败的更新
如果更新失败,您可以尝试更正问题,然后再次运行 update.sh。您可以多次运行更新,它会从上次中断的位置继续更新。
如果故障需要您将更新回滚到之前的版本,请参阅 Apigee Edge 4.16.01 安装指南,该指南可在 Apigee FTP 网站上找到:ftp://ftp.apigee.com/
日志记录更新信息
默认情况下,update.sh 实用程序会将日志信息写入:
/opt/apigee/var/log/apigee-setup/update.log
如果运行 update.sh 实用程序的用户无权访问该目录,则会将日志写入 /tmp 目录,文件名为 update_username.log。
如果用户无权访问 /tmp,则 update.sh 实用程序会失败。
零停机时间更新
零停机时间更新或滚动更新可让您在不关闭 Edge 的情况下更新 Edge 安装。
实现零停机时间升级的关键在于,一次从负载均衡器中移除一个路由器。然后,您需要更新路由器以及与路由器位于同一台机器上的任何其他组件,再将路由器重新添加到负载均衡器。
- 按照下文“机器更新顺序”中所述,以正确的顺序更新安装中的机器。
- 需要更新路由器时,请选择任意一个路由器并使其无法访问,如下一部分“使路由器和消息处理器无法访问”中所述。
- 更新所选路由器以及与该路由器位于同一机器上的所有其他 Edge 组件。 所有 Edge 配置都会在同一节点上显示路由器和消息处理器。
- 使路由器再次可访问。
- 对剩余的路由器重复第 2 步到第 4 步。
- 继续更新安装中的所有剩余机器。
使路由器和消息处理器无法访问
在生产环境中,您将拥有多个路由器和消息处理器,以实现最佳性能,并且您必须在更新之前/之后启用/停用这些路由器和消息处理器的可达性。
以下 API 调用会将节点配置为可访问或不可访问:
> curl -u adminEmail:pWord -X POST "http://<ms_IP>:8080/v1/servers/UUID" -d "reachable=true|false"
其中,UUID 是消息处理器或路由器的 UUID,reachable 设置为 true 或 false。
如果您需要确定路由器的 UUID,请使用以下 cURL 命令:
> curl http://<routerIP>:8081/v1/servers/self
如果您需要确定消息处理器的 UUID,请使用以下 cURL 命令:
> curl http://<mpIP>:8082/v1/servers/self
在更新之前/之后,请注意以下事项:
- 在组合的路由器和消息处理器节点上:
- 更新前 - 执行以下操作:
- 使用上面显示的 API 调用使路由器无法访问。
- 使消息处理器无法访问。
- 更新后 - 执行以下操作:
- 使消息处理器可访问。
- 确保路由器可访问。
- 更新前 - 执行以下操作:
- 在单个路由器节点上:
- 在更新之前,请确保路由器可访问。
- 更新后,使路由器可访问。
- 在单个消息处理器节点上:
- 在更新之前,请使消息处理器无法访问。
- 更新后,使消息处理器可访问。
使用静默配置文件
您必须向更新命令传递静默配置文件。静默配置文件应与您用于安装 Edge 4.16.01 的文件相同。
在具有外部互联网连接的节点上更新 4.16.01 的过程
请按照以下步骤更新节点上的 Edge 组件:
- 如果存在,请停用配置为在 Cassandra 上执行修复操作的所有 CRON 作业,直到更新完成。
- 以 root 身份登录节点,以安装 Edge RPM
注意:虽然 RPM 安装需要 root 访问权限,但您可以在没有 root 访问权限的情况下执行 Edge 配置。 - 按照 Apigee Edge 4.16.01 安装指南(可在 Apigee FTP 网站 ftp://ftp.apigee.com/ 上找到)中的说明停用 SELinux
- 清理所有 Yum 缓存:
> sudo yum clean all - 将最新的 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh:
> curl https://software.apigee.com/bootstrap.sh -o /tmp/bootstrap.sh - 更新 Edge apigee-service 实用程序和依赖项:
> sudo bash /tmp/bootstrap.sh apigeeuser=uName apigeepassword=pWord
其中,uName:pWord 是您从 Apigee 收到的用户名和密码。如果您省略 pWord,系统会提示您输入该值。 - 使用 apigee-service 更新 apigee-setup 实用程序:
> /opt/apigee/apigee-service/bin/apigee-service apigee-setup update
对 apigee-service 的此更新会在 <inst_dir>/apigee/apigee-setup/bin 中安装 update.sh 实用程序。 - 按照下文“机器更新顺序”中所述的顺序在节点上运行更新实用程序:
> /opt/apigee/apigee-setup/bin/update.sh -c component -f configFile
对配置文件的唯一要求是,“apigee”用户必须能够访问或读取配置文件。例如,将文件放在节点上的 /tmp 目录中。
使用“-c”选项指定要更新的组件。可能的组件列表包括:- ldap = OpenLDAP
- cs = Cassandra
- zk = Zookeeper
- qpid = qpidd
- ps = postgresql
- edge =除 Edge 界面之外的所有 Edge 组件:Management Server、消息处理器、Router、QPID Server、Postgres Server
- ui = Edge 界面
- all = 更新机器上的所有组件(仅用于 Edge aio 安装配置文件或 API BaaS asa 安装配置文件)
- e = ElasticSearch
- b = API BaaS 堆栈
- p = API BaaS 门户
- ebp = 同一节点上的 ElasticSearch、API BaaS Stack 和 API BaaS 门户
- 如需测试更新,请在消息处理器上运行 apigee-validate 实用程序,如 Apigee Edge 4.16.01 安装指南中所述,该指南可在 Apigee FTP 网站上找到:ftp://ftp.apigee.com/
从本地代码库更新 4.16.01 的过程
如果您的 Edge 节点位于防火墙后面,或者以其他方式禁止通过互联网访问 Apigee 代码库,则您可以从 Apigee 代码库的本地代码库或镜像执行更新。
创建本地 Edge 代码库后,您可以通过以下两种方式从本地代码库更新 Edge:
- 创建代码库的 .tar 文件,将 .tar 文件复制到节点,然后从 .tar 文件更新 Edge。
- 在具有本地代码库的节点上安装网络服务器,以便其他节点可以访问该代码库。 Apigee 提供了 Nginx Web 服务器供您使用,您也可以使用自己的 Web 服务器。
如需从本地 4.16.01 代码库进行更新,请执行以下操作:
- 确保您拥有本地 4.16.01 代码库,如 Apigee Edge 4.16.01 安装指南中所述,该指南可在 Apigee FTP 网站上找到:ftp://ftp.apigee.com/
- 更新本地代码库:
- 将最新的 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh:
> curl https://software.apigee.com/bootstrap.sh -o /tmp/bootstrap.sh - 执行同步:
> /opt/apigee/apigee-service/bin/apigee-service apigee-mirror sync --only-new-rpms
- 将最新的 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh:
-
如需从 .tar 文件安装 apigee-service,请执行以下操作:
- 在具有本地代码库的节点上,使用以下命令将本地代码库打包到名为 /opt/apigee/data/apigee-mirror/apigee-4.16.01.tar.gz 的单个.tar 文件中:
> /opt/apigee/apigee-service/bin/apigee-service apigee-mirror package - 将 .tar 文件复制到要更新 Edge 的节点。例如,将其复制到新节点上的 /tmp 目录。
- 在新节点上,将文件解压缩到 /tmp 目录:
> tar -xzf apigee-4.16.01.tar.gz
此命令会在包含 .tar 文件的目录中创建一个名为 repos 的新目录。例如 /tmp/repos。 - 以 root 身份登录节点,以安装 Edge RPM
注意:虽然 RPM 安装需要 root 访问权限,但您可以在没有 root 访问权限的情况下执行 Edge 配置。 - 按照 Apigee Edge 4.16.01 安装指南(可在 Apigee FTP 网站 ftp://ftp.apigee.com/ 上找到)中的说明停用 SELinux
- 从 /tmp/repos 安装 Edge apigee-service 实用程序和依赖项:
> sudo bash /tmp/repos/bootstrap.sh apigeeprotocol="file://" apigeerepobasepath=/tmp/repos
请注意,您在此命令中添加了 repos 目录的路径。
- 在具有本地代码库的节点上,使用以下命令将本地代码库打包到名为 /opt/apigee/data/apigee-mirror/apigee-4.16.01.tar.gz 的单个.tar 文件中:
-
如需使用 Nginx Web 服务器安装 apigee-service,请执行以下操作:
- 按照 Edge 4.16.01 安装指南(可在 Apigee FTP 网站 ftp://ftp.apigee.com/ 上找到)中“使用 Nginx Web 服务器从代码库安装”部分所述,配置 Nginx Web 服务器。
- 在远程节点上,将 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh:
> /usr/bin/curl http://uName:pWord@remoteRepo:3939/bootstrap.sh -o /tmp/bootstrap.shwhere uName:pWord are the username and password you set above for the repo, and remoteRepo is the IP address or DNS name of the repo node.
- Log in to your node as root to install the Edge RPMs
Note: While RPM installation requires root access, you can perform Edge configuration without root access. - Disable SELinux as described in the Apigee Edge 4.16.01 Installation Guide, available on the Apigee FTP site: ftp://ftp.apigee.com/
- On the remote node, install the Edge apigee-service utility and
dependencies:
> sudo bash /tmp/bootstrap.sh apigeerepohost=remoteRepo:3939 apigeeuser=uName apigeepassword=pWord apigeeprotocol=http://
where uName:pWord are the repo username and password.
- If present, disable any CRON jobs configured to perform a repair operation on Cassandra until after the update completes.
- Use apigee-service to update the apigee-setup utility:
> /opt/apigee/apigee-service/bin/apigee-service apigee-setup update
This update to apigee-service installs the update.sh utility in <inst_dir>/apigee/apigee-setup/bin. - Run the update utility on your nodes in the order described below in "Order of machine
update" below:
> /opt/apigee/apigee-setup/bin/update.sh -c component -f configFile
The only requirement on the config file is that the configuration file must be accessible or readable by the "apigee" user. For example, put the file in the /tmp directory on the node.
Use the “-c” option to specify the component to update. The list of possible components includes:- ldap = OpenLDAP
- cs = Cassandr
- zk = Zookeeper
- qpid = qpidd
- ps = postgresql
- edge =All Edge components except Edge UI: Management Server, Message Processor, Router, QPID Server, Postgres Server
- ui = Edge UI
- all = update all components on machine (only use for an Edge aio installation profile or an API BaaS asa installation profile)
- e = ElasticSearch
- b = API BaaS Stack
- p = API BaaS Portal
- ebp = ElasticSearch, API BaaS Stack, and API BaaS Portal on the same node
- Test the update by running the apigee-validate utility on the Message Processor, as described in the Apigee Edge 4.16.01 Installation Guide, available on the Apigee FTP site: ftp://ftp.apigee.com/
Order of machine update
The order that you update the machines in an Edge installation is important. The most important considerations to an update are:
- You must update all Cassandra and ZooKeeper nodes before you update any other nodes.
- You must update all qpidd and postgresql nodes before you update any Router and Message Processor nodes.
- For any machine with multiple Edge components (Management Server, Message Processor, Router, QPID Server, Postgres Server), use the "-c edge" option to update them all at the same time.
- If a step specifies that it should be performed on multiple machines, perform it in the specified machine order.
- There is no separate step to update Monetization. It is updated when you specify the "-c edge" option.
- After you update a Router node, you must remove all files from the /opt/nginx/conf.d directory, and then restart the Router.
For a 1-host standalone installation
- Update machine 1:
> /opt/apigee/apigee-setup/bin/update.sh -c all -f configFile
- 删除 /opt/nginx/conf.d 中的所有文件:
> rm -f /opt/nginx/conf.d/* - 重启 Edge Router:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
对于 2 主机独立安装
如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/ 上的 Apigee Edge 4.16.01 安装指南。
- 在机器 1 上更新 Cassandra 和 ZooKeeper:
> /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
- 在机器 2 上更新 qpidd 和 postgresql:
> /opt/apigee/apigee-setup/bin/update.sh -c qpid,ps -f configFile
- 在机器 1 上更新 LDAP:
> /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
- 更新机器 2 和机器 1 上的 Edge 组件:
> /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
- 在节点 1 上:
- 删除
/opt/nginx/conf.d中的所有文件:> rm -f /opt/nginx/conf.d/*
- 重启 Edge 路由器:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
- 删除
- 更新机器 1 上的界面:
> /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
对于 5 主机集群安装
如需查看 Edge 拓扑和节点编号的列表,请参阅 Apigee Edge 4.16.01 安装指南,该指南可在 Apigee FTP 网站 ftp://ftp.apigee.com/ 上找到。
- 在机器 1、2 和 3 上更新 Cassandra 和 ZooKeeper:
> /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
- 更新机器 4 和 5 上的 qpidd 和 postgresql:
> /opt/apigee/apigee-setup/bin/update.sh -c qpid,ps -f configFile
- 在机器 1 上更新 LDAP:
> /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
- 更新机器 4、5、1、2、3 上的 Edge 组件:
> /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
- 在节点 2 和 3 上:
- 删除
/opt/nginx/conf.d中的所有文件:> rm -f /opt/nginx/conf.d/*
- 重启 Edge 路由器:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
- 删除
- 更新机器 1 上的界面:
> /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
对于 9 主机集群安装
如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/ 上的 Apigee Edge 4.16.01 安装指南。
- 在机器 1、2 和 3 上更新 Cassandra 和 ZooKeeper:
> /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
- 在机器 6 和 7 上更新 qpidd:
> /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
- 更新机器 8 和 9 上的 PostgreSQL:
> /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
- 在机器 1 上更新 LDAP:
> /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
- 按顺序更新机器 6、7、8、9、1、4 和 5 上的 Edge 组件:
> /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
- 在节点 4 和 5 上:
- 删除
/opt/nginx/conf.d中的所有文件:> rm -f /opt/nginx/conf.d/*
- 重启 Edge 路由器:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
- 删除
- 更新机器 1 上的界面:
> /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
对于 13 主机集群安装
如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/ 上的 Apigee Edge 4.16.01 安装指南。
- 在机器 1、2 和 3 上更新 Cassandra 和 ZooKeeper:
> /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
- 在机器 12 和 13 上更新 qpidd:
> /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile - 更新机器 8 和 9 上的 postgresql:
> /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile - 在机器 4 和 5 上更新 LDAP:
> /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
- 按以下顺序更新机器 12、13、8、9、6、7、10 和 11 上的 Edge 组件:
> /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
- 在节点 10 和 11 上:
- 删除
/opt/nginx/conf.d中的所有文件:> rm -f /opt/nginx/conf.d/*
- 重启 Edge Router:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
- 删除
- 更新机器 6 和 7 上的界面:
> /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
对于 12 主机集群安装
如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/ 上的 Apigee Edge 4.16.01 安装指南。
- 更新 Cassandra 和 ZooKeeper:
- 在数据中心 1 的机器 1、2 和 3 上:
> /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
- 在数据中心 2 的机器 7、8 和 9 上
> /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
- 在数据中心 1 的机器 1、2 和 3 上:
- 更新 qpidd:
- 数据中心 1 中的机器 4、5
> /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
- 数据中心 2 中的机器 10、11
> /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
- 数据中心 1 中的机器 4、5
- 更新 postgresql:
- 数据中心 1 中的机器 6
> /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
- 数据中心 2 中的机器 12
> /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
- 数据中心 1 中的机器 6
- 更新 LDAP:
- 数据中心 1 中的机器 1
> /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
- 数据中心 2 中的机器 7
> /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
- 数据中心 1 中的机器 1
- 更新 Edge 组件:
- 数据中心 1 中的机器 4、5、6、1、2、3
> /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
- 数据中心 2 中的机器 10、11、12、7、8、9
> /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
- 在节点 2、3、8 和 9 上:
- 删除
/opt/nginx/conf.d中的所有文件:> rm -f /opt/nginx/conf.d/*
- 重启 Edge 路由器:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
- 删除
- 数据中心 1 中的机器 4、5、6、1、2、3
- 更新界面:
- 数据中心 1 中的机器 1
> /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
- 数据中心 2 中的机器 7
> /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
- 数据中心 1 中的机器 1
对于 7 主机 API BaaS 安装
如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/ 上的 Apigee Edge 4.16.01 安装指南。
- 在机器 5、6 和 7 上更新 Cassandra:
> /opt/apigee/apigee-setup/bin/update.sh -c cs -f configFile
- 在机器 1、2 和 3 上更新 ElasticSearch 和 API BaaS 堆栈:
> /opt/apigee/apigee-setup/bin/update.sh -c e,b -f configFile
- 在机器 4 上更新 API BaaS 门户:
> /opt/apigee/apigee-setup/bin/update.sh -c p -f configFile
对于 10 主机 API BaaS 安装
如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/ 上的 Apigee Edge 4.16.01 安装指南。
- 更新机器 8、9 和 10 上的 Cassandra:
> /opt/apigee/apigee-setup/bin/update.sh -c cs -f configFile
- 在机器 1、2 和 3 上更新 ElasticSearch:
> /opt/apigee/apigee-setup/bin/update.sh -c e -f configFile
- 更新机器 4、5 和 6 上的 API BaaS 堆栈:
> /opt/apigee/apigee-setup/bin/update.sh -c b -f configFile
- 在机器 7 上更新 API BaaS 门户:
> /opt/apigee/apigee-setup/bin/update.sh -c p -f configFile
对于非标准安装
如果您采用的是非标准安装,请按以下顺序更新 Edge 组件:
- ZooKeeper
- Cassandra
- qpidd
- postgresql
- LDAP
- Edge,即所有节点上的“-c edge”配置文件,顺序为:Qpid、Postgres、Management Server、消息处理器、Router。
- 在所有路由器节点上:
- 删除
/opt/nginx/conf.d中的所有文件:> rm -f /opt/nginx/conf.d/*
- 重启 Edge Router:
> /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
- 删除
- 界面