14.3. 部署 Cruise Control Metrics Reporter
在开始进行控制前,您必须将 Kafka 代理配置为使用提供的 Cruise Control Metrics Reporter。用于 Metrics Reporter 的文件由 AMQ Streams 安装工件提供。
在运行时加载时,Metrics Reporter 会将指标发送到 __CruiseControlMetrics
主题,其中有三个自动创建的主题之一。Cruise Control 使用这些指标来创建和更新工作负载模型,并计算优化建议。
先决条件
-
以
kafka
用户身份登录 Red Hat Enterprise Linux。 - Kafka 和 ZooKeeper 正在运行。
流程
对于 Kafka 集群中的每个代理,一次:
停止 Kafka 代理:
/opt/kafka/bin/kafka-server-stop.sh
/opt/kafka/bin/kafka-server-stop.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在 Kafka 配置文件中 (
/opt/kafka/config/server.properties
) 配置 Cruise Control Metrics Reporter:将
CruiseControlMetricsReporter
类添加到metric.reporters
配置选项。不要删除任何现有的 Metrics Reporters。metric.reporters=com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
metric.reporters=com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
Copy 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=1
Copy 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 配置文件中(
/opt/kafka/config/server.properties
)通过设置相关的客户端配置属性在 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 Server 客户端使用这些属性。
重启 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.properties
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 有关在多节点集群中重启代理的详情,请参考 第 3.3 节 “执行安全滚动重启 Kafka 代理”。
- 对剩余的代理重复步骤 1-5。