本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
获取 Amazon MSK 集群的 Apache ZooKeeper 连接字符串
使用获取 Apache ZooKeeper 连接字符串Amazon Web Services Management Console
在以下位置打开亚马逊 MSK 控制台https://console.amazonaws.cn/msk/
。 -
该表显示了此账户下当前区域的所有集群。选择集群名称以查看其说明。
-
在 “集群摘要” 页面上,选择 “查看客户机信息”。这会向您显示引导程序代理以及 Apache ZooKeeper 连接字符串。
使用获取 Apache ZooKeeper 连接字符串Amazon CLI
如果您不知道集群的 Amazon 资源名称 (ARN),您可以通过列出您账户中的所有集群来找到它。有关更多信息,请参阅 列出Amazon MSK 集群。
-
要获取 Apache ZooKeeper 连接字符串以及有关集群的其他信息,请运行以下命令,
ClusterArn
替换为集群的 ARN。aws kafka describe-cluster --cluster-arn
ClusterArn
该
describe-cluster
命令的输出如以下 JSON 示例所示。{ "ClusterInfo": { "BrokerNodeGroupInfo": { "BrokerAZDistribution": "DEFAULT", "ClientSubnets": [ "subnet-0123456789abcdef0", "subnet-2468013579abcdef1", "subnet-1357902468abcdef2" ], "InstanceType": "kafka.m5.large", "StorageInfo": { "EbsStorageInfo": { "VolumeSize": 1000 } } }, "ClusterArn": "arn:aws:kafka:us-east-1:111122223333:cluster/testcluster/12345678-abcd-4567-2345-abcdef123456-2", "ClusterName": "testcluster", "CreationTime": "2018-12-02T17:38:36.75Z", "CurrentBrokerSoftwareInfo": { "KafkaVersion": "2.2.1" }, "CurrentVersion": "K13V1IB3VIYZZH", "EncryptionInfo": { "EncryptionAtRest": { "DataVolumeKMSKeyId": "arn:aws:kms:us-east-1:555555555555:key/12345678-abcd-2345-ef01-abcdef123456" } }, "EnhancedMonitoring": "DEFAULT", "NumberOfBrokerNodes": 3, "State": "ACTIVE", "ZookeeperConnectString": "10.0.1.101:2018,10.0.2.101:2018,10.0.3.101:2018" } }
上一 JSON 示例在
describe-cluster
命令输出中显示ZookeeperConnectString
键。复制与此键对应的值,并保存它以用于在集群上创建主题。重要
您的 Amazon MSK 集群必须处于
ACTIVE
状态才能获取 Apache ZooKeeper 连接字符串。当集群仍处于CREATING
状态时,describe-cluster
命令的输出不包含ZookeeperConnectString
。如果发生这种情况,请等待几分钟,然后在集群进入ACTIVE
状态后再次运行describe-cluster
。
使用 API 获取 Apache ZooKeeper 连接字符串
要使用 API 获取 Apache ZooKeeper 连接字符串,请参阅DescribeCluster。