Modifying the Kafka Configuration Files
All Kafka configuration files are stored in the $KAFKA_HOME/config directory.
- Go to the Kafka configuration directory.
1cd $KAFKA_HOME/config
- Modify the server.properties file.
- Open the file.
1vi server.properties - Press i to enter the insert mode and modify the file as follows:
1 2 3 4 5
broker.id=0 port=6667 host.name=agent1 log.dirs=/data/data1/kafka,/data/data2/kafka,/data/data3/kafka,/data/data4/kafka,/data/data5/kafka,/data/data6/kafka,/data/data7/kafka,/data/data8/kafka,/data/data9/kafka,/data/data10/kafka,/data/data11/kafka,/data/data12/kafka zookeeper.connect=agent1:2181,agent2:2181,agent3:2181
In the preceding command, set host.name to the IP address of agent1 and log.dirs to the actual data storage path.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Synchronize the configuration to other nodes.
- Copy kafka_2.11-0.10.1.1 to the /usr/local directory on each of agent2 and agent3.
1 2
scp -r /usr/local/kafka_2.11-2.2.0 root@agent2:/usr/local scp -r /usr/local/kafka_2.11-2.2.0 root@agent3:/usr/local
- Log in to agent2 and agent3 and separately create soft links for kafka_2.11-2.2.0.
1 2
cd /usr/local ln -s kafka_2.11-2.2.0 kafka
- Copy kafka_2.11-0.10.1.1 to the /usr/local directory on each of agent2 and agent3.
- Modify related node parameters.
- Log in to agent2 and modify the server.properties file.
1vi server.properties - Press i to enter the insert mode and modify the file as follows:
1 2
broker.id=1 host.name=agent2 # Enter the corresponding IP address.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Log in to agent3 and modify the server.properties file.
1vi server.properties - Press i to enter the insert mode and modify the file as follows:
1 2
broker.id=2 host.name=agent3 # Enter the corresponding IP address.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Log in to agent2 and modify the server.properties file.
Parent topic: Deploying Kafka