13.3. 部署 Cruise Control Metrics Reporter
在开始 Cruise Control 前,您必须将 Kafka 代理配置为使用提供的 Cruise Control Metrics Reporter。Metrics Reporter 的文件由 Apache Kafka 安装工件的 Streams 提供。
在运行时加载时,Metrics Reporter 会将指标发送到 __CruiseControlMetrics 主题,其中有三个自动创建的主题之一。Cruise Control 使用这些指标来创建和更新工作负载模型,并计算优化建议。
先决条件
- 每个主机上安装了 Apache Kafka 的流,且配置文件可用。
-
以
kafka用户身份登录 Red Hat Enterprise Linux。
流程
对于 Kafka 集群中的每个代理,一次一个:
停止 Kafka 代理:
/opt/kafka/bin/kafka-server-stop.sh
/opt/kafka/bin/kafka-server-stop.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow 编辑 Kafka 配置属性文件,以配置 Cruise Control Metrics Reporter。
将
CruiseControlMetricsReporter类添加到metric.reporters配置选项。不要删除任何现有的指标报告器。metric.reporters=com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
metric.reporters=com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporterCopy to Clipboard Copied! Toggle word wrap Toggle overflow 添加以下配置选项和值:
cruise.control.metrics.topic.auto.create=true cruise.control.metrics.topic.num.partitions=1 cruise.control.metrics.topic.replication.factor=1
cruise.control.metrics.topic.auto.create=true cruise.control.metrics.topic.num.partitions=1 cruise.control.metrics.topic.replication.factor=1Copy to Clipboard Copied! Toggle word wrap Toggle overflow 这些选项允许 Cruise Control Metrics Reporter 创建
__CruiseControlMetrics主题,其日志清理策略为DELETE。如需更多信息,请参阅 Auto-created topics 和 Log cleanup policy for Cruise Control Metrics topic。
如果需要,配置 SSL。
在 Kafka 配置属性文件中,通过设置相关的客户端配置属性,在 Cruise Control Metrics Reporter 和 Kafka 代理之间配置 SSL。
Metrics Reporter 接受带有
cruise.control.metrics.reporter前缀的所有特定于标准制作者的配置属性。例如:cruise.control.metrics.reporter.ssl.truststore.password。在 Cruise Control 属性文件中(
/opt/cruise-control/config/cruisecontrol.properties)通过设置相关的客户端配置属性在 Kafka 代理和 Cruise Control 服务器之间配置 SSL。Cruise Control 从 Kafka 中继承 SSL 客户端属性选项,并将这些属性用于所有 Cruise Control 服务器客户端。
重启 Kafka 代理:
/opt/kafka/bin/kafka-server-start.sh -daemon /opt/kafka/config/server.properties
/opt/kafka/bin/kafka-server-start.sh -daemon /opt/kafka/config/server.propertiesCopy to Clipboard Copied! Toggle word wrap Toggle overflow 有关在多节点集群中重启代理的详情,请参考 第 4.3 节 “执行 Kafka 代理的安全滚动重启”。
- 对剩余的代理重复步骤 1-5。