标签:kafka 查看 start 安装 创建 ref apach src apache
安装思路及环境:先安装Java环境,再安装zookeeper,后安装kafka,:安装思路及环境:先安装Java环境,再安装zookeeper,后安装kafka,
zookeeper版本下载网址: http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
http://zookeeper.apache.org/doc/current/zookeeperStarted.html中有:
server.1=172.18.9.203:2888:3888 server.2=172.18.9.204:2888:3888 server.3=172.18.9.205:2888:3888
制作zookeeper集群需三台服务器:172.18.9.203,172.18.9.204,172.18.9.205
三台服务器分别配置hosts文件:
#cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.18.9.203 linux-host1.exmaple.com
172.18.9.204 linux-host2.exmaple.com
172.18.9.205 linux-host3.exmaple.com
[root@203/204/205 src]#tar xf zookeeper-3.4.14.tar.gz
[root@203/204/205 src]#cd zookeeper-3.4.14/conf
[root@203/204/205 conf]#ll
total 12
-rw-rw-r--. 1 2002 2002 535 Mar 7 00:50 configuration.xsl
-rw-rw-r--. 1 2002 2002 2161 Mar 7 00:50 log4j.properties
-rw-rw-r--. 1 2002 2002 922 Mar 7 00:50 zoo_sample.cfg
[root@203/204/205 conf]#cp zoo_sample.cfg zoo.cfg #把模板cp成配置文件
[root@203/204/205 conf]#vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper/data
clientPort=2181
maxClientCnxns=4096
server.1=172.18.9.203:2888:3888
server.2=172.18.9.204:2888:3888
server.3=172.18.9.205:2888:3888
[root@203/204/205 conf]#mkdir /usr/local/zookeeper/data
[root@203/204/205 conf]#ln -s /usr/local/src/zookeeper-3.4.14 /usr/local/zookeeper
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@205 conf]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
出现此错的原因是zookeeper的pid没有生成!
[root@203/204/205 zookeeper-3.4.14]#echo 1 2 3 > /usr/local/zookeeper/data/myid
[root@203/204/205 zookeeper-3.4.14]#
[root@203/204/205 zookeeper-3.4.14]#/usr/local/zookeeper/bin/zkServer.sh start
[root@203/204/205 zookeeper-3.4.14]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 :::2181 :::*
[root@203 zookeeper-3.4.14]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[root@204 conf]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[root@205 conf]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[root@203/204/205 zookeeper-3.4.14]#vim /etc/rc.d/rc.local
/usr/local/zookeeper/bin/zkServer.sh start
此时,zookeeper已完成安装,它没有账号认证,任何普户都能用!
标签:kafka 查看 start 安装 创建 ref apach src apache
原文地址:https://blog.51cto.com/14128387/2385777