zoukankan      html  css  js  c++  java
  • zookeeper、kafka集群安装部署

    zookeeper
    1.三节点执行
     tar -zxvf zookeeper-3.4.6.tar.gz -C /usr/local/
    2.三节点执行
    [root@localhost opt]# cd /usr/local/zookeeper-3.4.6/
    [root@localhost zookeeper-3.4.6]# mkdir -p zkdata
    [root@localhost zookeeper-3.4.6]# mkdir -p zkdatalog
    3.修改配置文件,三节点执行
    [root@kafka2 conf]# vi zoo.cfg 
    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial
    # synchronization phase can take
    initLimit=10
    # The number of ticks that can pass between
    # sending a request and getting an acknowledgement
    syncLimit=5
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just
    # example sakes.
    dataDir=/usr/local/zookeeper-3.4.6/zkdata
    dataLogDir=/usr/local/zookeeper-3.4.6/zkdatalog
    # the port at which the clients will connect
    clientPort=2181
    server.1=IP1:2888:3888
    server.2=IP2:2888:3888
    server.3=IP3:2888:3888
    # the maximum number of client connections.
    # increase this if you need to handle more clients
    #maxClientCnxns=60
    #
    # Be sure to read the maintenance section of the
    # administrator guide before turning on autopurge.
    #
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    #
    # The number of snapshots to retain in dataDir
    #autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    #autopurge.purgeInterval=1
    
    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial
    # synchronization phase can take
    initLimit=10
    # The number of ticks that can pass between
    # sending a request and getting an acknowledgement
    syncLimit=5
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just
    # example sakes.
    dataDir=/usr/local/zookeeper-3.4.6/zkdata
    dataLogDir=/usr/local/zookeeper-3.4.6/zkdatalog
    # the port at which the clients will connect
    clientPort=2181
    server.1=IP1:2888:3888
    server.2=IP2:2888:3888
    server.3=IP3:2888:3888
    # the maximum number of client connections.
    # increase this if you need to handle more clients
    #maxClientCnxns=60
    #
    # Be sure to read the maintenance section of the
    # administrator guide before turning on autopurge.
    #
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    #
    # The number of snapshots to retain in dataDir
    #autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    #autopurge.purgeInterval=1
    
    4.节点1
    [root@localhost zookeeper-3.4.6]# echo '1' > zkdata/myid
    节点2
    [root@localhost zookeeper-3.4.6]# echo '2' > zkdata/myid
    节点3
    [root@localhost zookeeper-3.4.6]# echo '1' > zkdata/myid
    5.起zookeper进程,三节点执行
    [root@kafka1 ~]# cd /usr/local/zookeeper-3.4.6/bin/
    [root@kafka1 bin]# ./zkServer.sh start
    
    
    kafka
    6.三节点执行
    [root@kafka3 opt]# tar -zxvf kafka_2.11-1.0.0.tgz 
    [root@kafka1 kafka_2.11-1.0.0]# mkdir -p kdata
    7.修改配置文件,三节点执行,其他信息一致,根据自己实际环境更改,这里只更改了必要的几个。broker.id三节点不能重复,zookeeper.connect写ip和主机名都可以
    [root@kafka2 config]# vi server.properties 
    broker.id=1 #节点1
    broker.id=2 #节点2
    broker.id=3 #节点3
    listeners=PLAINTEXT://:9092
    log.dirs=/opt/kafka_2.11-1.0.0/kdata
    zookeeper.connect=kafka1:2181,kafka2:2181,kafka3:2181
    
    8.后台启动启动kafka进程
    [root@kafka1 kafka_2.11-1.0.0]# bin/kafka-server-start.sh -daemon config/server.properties &

     

  • 相关阅读:
    【codevs1922】骑士共存问题——网络流
    【bzoj1855||hdu3401】股票交易——单调队列优化dp
    【bzoj2002】弹飞绵羊——分块
    【bzoj3790】神奇项链——manacher+贪心
    【hdu2149】Public Sale
    【hdu1846】Brave Game
    【hdu3294】Girls' research——manacher
    【hdu3068】最长回文——manacher算法
    [BZOJ] 1634: [Usaco2007 Jan]Protecting the Flowers 护花
    [BZOJ] 1651: [Usaco2006 Feb]Stall Reservations 专用牛棚
  • 原文地址:https://www.cnblogs.com/tomatoes-/p/10916368.html
Copyright © 2011-2022 走看看