# 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=/opt/software/zookeeper357/mydata
server.1=singlefangliang:2888:3888
# 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
2 ~/installsheel/zookeepersixthinstall.sh
#!/bin/bash#注意事项 #1/opt/download中有apache-zookeeper-3.5.7-bin.tar.gz#提前写好配置文件 /opt/download/zookeeper/zoo.cfg
source /etc/profile
ENV_DIR='/etc/profile.d/'
SOFTWARE_DIR='/opt/software/'
DOWNLOAD_DIR='/opt/download/'
ZOOKEEPER_ENV='#zookeeper;export-ZOOKEEPER_HOME=/opt/software/zookeeper357;export-PATH=$ZOOKEEPER_HOME/bin:$PATH'#删除myenv.sh 文件中的配置内容function removeIfExists(){if[ $# -lt 2 ]
then
echo'参数给的太少'
fi
sed -rin "/^#.*?$1/,+$2d"$ENV_DIR'myenv.sh'}function addEnv(){DIR="$1"DIR=${DIR//;/}for item in $DIRdo
sed -in'$a'$item$ENV_DIR'myenv.sh'
done
sed -in's/-/ /g'$ENV_DIR'myenv.sh'echo'myenv.sh添加zookeeper配置文件信息'}
RST=`ls$SOFTWARE_DIR|grep zookeeper`
if[[-z $RST]]
then
echo'原机未安装zookeeper'
tar -zxf $DOWNLOAD_DIR'apache-zookeeper-3.5.7-bin.tar.gz'-C $SOFTWARE_DIRmv/opt/software/apache-zookeeper-3.5.7-bin /opt/software/zookeeper357
echo'安装完毕'elserm-rf $SOFTWARE_DIR'zookeeper357'echo'原机安装过hive'
tar -zxf $DOWNLOAD_DIR'apache-zookeeper-3.5.7-bin.tar.gz'-C $SOFTWARE_DIRecho$SOFTWARE_DIR'--------------------------------------------'mv/opt/software/apache-zookeeper-3.5.7-bin /opt/software/zookeeper357
echo'删除原hive 重新安装成功'
fi
RST=`ls$ENV_DIR|grep myenv.sh`
if[[-z $RST]]
then
touch $ENV_DIR'myenv.sh'echo'原myenv.sh配置文件不存在,新建完成'elseecho'原机存在myenv.sh配置文件'
removeIfExists zookeeper 2
echo'原机myenv.sh中的zookeeper配置文件信息已删除'
fi
addEnv $ZOOKEEPER_ENV
mkdir /opt/software/zookeeper357/mydata
touch /opt/software/zookeeper357/mydata/myid
echo'1'>/opt/software/zookeeper357/mydata/myid
echo'添加文件/opt/software/zookeeper357/mydata/myid中内容写1'mv/opt/software/zookeeper357/conf/zoo_sample.cfg /opt/software/zookeeper357/conf/zoo.cfg
cat/opt/download/zookeeperinstall/zoo.cfg>/opt/software/zookeeper357/conf/zoo.cfg
cp/opt/software/zookeeper357/conf/zoo.cfg /opt/software/zookeeper357/
source /etc/profile```
/opt/download/zookeeperinstall/zoo.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and gettin