Rate This Document
Findability
Accuracy
Completeness
Readability

Modifying the Kafka Configuration Files

All Kafka configuration files are stored in the $KAFKA_HOME/config directory.

  1. Go to the Kafka configuration directory.
    1
    cd $KAFKA_HOME/config
    
  2. Modify the server.properties file.
    1. Open the file.
      1
      vi server.properties
      
    2. 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.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Synchronize the configuration to other nodes.
    1. 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
      
    2. 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
      
  4. Modify related node parameters.
    1. Log in to agent2 and modify the server.properties file.
      1
      vi server.properties
      
    2. 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.
      
    1. Press Esc, type :wq!, and press Enter to save the file and exit.
    2. Log in to agent3 and modify the server.properties file.
      1
      vi server.properties
      
    3. 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.
      
    4. Press Esc, type :wq!, and press Enter to save the file and exit.