zookeeper
安装命令
yum install zookeeper -y (版本:zookeeper.x86_64 3.4.6-1)
yum install zookeeper-lib -y
(版本:zookeeper-lib.x86_64 3.4.6-1)
配置文件:/etc/zookeeper/zoo.cfg
作如下修改:
maxClientCnxns=50
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/lib/zookeeper/data //保证目录存在,否则启动出错。
dataLogDir=/var/lib/zookeeper/dateLogDir
clientPort=2181
autopurge.purgeInterval=3
autopurge.SnapRetainCount=3
server.1=节点1存储网IP:2888:3888 //1,2,3对于在myid中写入
server.2=节点2存储网IP:2888:3888
server.3=节点3存储网IP :2888:3888
java环境变量:vim /etc/zookeeper /java.env
作如下修改:
# zk buffer size 64M
export JVMFLAGS="-Djute.maxbuffer=0x3FFFFC0 $JVMFLAGS"
# java heap size 16GB
export JVMFLAGS="-Xms16g -Xmx16g $JVMFLAGS" //注意两个16G要改
注:设置为内存的1/4,测试域设置为16G
java环境变量设置:/etc/zookeeper/zookeeper-env.sh
做如下修改:
export JAVA_HOME=/usr
myid文件:创建 vim /var/lib/zookeeper/data/myid
内容如下:
根据/etc/zookeeper/zoo.cfg中server.X设置,一般值为1或者2或者3。
设置dateLogDir:创建 mkdir /var/lib/zookeeper/dateLogDir
#现行方案中,单独挂载一个SATA硬盘。(部署环境中选择zk节点上的/dev/sdl)
#mkfs.ext4 -T largefile /dev/*** (选择一块独立磁盘)
#mkdir /var/lib/zookeeper/dateLogDir
#mount /dev/*** /var/lib/zookeeper/dateLogDir
#blkid /dev/*** 获取UUID
#设置/etc/fstab,用vim /etc/fstab在最后添加如下行
#UUID=046498f8-a077-40b9-af84-7f8e9eed9afd /var/lib/zookeeper/dateLogDir ext4 defaults 0 0
配置启动脚本:/etc/init.d/zookeeper
注释掉:#source /etc/rc.d/init.d/functions
修改#daemon -user zookeeper zkServer.sh start为zkServer.sh start
修改#daemon -user zookeeper zkServer.sh stop为zkServer.sh stop
修改
checkstatus() {
status –p $PIDFILE ${JAVA_HOME} /bin/java
RETVAL=$?
}
为
status() {
zkServer.sh status
RETVAL=$?
return $RETVAL
}
并修改service status的函数入口:
status)
status
;;
检查zk状态命令
# service zookeeper start
# service zookeeper status
# yum install nmap-ncat -y
#echo stat|nc localhost 2181
sheepdog
安装缺失包
yum install automake.noarch -y (版本:automake.noarch 1.13.4-3.el7)
yum install libtool -y (版本:libtool.x86_64 2.4.2-21.el7_2)
yum install userspace-rcu -y (版本:userspace-rcu.x86_64 0.7.9-1.el7)
yum install userspace-rcu-devel -y (版本:userspace-rcu-devel.x86_64 0.7.9-1.el7)
yum install yasm -y (版本:yasm.x86_64 1.2.0-4.el7)
将sheepdog的压缩包拷贝到任意目录下解压,编译命令
cd sheepdog
./autogen.sh
./configure --enable-zookeeper --disable-corosync
make
make install
配置pc_san_conf.ini
groupadd ebsadmin
useradd -g ebsadmin ebsadmin
mkdir /home/ebsadmin/serNode
chown ebsadmin:ebsadmin serNode -R
vim serNode/pc_san_conf.ini
注:看挂载了几个盘,根据挂载的盘,来写下面的文件
文件内容如下:
[RAID]
storage.path =/shd/meta,/shd/obj1,/shd/obj2,/shd/obj3,/shd/obj4,/shd/obj5,/shd/obj6,/shd/obj7,/shd/obj8,/shd/obj9,/shd/obj10,/shd/obj11,/shd/obj12
level =0
[SHEEPDOG]
shdcmds =/shd/meta,/shd/obj1,/shd/obj2,/shd/obj3,/shd/obj4,/shd/obj5,/shd/obj6,/shd/obj7,/shd/obj8,/shd/obj9,/shd/obj10,/shd/obj11,/shd/obj12 -p 7000-c zookeeper:172.18.12.144:2181,172.18.12.53:2181,172.18.12.17:2181-ldir=/var/log -z 1-i host=172.18.12.5,port=7001-y 172.16.172.5--nosync
启动配置/home/ebsadmin/serNode/sheepdog
创建sheepdog文件:[root@lrr2 serNode]# touch sheepdog
文件内容如下:
ulimit -n 409600
cmds=`grep "shdcmds"/home/ebsadmin/serNode/pc_san_conf.ini`&& SHEEP_OPTS=${cmds#shdcmds =}
/usr/sbin/sheep --pidfile /var/run/sheep.pid $(if[-z "$SHEEP_OPTS"]; then echo "--cluster local --log dst=syslog --upgrade /var/lib/sheepdog";else echo $SHEEP_OPTS; fi)
修改文件权限chmod +x /home/ebsadmin/serNode/sheepdog
启动配置/usr/lib/systemd/system/sheepdog.service
文件内容如下:
[Unit]
Description=Sheepdog QEMU/KVM BlockStorage
After=network.target
Wants=syslog.target
[Service]
EnvironmentFile=-/etc/conf.d/sheepdog.conf
EnvironmentFile=-/etc/sysconfig/sheepdog
EnvironmentFile=-/etc/default/sheepdog
ExecStart=/bin/sh -c '/home/ebsadmin/serNode/sheepdog'
PIDFile=/var/run/sheep.pid
Type=forking
Restart=on-abort
StartLimitInterval=10s
StartLimitBurst=3
[Install]
WantedBy=multi-user.target
验证sheepdog是否安装成功
[root@lrr2 /]# type sheep
#service sheepdog start
#systemctl status sheepdog.servic
验证功能好使
遇到的问题:
1、配置pc_san_conf.ini时填写的路径不对,以为是填写盘符,按如上填写即可,注意创建shd目录。
2.、因为之前安装过sheepdog,导致sheep和dog的版本不一致,删除/usr/bin和/usr/sbin/下的dog,然后重新编译。