本地搭建Kafka多Broker集群启动新节点时报错求助
Let's walk through the issues with your setup and fix them one by one — there are a few clear mismatches between your Ubuntu environment and the commands/configurations you're using:
1. Incorrect Script Path for Linux
You're using the Windows-specific startup script:
bin\windows\kafka-server-start.sh
But Ubuntu is a Linux system, so you need to use the Linux version of the script with forward slashes (not backslashes):
bin/kafka-server-start.sh
The bin\windows directory is only for Windows installations — it won't work properly on Linux.
2. Windows-Style Log Directory Path
Your log.dir setting uses a Windows path format:
log.dir=C:\kafka\kafka-logs-1
Linux doesn't recognize drive letters like C:\ — you need to replace this with a valid Linux filesystem path. For example:
- If Kafka is installed in your home directory:
log.dir=/home/your-username/kafka/kafka-logs-1 - If it's in a system-wide directory:
log.dir=/opt/kafka/kafka-logs-1
Important: Make sure the directory exists before starting the broker. Create it with:
mkdir -p /home/your-username/kafka/kafka-logs-1
(Replace your-username with your actual Ubuntu username.)
3. Verify Unique Broker ID
Double-check that your original Kafka broker uses a different broker.id (the default is 0). If broker.id=1 is already in use by another running broker, this new instance will fail to start. Confirm the original server.properties file to avoid conflicts.
4. Check Port Availability
Your listeners=PLAINTEXT://:9093 config is valid, but ensure port 9093 isn't being used by another process. Run this command to check:
ss -tulpn | grep 9093
If the port is occupied, either kill the conflicting process or change the listener port in server-1.properties.
Corrected Startup Command
After fixing the above issues, start the broker with this command:
bin/kafka-server-start.sh config/server-1.properties &
The & at the end will run the process in the background, which is fine for testing.
If you still run into errors, check the broker's log files in your configured log.dir (look for server.log) — it will contain detailed error messages pointing to the root cause (e.g., Zookeeper connection issues, permission errors on the log directory).
内容的提问来源于stack exchange,提问作者Rahul Sharma

