Install Kafka 0.10.1 on CentOS 6.7

Source: Internet
Author: User

Install Kafka 0.10.1 on CentOS 6.7
Master

[root@master ~]# wget http://apache.fayea.com/kafka/0.10.1.0/kafka_2.10-0.10.1.0.tgz[root@master ~]# tar -zxvf kafka_2.10-0.10.1.0.tgz[root@master ~]# mv kafka_2.10-0.10.1.0 /usr/local/
[root@master ~]# vi /usr/local/kafka_2.10-0.10.1.0/config/server.properties
  1. Modify

    zookeeper.connect=localhost:2181

    Is

    zookeeper.connect=master:2181,slave:2181
    • Add

      host.name=master

      Save and exit

      [root@master ~]# rsync -av /usr/local/kafka_2.10-0.10.1.0 slave:/usr/local/
      Slave
      [root@slave ~]# vi /usr/local/kafka_2.10-0.10.1.0/config/server.properties

      Modify

      broker.id=0host.name=master

      Is

      broker.id=1host.name=slave

      Save and exit

      Start KafkaMaster
      [root@master ~]# cd /usr/local/kafka_2.10-0.10.1.0/[root@master kafka_2.10-0.10.1.0]# bin/kafka-server-start.sh -daemon config/server.properties
      Slave
      [root@slave ~]# cd /usr/local/kafka_2.10-0.10.1.0/[root@slave kafka_2.10-0.10.1.0]# bin/kafka-server-start.sh -daemon config/server.properties
      • Finally, check whether the installation is successful. Use the Client Detection that comes with Kafka. Go to the Kafka installation home directory and start the producer to enter the Interactive Client mode.
      Master

      Create a topic named test

      [root@master kafka_2.10-0.10.1.0]# bin/kafka-topics.sh --create --zookeeper master:2181 --replication-factor 1 --partitions 1 --topic test

      Start a producer on a terminal

      [root@master kafka_2.10-0.10.1.0]# bin/kafka-console-producer.sh --broker-list master:9092 --topic test
      Slave

      Start the consumer in another terminal and enter the Interactive Client

      [root@slave kafka_2.10-0.10.1.0]# bin/kafka-console-consumer.sh --zookeeper master:2181 --topic test --from-beginning

      On the master (producer), input Hello World on the keyboard !; And then on the slave (consumer), the screen has the same information output. This proves that the Kafka cluster has been successfully built.

      Contact Us

      The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

      If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

      A Free Trial That Lets You Build Big!

      Start building with 50+ products and up to 12 months usage for Elastic Compute Service

      • Sales Support

        1 on 1 presale consultation

      • After-Sales Support

        24/7 Technical Support 6 Free Tickets per Quarter Faster Response

      • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.