4. Deploying Kafka clusters under Linux contos6.8

Source: Internet
Author: User
Tags zookeeper zookeeper client

There are 3 servers, the IP is 192.168.174.10,192.168.174.11,192.168.174.12, respectively.

  1. Download the website and unzip the installation on each machine separately.
    # 创建kafka的安装目录mkdir -p /usr/local/software/kafka# 解压tar -xvf kafka_2.12-1.1.0.tgz -C /usr/local/software/kafka/
  2. Modify each server's/etc/profile file, set the Kafka environment variable, add the following content
    export KAFKA_HOME=/usr/local/software/kafka/kafka_2.12-1.1.0export PATH=$PATH:$KAFKA_HOME/bin

    After adding the configuration, reboot the command as follows:

    source /etc/profile
  3. Modify the Server.properties file under $kafka_home/config for each server, modify the agent ID and log storage directory
    #指定代理id,borker.id可以任意指定,前提是保证集群内每台机器的broker.id唯一,第二台机器设置为2...以此类推broker.id=1#设置日志目录log.dirs=/opt/data/kafka/kafka-logs#设置zookeeper集群地址zookeeper.connect=192.168.174.7:2181,192.168.174.8:2181,192.168.174.9:2181#设置本机地址,设置为本服务器的ip地址。如果不设置会在创建主题和发送消息时,发生NOT LEADER FOR PARTITION异常。host.name=192.168.174.10
  4. After the configuration is complete, start the Kafka of the 3 servers separately, and make sure the Zookeeper cluster has started successfully before starting Kafka.
    kafka-server-start.sh -daemon server.properties
  5. Verify that startup is successful
    jps

    If you see the Kafka process, the boot succeeds.
    The Zookeeper directory structure can also be viewed through the Zookeeper client, as follows:

    #登录zookeeperzkCli . sh -server 192.168.174.7:2181#查看目录结构ls /#查看已启动的kafka代理ls /brokers/ids

4. Deploying Kafka clusters under Linux contos6.8

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.