本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ZooKeeper 模式
Apache ZooKeeper
如果您的叢集使用 ZooKeeper 模式,您可以使用下列步驟來取得 Apache ZooKeeper 連接字串。但是,我們建議您使用連接BootstrapServerString
到您的集群和 perfom 管理操作,因為該--zookeeper
標誌已在卡夫卡 2.5 被棄用,並從卡夫卡 3.0 中刪除。
使用取得 Apache ZooKeeper 連線字串 AWS Management Console
在打開 Amazon MSK 控制台https://console.aws.amazon.com/msk/
。 -
此表格會顯示此帳戶下目前區域的所有叢集。選擇叢集名稱以檢視其描述。
-
在叢集摘要頁面上,選擇檢視用戶端資訊。這將顯示啟動程序代理程序以及 Apache ZooKeeper 連接字符串。
使用取得 Apache ZooKeeper 連線字串 AWS 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
。
使用取得 Apache ZooKeeper 連線字串 API
若要使用取得 Apache ZooKeeper 連接字串API,請參閱DescribeCluster。