Docs Self-Managed Get Started Redpanda CLI Specify Broker Addresses for rpk You are viewing the Self-Managed v24.3 beta documentation. We welcome your feedback at the Redpanda Community Slack #beta-feedback channel. To view the latest available version of the docs, see v24.2. Specify Broker Addresses for rpk For rpk to know where to run Kafka-related commands, you must provide the broker addresses for each broker 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) Environment variable setting (RPK_BROKERS) Configuration file setting in redpanda.yaml (rpk.kafka_api.brokers) Command line flag settings take precedence over environment variable settings and configuration file settings. If the command line does not contain the -X brokers 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 Broker addresses are required for communicating with the Kafka API. Provide these addresses with the -X brokers flag for commands related to Kafka broker tasks, such as rpk topic create, rpk topic produce, and rpk topic consume. The following table shows which rpk commands require the -X brokers flag. Command Address flag required rpk cluster info -X brokers rpk cluster metadata -X brokers rpk group -X brokers rpk security acl -X brokers rpk topic -X brokers Environment variable settings Environment variable settings last for the duration of the shell session, or until you set the variable to a different setting. 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, to configure three brokers on a single machine running on localhost: export RPK_BROKERS="192.168.72.34:9092,192.168.72.35:9092,192.168.72.36.9092" Configuration file settings As each Redpanda broker starts up, a redpanda.yaml configuration file is automatically generated for that broker. This file contains a section for rpk settings, which includes Kafka 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 following example shows the addresses and port numbers for three brokers. rpk: kafka_api: brokers: - 192.168.72.34:9092 - 192.168.72.35:9092 - 192.168.72.36.9092 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. Back to top × Simple online edits For simple changes, such as fixing a typo, you can edit the content directly on GitHub. Edit on GitHub Or, open an issue to let us know about something that you want us to change. Open an issue Contribution guide For extensive content updates, or if you prefer to work locally, read our contribution guide . Was this helpful? thumb_up thumb_down group Ask in the community mail Share your feedback group_add Make a contribution rpk Profiles Specify Admin API Addresses for rpk