将 Apigee Edge 4.16.01.x 更新到最新版 4.16.01

本文档包含您用于更新现有 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 ftp 网站 ftp://ftp.apigee.com/,获得的 Apigee Edge 4.16.01 安装指南

谁可以执行更新

运行更新的用户应与最初安装 Edge 的用户相同,或以 root 身份运行的用户相同。

安装 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/

Logging 更新信息

默认情况下,update.sh 实用程序会将日志信息写入:

/opt/apigee/var/log/apigee-setup/update.log

如果运行 update.sh 实用程序的用户无权访问该目录,它会将日志作为名为 update.sh 的文件写入 update.sh 目录。

如果用户无权访问 /tmp,则 update.sh 实用程序会失败。

零停机时间更新

借助零停机更新或滚动更新,您无需关闭 Edge 即可更新 Edge 安装。

零停机升级的关键是从负载平衡器中一次移除一个路由器。然后,在与路由器相同的机器上更新路由器和任何其他组件,再将路由器重新添加到负载平衡器。

  1. 按照下文“机器更新的顺序”中的说明,按照正确的安装顺序更新机器。
  2. 在更新路由器时,选择任意一个路由器并使其无法访问,如下一部分“使路由器和消息处理器无法访问”中所述。
  3. 在与路由器相同的机器上,更新所选路由器和所有其他 Edge 组件。 所有边缘配置都在同一节点上显示路由器和消息处理器。
  4. 使该路由器可再次连接。
  5. 对其余路由器重复步骤 2 到 4。
  6. 继续更新安装中的所有其余计算机。

使路由器和消息处理器无法访问

在生产设置中,您将拥有多个路由器和消息处理器以实现最佳性能,并且您必须在更新前后启用/停用这些路由器和消息处理器的可达性。

以下 API 调用会将节点配置为可访问或不可访问:

> curl -u adminEmail:pWord -X POST "http://<ms_IP>:8080/v1/servers/UUID" -d "reachable=true|false"

其中,UUID 是消息处理器或路由器的 UUID,“reachable”设置为 true 或 false。

如果您需要确定路由器的 UUID,请使用以下 c网址 命令:

> curl http://<routerIP>:8081/v1/servers/self

如果您需要确定消息处理器的 UUID,请使用以下 c网址 命令:

> curl http://<mpIP>:8082/v1/servers/self

更新前后请注意以下事项:

  • 在合并的路由器和消息处理器节点上:
    • 更新前,请执行以下操作:
      1. 使用上面显示的 API 调用将路由器设为无法访问。
      2. 使消息处理器无法访问。
    • 更新后,请执行以下操作:
      1. 使消息处理器可访问。
      2. 使路由器可访问。
  • 在单个路由器节点上:
    • 更新之前,请确保路由器可连接到该路由器。
    • 更新后,使路由器可访问。
  • 在单个消息处理器节点上:
    • 更新前,请将消息处理器设为无法访问。
    • 更新后,使消息处理器可访问。

使用静默配置文件

您必须将静默配置文件传递给 update 命令。静默配置文件应该与您安装 Edge 4.16.01 时所用的配置文件相同。

在具有外部互联网连接的节点上更新 4.16.01 的过程

请按以下步骤更新节点上的 Edge 组件:

  1. 如果存在配置为在 Cassandra 上执行修复操作的 CRON 作业,则停用该作业,直到更新完成为止。
  2. 以根用户身份登录您的节点以安装 Edge RPM
    注意:虽然 RPM 安装需要 root 访问权限,但您可以在没有 root 访问权限的情况下执行 Edge 配置。
  3. 按照 Apigee Edge 4.16.01 安装指南中的说明停用 SELinux,可在 Apigee FTP 网站上获取:ftp://ftp.apigee.com/
  4. 清理所有 Yum 缓存:
    > sudo yum clean all
  5. 将最新的 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh:
    > curl https://software.apigee.com/bootstrap.sh -o /tmp/bootstrap.sh
  6. 更新 Edge apigee-service 实用程序和依赖项:
    > sudo bash /tmp/bootstrap.sh apigeeuser=uName apigeepassword=pWord

    其中 uName:pWord 是您从 Apigee 收到的用户名和密码。如果省略 pWord,系统会提示您输入。
  7. 使用 apigee-service 更新 apigee-setup 实用程序:
    > /opt/apigee/apigee-service/bin/apigee-service apigee-setup update
    apigee-service 的更新会将 update.sh 实用程序安装到 <inst_dir>/apigee/apigee-setup/bin
  8. 请按照下方“机器更新的顺序”部分所述的顺序在您的节点上运行更新实用程序:
    > /opt/apigee/apigee-setup/bin/update.sh -c components -f configFile
    对配置文件的唯一要求是配置文件必须可供“apigee”用户访问或读取。例如,将文件放在节点的 /tmp 目录中。
    使用“-c”选项指定要更新的组件。可能的组件列表包括:
    • ldap = OpenLDAP
    • cs = Cassandr
    • zk = ZooKeeper
    • qpid = qpidd
    • ps = postgresql
    • edge =除边缘界面以外的所有边缘组件:管理服务器、消息处理器、路由器、QPID 服务器、Postgres Server
    • ui = 边缘界面
    • all = 更新机器上的所有组件(仅用于 Edge aio 安装配置文件或将 API BaaS 用作安装配置文件)
    • e = ElasticSearch
    • b = API BaaS 堆栈
    • p = API BaaS 门户
    • ebp = 同一节点上的 ElasticSearch、API BaaS 堆栈和 API BaaS 门户
  9. 按照 Apigee Edge 4.16.01 安装指南中所述,在消息处理器上运行 apigee-validate 实用程序以测试更新。如需了解详情,请参阅 Apigee FTP 网站 ftp://ftp.apigee.com/

从本地代码库更新 4.16.01 的过程

如果您的 Edge 节点设有防火墙,或者由于某种其他方式被禁止通过互联网访问 Apigee 代码库,则您可以通过 Apigee 代码库的本地代码库(或镜像)执行更新。

创建本地 Edge 代码库后,您可以通过两种方式从本地代码库更新 Edge:

  • 创建代码库的 .tar 文件,将 .tar 文件复制到节点,然后从 .tar 文件中更新 Edge。
  • 在具有本地代码库的节点上安装 Web 服务器,以便其他节点可以访问它。Apigee 提供 Nginx Web 服务器供您使用,您也可以使用自己的 Web 服务器。

如需从本地 4.16.01 代码库进行更新,请执行以下操作:

  1. 确保您拥有 Apigee Edge 4.16.01 安装指南中所述的本地 4.16.01 代码库,可在 Apigee FTP 网站上获取:ftp://ftp.apigee.com/
  2. 更新本地代码库:
    1. 将最新的 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh
      > curl https://software.apigee.com/bootstrap.sh -o /tmp/bootstrap.sh
    2. 执行同步:
      > /opt/apigee/apigee-service/bin/apigee-service apigee-mirror sync --only-new-rpms
  3. 如需通过 .tar 文件安装 apigee-service,请执行以下操作
    1. 在具有本地代码库的节点上,使用以下命令将本地代码库打包到名为 /opt/apigee/data/apigee-mirror/apigee-4.16.01.tar.gz 的.tar 文件中:
      > /opt/apigee/apigee-service/bin/apigee-service apigee-mirror package
    2. 将 .tar 文件复制到您要在其中更新 Edge 的节点。例如,将其复制到新节点上的 /tmp 目录。
    3. 在新节点上,将文件解压缩到 /tmp 目录:
      > tar -xzf apigee-4.16.01.tar.gz
      此命令会在包含 .tar 文件的目录中创建一个名为 repos 的新目录。例如 /tmp/repos。
    4. 以根用户身份登录您的节点以安装 Edge RPM
      注意:虽然 RPM 安装需要 root 访问权限,但您可以在没有 root 访问权限的情况下执行 Edge 配置。
    5. 按照 Apigee Edge 4.16.01 安装指南中的说明停用 SELinux,可在 Apigee FTP 网站上获取:ftp://ftp.apigee.com/
    6. 从 /tmp/repos 安装 Edge apigee-service 实用程序和依赖项:
      > sudo bash /tmp/repos/bootstrap.sh apigeeprotocol="file://" apigeerepobasepath=/tmp/repos
      请注意,此命令中包含代码库目录的路径。
  4. 如需使用 Nginx Web 服务器安装 apigee-service,请执行以下操作
    1. 按照 Edge 4.16.01 安装指南中的“使用 Nginx 网络服务器从代码库安装”所述配置 Nginx Web 服务器,可在 Apigee FTP 网站 ftp://ftp.apigee.com/ 上获取。
    2. 在远程节点上,将 Edge bootstrap.sh 文件下载到 /tmp/bootstrap.sh:
      > /usr/bin/curl http://uName:pWord@remoteRepo:3939/bootstrap.sh -o /tmp/bootstrap.sh
                

      where 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.

    3. 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.
    4. Disable SELinux as described in the Apigee Edge 4.16.01 Installation Guide, available on the Apigee FTP site: ftp://ftp.apigee.com/
    5. 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.
  5. If present, disable any CRON jobs configured to perform a repair operation on Cassandra until after the update completes.
  6. 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.
  7. 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
  8. 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

  1. Update machine 1:
    > /opt/apigee/apigee-setup/bin/update.sh -c all -f configFile
  2. 删除 /opt/nginx/conf.d 中的任何文件:
    > rm -f /opt/nginx/conf.d/*
  3. 重启 Edge Router 路由器:
    > /<inst_root>/apigee/apigee-service/bin/apigee-serviceedge-router restart

对于双主机独立安装

如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee Edge 4.16.01 安装指南(位于 Apigee FTP 网站 ftp://ftp.apigee.com/)。

  1. 在机器 1 上更新 Cassandra 和 ZooKeeper:
    > /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
  2. 在机器 2 上更新 qpidd 和 postgresql:
    > /opt/apigee/apigee-setup/bin/update.sh -c qpid,ps -f configFile
  3. 更新机器 1 上的 LDAP:
    > /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
  4. 更新机器 2 和机器 1 上的 Edge 组件:
    > /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
  5. 在节点 1 上:
    1. 删除 /opt/nginx/conf.d 中的任何文件:
      > rm -f /opt/nginx/conf.d/*
    2. 重启边缘路由器:
      > /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
  6. 更新机器 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. 在机器 1、2 和 3 上更新 Cassandra 和 ZooKeeper:
    > /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
  2. 在机器 4 和 5 上更新 qpidd 和 postgresql:
    > /opt/apigee/apigee-setup/bin/update.sh -c qpid,ps -f configFile
  3. 更新机器 1 上的 LDAP:
    > /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
  4. 更新机器 4、5、1、2、3 上的 Edge 组件:
    > /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
  5. 在节点 2 和 3 上:
    1. 删除 /opt/nginx/conf.d 中的任何文件:
      > rm -f /opt/nginx/conf.d/*
    2. 重启边缘路由器:
      > /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
  6. 更新机器 1 上的界面:
    > /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile

对于 9 台主机的集群安装

如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee Edge 4.16.01 安装指南(位于 Apigee FTP 网站 ftp://ftp.apigee.com/)。

  1. 在机器 1、2 和 3 上更新 Cassandra 和 ZooKeeper:
    > /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
  2. 在机器 6 和 7 上更新 qpidd:
    > /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
  3. 在机器 8 和 9 上更新 postgresql:
    > /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
  4. 更新机器 1 上的 LDAP:
    > /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
  5. 按以下顺序更新机器 6、7、8、9、1、4 和 5 上的 Edge 组件:
    > /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
  6. 在节点 4 和 5 上:
    1. 删除 /opt/nginx/conf.d 中的任何文件:
      > rm -f /opt/nginx/conf.d/*
    2. 重启边缘路由器:
      > /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
  7. 更新机器 1 上的界面:
    > /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile

对于 13 个主机的集群安装

如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee Edge 4.16.01 安装指南(位于 Apigee FTP 网站 ftp://ftp.apigee.com/)。

  1. 在机器 1、2 和 3 上更新 Cassandra 和 ZooKeeper:
    > /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
  2. 更新机器 12 和 13 上的 qpidd:
    >
        /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
  3. 在机器 8 和 9 上更新 postgresql:
    >
        /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
  4. 更新机器 4 和 5 上的 LDAP:
    > /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
  5. 按以下顺序更新机器 12、13、8、9、6、7、10 和 11 上的 Edge 组件:
    > /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
  6. 在节点 10 和 11 上:
    1. 删除 /opt/nginx/conf.d 中的任何文件:
      > rm -f /opt/nginx/conf.d/*
    2. 重启边缘路由器:
      > /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
  7. 更新机器 6 和 7 上的界面:
    > /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile

对于 12 个主机的集群安装

如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee Edge 4.16.01 安装指南(位于 Apigee FTP 网站 ftp://ftp.apigee.com/)。

  1. 更新 Cassandra 和 ZooKeeper:
    1. 在数据中心 1 的机器 1、2 和 3 上:
      > /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
    2. 在数据中心 2 的机器 7、8 和 9 上
      > /opt/apigee/apigee-setup/bin/update.sh -c cs,zk -f configFile
  2. 更新 qpidd:
    1. 数据中心 1 中的机器 4、5
      > /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
    2. 数据中心 2 中的机器 10、11
      > /opt/apigee/apigee-setup/bin/update.sh -c qpid -f configFile
  3. 更新 postgresql:
    1. 数据中心 1 中的机器 6
      > /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
    2. 数据中心 2 中的机器 12
      > /opt/apigee/apigee-setup/bin/update.sh -c ps -f configFile
  4. 更新 LDAP:
    1. 数据中心 1 中的机器 1
      > /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
    2. 数据中心 2 中的机器 7
      > /opt/apigee/apigee-setup/bin/update.sh -c ldap -f configFile
  5. 更新 Edge 组件:
    1. 数据中心 1 中的机器 4、5、6、1、2、3
      > /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
    2. 数据中心 2 中的机器 10、11、12、7、8、9
      > /opt/apigee/apigee-setup/bin/update.sh -c edge -f configFile
    3. 在节点 2、3、8 和 9 上:
      1. 删除 /opt/nginx/conf.d 中的任何文件:
        > rm -f /opt/nginx/conf.d/*
      2. 重启边缘路由器:
        > /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
  6. 更新界面:
    1. 数据中心 1 中的机器 1
      > /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile
    2. 数据中心 2 中的机器 7
      > /opt/apigee/apigee-setup/bin/update.sh -c ui -f configFile

对于 7 主机 API BaaS 安装

如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee Edge 4.16.01 安装指南(位于 Apigee FTP 网站 ftp://ftp.apigee.com/)。

  1. 在机器 5、6 和 7 上更新 Cassandra:
    > /opt/apigee/apigee-setup/bin/update.sh -c cs -f configFile
  2. 在机器 1、2 和 3 上更新 ElasticSearch 和 API BaaS 堆栈:
    > /opt/apigee/apigee-setup/bin/update.sh -c e,b -f configFile
  3. 更新机器 4 上的 API BaaS 门户:
    > /opt/apigee/apigee-setup/bin/update.sh -c p -f configFile

对于包含 10 个主机的 API BaaS 安装

如需查看 Edge 拓扑和节点编号列表,请参阅 Apigee Edge 4.16.01 安装指南(位于 Apigee FTP 网站 ftp://ftp.apigee.com/)。

  1. 在机器 8、9 和 10 上更新 Cassandra:
    > /opt/apigee/apigee-setup/bin/update.sh -c cs -f configFile
  2. 在机器 1、2 和 3 上更新 ElasticSearch:
    > /opt/apigee/apigee-setup/bin/update.sh -c e -f configFile
  3. 更新机器 4、5 和 6 上的 API BaaS 堆栈:
    > /opt/apigee/apigee-setup/bin/update.sh -c b -f configFile
  4. 更新机器 7 上的 API BaaS 门户:
    > /opt/apigee/apigee-setup/bin/update.sh -c p -f configFile

非标准安装

如果您安装的是非标准安装,请按以下顺序更新 Edge 组件:

  1. ZooKeeper
  2. Cassandra
  3. Qpidd
  4. postgresql
  5. LDAP
  6. 边缘,表示所有节点上按以下顺序运行的“-c 边缘”配置文件:Qpid、Postgres、管理服务器、消息处理器、路由器。
  7. 在所有路由器节点上:
    1. 删除 /opt/nginx/conf.d 中的任何文件:
      > rm -f /opt/nginx/conf.d/*
    2. 重启边缘路由器:
      > /<inst_root>/apigee/apigee-service/bin/apigee-service edge-router restart
  8. 界面