# Broker and Admin API Addresses

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [streaming-full.txt](https://docs.redpanda.com/streaming-full.txt)

---
title: Broker and Admin API Addresses
latest-operator-version: v26.1.4
# EOL = End-of-Life (support lifecycle status)
page-is-nearing-eol: "false"
page-is-past-eol: "true"
page-eol-date: December 22, 2024
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
docname: broker-admin
page-component-name: streaming
page-version: "23.3"
page-component-version: "23.3"
page-component-title: Streaming
page-relative-src-path: broker-admin.adoc
page-edit-url: https://github.com/redpanda-data/docs/edit/v/23.3/modules/get-started/pages/broker-admin.adoc
description: Learn how and when to specify Redpanda broker addresses and admin addresses for <code>rpk</code> commands, so <code>rpk</code> knows where to run Kafka-related or admin-related commands.
page-git-created-date: "2023-07-24"
page-git-modified-date: "2024-02-26"
support-status: past end-of-life
---

<!-- Source: https://docs.redpanda.com/streaming/23.3/get-started/broker-admin.md -->

In order for `rpk` to know where to run Kafka-related commands or admin-related commands, you must provide the broker addresses or admin server addresses for each node of a Redpanda cluster. You can specify these addresses as IP addresses or as hostnames, using any of these methods:

-   Command line flag (`-X brokers` or `-X admin.hosts`)

-   Environment variable setting (`RPK_BROKERS` or `RPK_ADMIN_HOSTS`)

-   Configuration file setting in `redpanda.yaml` (`rpk.kafka_api.brokers` or `rpk.admin_api.addresses`)


Command line flag settings take precedence over environment variable settings and configuration file settings. If the command line does not contain the `-X brokers` or `-X admin.hosts` settings, the environment variable settings are used. If the environment variables are not set, the values in the configuration file are used.

## [](#command-line-flags)Command line flags

To determine whether a command needs the `-X brokers` flag or the `-X admin.hosts` flag, follow these guidelines:

-   Broker addresses are required for communicating with the Kafka API. Provide these addresses by using the `-X brokers` flag for commands related to Kafka broker tasks; for example, [`rpk topic create`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-topic/rpk-topic-create/), [`rpk topic produce`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-topic/rpk-topic-produce/), and [`rpk topic consume`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-topic/rpk-topic-consume/).

-   Admin API addresses are required for communicating with the Admin API. Provide these addresses by using the `—-api-urls` flag for commands related to cluster or user tasks; for example, [`rpk cluster health`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-cluster/rpk-cluster-health/), [`rpk cluster maintenance enable <node_id>`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-cluster/rpk-cluster-maintenance/), and [`rpk acl user`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-acl/rpk-acl-user/). Note that [`rpk cluster info`](https://docs.redpanda.com/streaming/23.3/reference/rpk/rpk-cluster/rpk-cluster-metadata/) is an exception to this rule, since it requires the `-X brokers` flag.


The following table shows which `rpk` commands require the `-X brokers` flag, which require the `-X admin.hosts` or `--hosts` flag, and which don’t require either flag.

| Command | Address flag required |
| --- | --- |
| rpk acl (all except rpk acl user) | -X brokers |
| rpk acl user | -X admin.hosts |
| rpk cloud | None |
| rpk cluster (all except rpk cluster info and rpk cluster metadata) | -X admin.hosts |
| rpk cluster info | -X brokers |
| rpk cluster metadata | -X brokers |
| rpk container | None |
| rpk debug | None |
| rpk generate | None |
| rpk group | -X brokers |
| rpk iotune | None |
| rpk plugin | None |
| rpk redpanda (all except rpk redpanda admin) | None |
| rpk redpanda admin | --hosts |
| rpk topic | -X brokers |
| rpk version | None |

## [](#environment-variable-settings)Environment variable settings

Environment variable settings last for the duration of the shell session, or until you set the variable to a different setting.

You can configure the environment variable `RPK_BROKERS` for broker addresses so you don’t have to include the `-X brokers` flag each time you run an `rpk` command. For example, this is how you could configure three brokers on a single machine running on localhost:

```bash
export RPK_BROKERS="127.0.0.1:41457,127.0.0.1:39397,127.0.0.1:37735"
```

For Admin API addresses, configure the environment variable `RPK_ADMIN_HOSTS`. For example, this is how you could configure the addresses to use when running Admin API commands on an external cluster with three nodes:

```bash
export RPK_ADMIN_HOSTS="192.168.78.34:9644,192.168.78.35:9644,192.168.78.36:9644"
```

## [](#configuration-file-settings)Configuration file settings

As each Redpanda node starts up, a `redpanda.yaml` configuration file is automatically generated for that node. This file contains a section for `rpk` settings, which includes Kafka API settings and Admin API settings.

The `kafka_api` section contains the address and port for each broker. The default address is `0.0.0.0`, and the default port is 9092. You can edit this line and replace it with the IP addresses of your Redpanda brokers.

The `admin_api` section contains the address and port for each admin server. The default address is `0.0.0.0`, and the default port is 9644. You can edit this line and replace it with the Admin API IP addresses.

The following example shows the addresses and port numbers for two brokers and two admin servers.

```yaml
rpk:
  kafka_api:
    brokers:
    - 192.168.72.34:9092
    - 192.168.72.35:9092

  admin_api:
    - 192.168.72.34:9644
    - 192.168.72.35:9644
```

> 📝 **NOTE**
>
> If you do not update the default addresses in the `redpanda.yaml` file, you must provide the required addresses on the command line or by setting the corresponding environment variable.