ZooKeeper 模式 - Amazon Managed Streaming for Apache Kafka

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

ZooKeeper 模式

Apache ZooKeeper 是一種集中式服務,用於維護配置信息,命名,提供分散式同步以及提供組服務。所有這些類型的服務都以某種形式或其他由分佈式應用程序使用,」包括 Apache Kafka。

如果您的叢集使用 ZooKeeper 模式,您可以使用下列步驟來取得 Apache ZooKeeper 連接字串。但是,我們建議您使用連接BootstrapServerString到您的集群和 perfom 管理操作,因為該--zookeeper標誌已在卡夫卡 2.5 被棄用,並從卡夫卡 3.0 中刪除。

使用取得 Apache ZooKeeper 連線字串 AWS Management Console

  1. 在打開 Amazon MSK 控制台https://console.aws.amazon.com/msk/

  2. 此表格會顯示此帳戶下目前區域的所有叢集。選擇叢集名稱以檢視其描述。

  3. 叢集摘要頁面上,選擇檢視用戶端資訊。這將顯示啟動程序代理程序以及 Apache ZooKeeper 連接字符串。

使用取得 Apache ZooKeeper 連線字串 AWS CLI

  1. 如果您不知道叢集的 Amazon 資源名稱 (ARN),可以透過列出帳戶中的所有叢集來找到它。如需詳細資訊,請參閱列出 Amazon MSK 群集

  2. 若要取得 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