博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zookeeper自动化安装配置脚本
阅读量:7044 次
发布时间:2019-06-28

本文共 2947 字,大约阅读时间需要 9 分钟。

hot3.png

#!/bin/bash

#/usr/local/zookeeper1/bin/zkServer.sh start 

#/usr/local/zookeeper2/bin/zkServer.sh start 
#/usr/local/zookeeper3/bin/zkServer.sh start

setup_dir="/usr/local/"

zooVersion="zookeeper-3.4.8"

cd $setup_dir

wget http://apache.fayea.com/zookeeper/${zooVersion}/${zooVersion}.tar.gz || wwwget http://apache.fayea.com/zookeeper/${zooVersion}/${zooVersion}.tar.gz
tar zxvf ${zooVersion}.tar.gz
mkdir -p ${zooVersion}/data

cp -a ${zooVersion}  zookeeper1

cp -a ${zooVersion}  zookeeper2
cp -a ${zooVersion}  zookeeper3

z1="${setup_dir}zookeeper1/"

z2="${setup_dir}zookeeper2/"
z3="${setup_dir}zookeeper3/"

#########################################################################

cat >>${z1}conf/zoo.cfg << eof

# 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.
# example sakes.
dataDir=${z1}data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
#autopurge.purgeInterval=1
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
eof

##########################################################################

cat >>${z2}conf/zoo.cfg << eof
# 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.
# example sakes.
dataDir=${z2}data
# the port at which the clients will connect
clientPort=2182
# the maximum number of client connections.
#autopurge.purgeInterval=1
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
eof
##########################################################################

cat >>${z3}conf/zoo.cfg << eof

# 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.
# example sakes.
dataDir=${z3}data
# the port at which the clients will connect
clientPort=2183
# the maximum number of client connections.
#autopurge.purgeInterval=1
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
eof

# dataDir新建myid文件写入数字表示这是第几号server. 该数字必须和zoo.cfg文件中的server.X中的X对应

echo 1 >${z1}data/myid
echo 2 >${z2}data/myid
echo 3 >${z3}data/myid

echo "# Zookeeper" >>/etc/rc.local

echo "${z1}bin/zkServer.sh start" >>/etc/rc.local
echo "${z2}bin/zkServer.sh start" >>/etc/rc.local
echo "${z3}bin/zkServer.sh start" >>/etc/rc.local
 

转载于:https://my.oschina.net/gonglibin/blog/841779

你可能感兴趣的文章
【Android】定时任务
查看>>
Swift学习(类与结构 引用与数值)
查看>>
使用这个工具来检查classLoader的问题
查看>>
Nginx 结合Python Ldap认证用于Kibana权限登陆
查看>>
mysql概述和体系结构
查看>>
[转载] 创建更好jQuery插件的10个建议
查看>>
jsp语法
查看>>
轻松拥有个性化Windows安装光盘
查看>>
MongoDB应用记录
查看>>
Windows AppContainer 降权,隔离与安全
查看>>
SqlServer 异常报逻辑 I/O 错误和无法NOLOCK方式扫描
查看>>
Mysql的主从复制和级联
查看>>
django web指定中文字符集
查看>>
Thinkphp3.2.3 No input file specified 的解决方法
查看>>
LAMP×××
查看>>
动态加载jar并执行其内方法
查看>>
51CTO博主喜获阿里云开发者大赛二等奖
查看>>
445利用方法
查看>>
centos下lamp源码安装
查看>>
SAX解析XML文件
查看>>