侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

zookeeper的安装和配置

2023-12-13 星期三 / 0 评论 / 0 点赞 / 93 阅读 / 2170 字

1、三个节点执行:rpm -ivh zookeeper-3.4.6-redhat6.4.x86_64.rpm 2、find / -name zoo.cfg vim /etc/zookeeper/c

1、三个节点执行:rpm -ivh zookeeper-3.4.6-redhat6.4.x86_64.rpm 
2、find / -name zoo.cfg

     vim /etc/zookeeper/conf/zoo.cfg

配置内容如下:

maxClientCnxns=50
# 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.
dataDir=/var/lib/zookeeper/data                   
dataLogDir=/var/lib/zookeeper/dataLogDir            //检查是否存在目录,若不存在,要在系统中创建这两个目录

# the port at which the clients will connect
clientPort=2181

autopurge.purgeInterval=3
autopurge.SnapRetainCount=3

server.1=192.168.232.100:2888:3888
server.2=192.168.232.101:2888:3888
server.3=192.168.232.102:2888:3888

3、把zoo.cfg配置文件拷贝到另外两个节点

scp /etc/zookeeper/conf/zoo.cfg [email protected]:/etc/zookeeper/conf/

scp /etc/zookeeper/conf/zoo.cfg [email protected]:/etc/zookeeper/conf/

4、如2中说明,在三个节点上创建相应的目录

mkdir -p /var/lib/zookeeper/data

mkdir -p /var/lib/zookeeper/dataLogDir

5、在三台机器上的dataDir指定的目录下创建myid文件,其内容分别为zoo.cfg文件中的server.x的x(例如server.1=192.168.232.100:2888:3888,其对应的myid内容为1)

6、vim /etc/zookeeper/conf/Java.env 内容如下:

 # zk buffer size 64M
export JVMFLAGS="-Djute.maxbuffer=0x3FFFFC0 $JVMFLAGS"

# Java heap size 1GB 
export JVMFLAGS="-Xms1g -Xmx1g $JVMFLAGS"       //该项设置为1g,根据自己机器的内存情况来设置,太大会导致zkServer.sh脚本启动失败

7、启动zookeeper

./zkServer.sh start

./zkServer.sh status

广告 广告

评论区