Solr 安装配置二:Centos6 安装和配置zookeeper集群

1、解压zookeeper

[root@localhost soft]# ls
jdk1.7.0_80  jdk-7u80-linux-i586.tar.gz  zookeeper-3.4.11  zookeeper-3.4.11.tar.gz
[root@localhost soft]# tar -zxvf zookeeper-3.4.11.tar.gz 

2、将zookeeper拷贝到/usr/zookeeper目录下,复制三份

[root@localhost soft]# cp -r ./zookeeper-3.4.11 /usr/zookeeper/zookeeper1
[root@localhost soft]# cp -r ./zookeeper-3.4.11 /usr/zookeeper/zookeeper2
[root@localhost soft]# cp -r ./zookeeper-3.4.11 /usr/zookeeper/zookeeper3

3、目录结构:

[root@localhost zookeeper]# pwd
/usr/zookeeper
[root@localhost zookeeper]# ls
zookeeper1  zookeeper2  zookeeper3
[root@localhost zookeeper]# 

4、新建data文件夹,再在data文件夹下创建文件myid,内容为1

[root@localhost data]# pwd
/usr/zookeeper/zookeeper1/data
[root@localhost data]# ls
myid  version-2  zookeeper_server.pid
[root@localhost data]# 

zookeeper1下的myid为1,zookeeper2下的myid为2,zookeeper3下的myid为3

[root@localhost data]# echo 1 >myid
[root@localhost data]# cat myid
1
[root@localhost data]# 

5、修改conf 文件夹下zoo_sample.cfg文件名为 zoo.cfg,修改其中的内容:

zookeeper1:

        dataDir=/usr/zookeeper/zookeeper1/data

        clientPort=2181

        server.1=192.168.178.128:2881:3881
        server.2=192.168.178.128:2882:3882

        server.3=192.168.178.128:2883:3883

zookeeper2:

        dataDir=/usr/zookeeper/zookeeper2/data

        clientPort=2182

        server.1=192.168.178.128:2881:3881
        server.2=192.168.178.128:2882:3882

        server.3=192.168.178.128:2883:3883

zookeeper3:

        dataDir=/usr/zookeeper/zookeeper3/data

        clientPort=2183

        server.1=192.168.178.128:2881:3881
        server.2=192.168.178.128:2882:3882
        server.3=192.168.178.128:2883:3883

[root@localhost conf]# pwd
/usr/zookeeper/zookeeper1/conf
[root@localhost conf]# ls
configuration.xsl  log4j.properties  zoo.cfg
[root@localhost conf]# 
[root@localhost conf]# cat 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/zookeeper/zookeeper1/data
# the port at which the clients will connect
clientPort=2181
# 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
#主从服务器及端口配置
server.1=192.168.178.128:2881:3881
server.2=192.168.178.128:2882:3882
server.3=192.168.178.128:2883:3883
[root@localhost conf]# 

6、启动zookeeper

[root@localhost bin]# /usr/zookeeper/zookeeper1/bin/zkServer.sh start
[root@localhost bin]# /usr/zookeeper/zookeeper2/bin/zkServer.sh start
[root@localhost bin]# /usr/zookeeper/zookeeper3/bin/zkServer.sh start

7、查看zookeeper状态

[root@localhost bin]#  /usr/zookeeper/zookeeper1/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper/zookeeper1/bin/../conf/zoo.cfg
Mode: follower
[root@localhost bin]#  /usr/zookeeper/zookeeper2/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper/zookeeper2/bin/../conf/zoo.cfg
Mode: follower
[root@localhost bin]#  /usr/zookeeper/zookeeper3/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper/zookeeper3/bin/../conf/zoo.cfg
Mode: leader
[root@localhost bin]# 

8、需要开启对应的端口或者把服务器的防火墙关掉,关掉防火墙命令:

[root@localhost bin]# service iptables stop
[root@localhost bin]# 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值