Upgrade Guide
升级指南
Apache Pulsar is comprised of multiple components, ZooKeeper, bookies and brokers. 这些组件要么是有状态的要么是无状态的。 除非有特殊需求,否则不必升级ZooKeeper节点。 While upgrading, you need to pay attention to bookies (stateful), brokers and proxies (stateless).
以下是一些升级Pulsar 集群的指南。 请升级前阅读指南
- 在升级前备份所有配置文件。
- 完整地阅读指南、制定计划、然后执行计划。 制定升级计划时,需要考虑到你的具体要求和环境。
- 注意升级组件的命令。 In general, you do not need to upgrade your ZooKeeper or configuration store cluster (the global ZooKeeper cluster). You need to upgrade bookies first, and then upgrade brokers, proxies, and your clients.
- 如果
autorecovery
启动,则需要在升级过程中禁止autorecovery
,并且完成这个过程后重新启动。 - 认真阅读每一个版本的注释。 版本注释包括可能影响升级的特征、配置变化。
- 在升级集群中该类型的所有节点之前,升级每个类型的一小部分节点到 canary 测试新版本。 When you have upgraded the canary nodes, run for a while to ensure that they are working correctly.
- Upgrade one data center to verify new version before upgrading all data centers if your cluster is running in multi-cluster replicated mode.
注意:目前 Apache Pulsar 兼容两种版本。
升级序列
升级 Apache Pulsar 集群时须遵循升级序列。
- 升级 ZooKeeper (可选择)。
- Canary 测试:以一组或一小部分 ZooKeeper 节点测试升级版本。
- 滚动升级:一次性将升级版本逐步部署到所有 ZooKeeper 服务器。 在整个滚动升级过程中监视仪表板。
- 升级bookies
- canary 测试:以一组或一小部分 bookies 测试一个升级版本。 - Rolling upgrade: - a. 用以下命令禁用
autorecovery
。shell bin/bookkeeper shell autorecovery -disable
- b. Rollout the upgraded version to all bookies in the cluster after you have determined a version is safe after canary.
- c. After all bookies are upgraded, re-enable
autorecovery
with the following command.bin/bookkeeper shell autorecovery -enable
- Upgrade brokers
- Canary test: test an upgraded version in one or a small set of brokers.
- Rolling upgrade: rollout the upgraded version to all brokers in the cluster after you have determined a version is safe after canary.
- Upgrade proxies
- Canary test: test an upgraded version in one or a small set of proxies. - Rolling upgrade: rollout the upgraded version to all proxies in the cluster after you have determined a version is safe after canary.
升级 ZooKeeper (可选择)。
While upgrading ZooKeeper servers, you can do canary test first, and then upgrade all ZooKeeper servers in the cluster.
Canary 测试
升级集群中所有的 ZooKeeper 服务器之前,可以测试其中一个 ZooKeeper 服务器中的升级版本。
升级 ZooKeeper 服务器至新的版本需完成以下步骤:
- 停止 ZooKeeper 服务器。
- 升级二进制和配置文件。
- 用新的二进制文件启动 ZooKeeper 服务器。
- 用
pulsar zookeeper-shell
连接新升级的 ZooKeeper 服务器,然后运行新的命令来验证它是否如预期的那样运转。 - 运行 ZooKeeper 服务器几天,观察并且确保 ZooKeeper 集群运行的很好。
Canary 回转
如果在 canary 测试过程中出现了问题,那么可以关闭有问题的 ZooKeeper 节点,恢复二进制和配置,使用还原的二进制重新启动 ZooKeeper。
升级所有的 ZooKeeper 服务器
用 canary 测试升级集群中的一个 ZooKeeper 后,就可以升级集群中所有的 ZooKeeper 服务器。
可以根据以下 canary 测试步骤逐个升级所有的 ZooKeeper 服务器。
升级bookies
While upgrading bookies, you can do canary test first, and then upgrade all bookies in the cluster. 欲知更多的细节,可以阅读 Apache BookKeeper Upgrade guide。
Canary 测试
升级集群中所有的 bookies 之前,可以用一组或一小部分 bookies 来测试升级版本。
升级 bookies 至新的版本需完成以下步骤:
- 停止 bookies。
- 升级二进制和配置文件。
- Start the bookie in
ReadOnly
mode. It is to verify if the bookie of this new version runs well for read workload.bin/pulsar bookie --readOnly
- 当 bookies 以
ReadOnly
模式成功运行时,停止 bookies 并以Write/Read
模式重新启动。bin/pulsar bookie
- 观察且确保集群服务器同时提供读写流量。
Canary 回转
If issues occur during canary test, you can shut down the problematic bookie node. Other bookies in the cluster will replace this problematic bookie node with autorecovery.
升级所有的 bookies
用 canary 测试升级集群中的一些 bookies之后,就可以升级集群中所有的 bookies。
升级之前,必须决定是否一次升级整个集群,包括停机时间和滚动升级脚本。
在滚动升级脚本中,一次升级一个 bookies。 在停机时间升级脚本中,先关闭全部集群,升级每个 bookies,然后启动集群。
While upgrading in both scenarios, the procedure is the same for each bookie.
- 停止 bookies。
- 升级软件 (新的二进制或是新的配置文件)。
- 启动 bookies。
Advanced operations When upgrading a large BookKeeper cluster in rolling upgrade scenario, it is slow to upgrade one bookie at a time. If you have configured rack-aware or region-aware placement policy, you can upgrade bookies rack by rack or region by region. It speeds up the whole upgrade process.
升级 brokers 和 proxies
brokers 和 proxies 的升级过程是一样的。 Brokers and proxies are stateless
, so it is easy to upgrade the two services.
Canary 测试
可以在升级集群中所有的节点之前用一组或一小部分节点测试升级版本。
升级新的版本需完成以下步骤:
- 停止 broker (或 proxy)。
- 升级二进制和配置文件。
- 启动 broker (或 proxy)。
Canary 回转
在 canary 测试的过程中出现问题时, 可以关闭有问题的 broker (或 proxy) 节点。 还原到旧版本,然后重新启动 broker (或 proxy) 。
Upgrade all brokers/proxies
After canary test to upgrade some brokers/proxies in your cluster, you can upgrade all brokers/proxies in your cluster.
升级之前,必须决定是否一次升级整个集群,包括停机时间和滚动升级脚本。
滚动升级脚本下,如果集群规模较小,则可以一次升级一个 broker 或 一个 proxy。 如果集群规模较大,则可以分批升级 brokers 或 proxies。 分批升级 brokers 或 proxies 时,确保集群中剩余 brokers 或 proxies 具有足够的容量来处理升级期间的流量。
In a downtime upgrade scenario, shut down the entire cluster, upgrade each broker/proxy, and then start the cluster.
While upgrading in both scenarios, the procedure is the same for each broker or proxy.
- 停止 broker 或 proxy。
- 升级软件 (新的二进制或是新的配置文件)。
- 启动 broker 或 proxy。