ZooKeeper mode
Apache ZooKeeper
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 AWS Management Console
Open the Amazon MSK console at https://console.aws.amazon.com/msk/
. -
The table shows all the clusters for the current region under this account. Choose the name of a cluster to view its description.
-
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 AWS CLI
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.
-
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 thedescribe-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 theCREATING
state, the output of thedescribe-cluster
command doesn't includeZookeeperConnectString
. If this is the case, wait a few minutes and then run thedescribe-cluster
again after your cluster reaches theACTIVE
state.
Getting the Apache ZooKeeper connection string using the API
To get the Apache ZooKeeper connection string using the API, see DescribeCluster.