第一部分 zookeeper环境
环境:3台机器
192.168.109.132-134
centos7.2
1 linux环境设置
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
#关闭SELINUX
sed -i's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
setenforce 0
#设置时间
timedatectl set-ntp no
timedatectl set-timezone Asia/Shanghai
#手动设置为当前时间
timedatectl set-time "2017-10-1713:52:16"
timedatectl set-local-rtc 1
timedatectl set-ntp yes
2 安装配置zookeeper
#安装/root/zookeeper-3.4.10.tar.gz
cd /usr/local
tar zxvf /root/zookeeper-3.4.10.tar.gz
mv zookeeper-3.4.10 zookeeper
cd zookeeper
mkdir -p data log
cd conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
# The number of milliseconds of each tick
# 心跳检查的时间 2秒
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
# 初始化时 连接到服务器端的间隔次数,总时间10*2=20秒
initLimit=10
# The number of ticks that can pass between
# sending a request and getting anacknowledgement
# ZK Leader 和follower 之间通讯的次数,总时间5*2=10秒
syncLimit=5
# the directory where the snapshot isstored.
# do not use /tmp for storage, /tmp here isjust
# example sakes.
# 存储内存中数据库快照的位置,如果不设置参数,更新事务日志将被存储到默认位置/tmp
dataDir=/usr/local/zookeeper/data
# 错误日志的存放位置
dataLogDir=/usr/local/zookeeper/log
# the port at which the clients willconnect
clientPort=2181
server.1=192.168.109.132:2888:3888
server.2=192.168.109.133:2888:3888
server.3=192.168.109.134:2888:3888