Managed Service for Apache Kafka automatically provisions the brokers for
a cluster. A broker has the following properties:

- `brokerIndex`: The zero-based index of the broker.
- `nodeId`: The node ID for the broker.
- `rack`: The [zone](https://docs.cloud.google.com/compute/docs/regions-zones.md.txt) where the broker is provisioned, for example `us-central1-a`.

To view the brokers for a cluster, perform the following steps.

### Console

1. Go to the **Managed Service for Apache Kafka** \>
   **Clusters** page.


   [Go to Clusters](https://console.cloud.google.com/managedkafka/clusters)

   <br />

2. Click the name of the cluster.

3. Select the **Configurations** tab. The cluster's brokers are listed under
   **Active Brokers**.

### gcloud

To get a list of the cluster's brokers, use the
[`managed-kafka clusters describe`](https://docs.cloud.google.com/sdk/gcloud/reference/managed-kafka/clusters/describe)
command with the `--full` flag.

```bash
gcloud managed-kafka clusters describe CLUSTER_ID \
  --location=LOCATION \
  --full \
  --format="yaml(brokerDetails)"
```

Replace the following:

- <var translate="no">CLUSTER_ID</var>: The ID or name of the cluster.
- <var translate="no">LOCATION</var>: The location of the cluster.

The output looks similar to the following:

```yaml
brokerDetails:
- brokerIndex: '0'
  nodeId: '10'
  rack: us-central1-c
- brokerIndex: '1'
  nodeId: '11'
  rack: us-central1-f
- brokerIndex: '2'
  nodeId: '12'
  rack: us-central1-b
```

### Kafka CLI


Before running this command, install the Kafka command-line tools on a Compute Engine VM. The
VM must be able to reach a subnet that is connected to your Managed Service for Apache Kafka
cluster. Follow the instructions in [Produce and consume messages with the Kafka command-line tools](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/quickstart.md.txt).

To get a list of the cluster's brokers, use the `kafka-configs.sh --describe`
command with the `--entity-type=brokers` flag.

```bash
kafka-configs.sh --describe --entity-type brokers \
  --bootstrap-server=BOOTSTRAP_ADDRESS \
  --command-config client.properties
```

Replace <var translate="no">BOOTSTRAP_ADDRESS</var> with the cluster's
[bootstrap address](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/view-cluster.md.txt#view-bootstrap-address).

This command returns a list of broker IDs, along with their dynamic
configuration settings, if any. It does not return the `rack` property.

## What's next

- [Overview of brokers in Managed Service for Apache Kafka](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/brokers.md.txt)
- [View a Managed Service for Apache Kafka cluster](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/view-cluster.md.txt)

*Apache Kafka® is a registered
trademark of The Apache Software Foundation or its affiliates in the United
States and/or other countries.*