ZooKeeper mode - Amazon Managed Streaming for Apache Kafka
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

ZooKeeper mode

Apache ZooKeeper is "a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications," including Apache Kafka.

If your cluster is using ZooKeeper mode, you can use the steps below to get the Apache ZooKeeper connection string. However, we recommend that you use the BootstrapServerString to connect to your cluster and perfom admin operations as the --zookeeper flag has been deprecated in Kafka 2.5 and is removed from Kafka 3.0.

Getting the Apache ZooKeeper connection string using the Amazon Web Services Management Console

  1. Open the Amazon MSK console at https://console.aws.amazon.com/msk/.

  2. The table shows all the clusters for the current region under this account. Choose the name of a cluster to view its description.

  3. On the Cluster summary page, choose View client information. This shows you the bootstrap brokers, as well as the Apache ZooKeeper connection string.

Getting the Apache ZooKeeper connection string using the Amazon CLI

  1. If you don't know the Amazon Resource Name (ARN) of your cluster, you can find it by listing all the clusters in your account. For more information, see Listing Amazon MSK clusters.

  2. To get the Apache ZooKeeper connection string, along with other information about your cluster, run the following command, replacing ClusterArn with the ARN of your cluster.

    aws kafka describe-cluster --cluster-arn ClusterArn

    The output of this describe-cluster command looks like the following JSON example.

    { "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" } }

    The previous JSON example shows the ZookeeperConnectString key in the output of the describe-cluster command. Copy the value corresponding to this key and save it for when you need to create a topic on your cluster.

    Important

    Your Amazon MSK cluster must be in the ACTIVE state for you to be able to obtain the Apache ZooKeeper connection string. When a cluster is still in the CREATING state, the output of the describe-cluster command doesn't include ZookeeperConnectString. If this is the case, wait a few minutes and then run the describe-cluster again after your cluster reaches the ACTIVE state.

Getting the Apache ZooKeeper connection string using the API

To get the Apache ZooKeeper connection string using the API, see DescribeCluster.