多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# zookeeper和Kafka集群部署 **# zookeeper配置** 在官方下载二进制包 ``` kafka+zookeeper集群安装 三个节点安装 [root@localhost ~]# rpm –ivh jre-8u171-linux-x64.rpm [root@localhost ~]# curl –L http://www-us.apache.org/dist/zookeeper/stable/zookeeper-3.4.12.tar.gz -o /usr/local/zookeeper 修改三台zoo.cfg配置文件如下 [root@localhost ~]# cat /usr/local/zookeeper/conf/zoo.cfg tickTime=2000 initLimit=5 syncLimit=2 dataDir=/data/zookeeper/data dataLogDir=/data/zookeeper/log clientPort=2181 server.1= 192.168.11.223:2888:3888 server.2= 192.168.11.224:2888:3888 server.3= 192.168.11.225:2888:3888 创建数据目录和日志目录 [root@localhost ~]# mkdir –p /data/zookeeper/{data,log} 三台分别echo “1” >> /data/zookeeper/data/myid如下 echo “2” >> /data/zookeeper/data/myid echo “3” >> /data/zookeeper/data/myid 启动zk服务 [root@localhost ~]#./zkServer.sh start ``` **# Kafka配置** ``` 下载kafka软件包 [root@localhost ~]# wget https://www.apache.org/dyn/closer.cgi?path=/kafka/1.1.0/kafka_2.11-1.1.0.tgz [root@localhost ~]# tar xf kafka_2.11-1.1.0.tgz –C /usr/local/ 修改三台kafka配置文件如下 [root@localhost ~]# vim /usr/local/kafka/config/server.properties broker.id=1 listeners=PLAINTEXT://192.168.11.223:9092 zookeeper.connect=192.168.11.223:2181,192.168.11.224:2181,192.168.11.225:2181 broker.id=2 listeners=PLAINTEXT://192.168.11.224:9092 zookeeper.connect=192.168.11.223:2181,192.168.11.224:2181,192.168.11.225:2181 broker.id=3 listeners=PLAINTEXT://192.168.11.225:9092 zookeeper.connect=192.168.11.223:2181,192.168.11.224:2181,192.168.11.225:2181 启动kafka服务 [root@localhost ~]# nohup ./bin/kafka-server-start.sh config/server.properties & ```