JEESZ-Zookeeper集群安装

本文涉及的产品
注册配置 MSE Nacos/ZooKeeper,118元/月
云原生网关 MSE Higress,422元/月
服务治理 MSE Sentinel/OpenSergo,Agent数量 不受限
简介:
  1. 在根目录创建zookeeper文件夹(service1、service2、service3都创建)

[root@localhost /]# mkdir zookeeper

通过Xshell上传文件到service1服务器:上传zookeeper-3.4.6.tar.gz到/software文件夹

2.远程copy将service1下的/software/zookeeper-3.4.6.tar.gz到service2、service3

[root@localhost software]# scp -r /software/zookeeper-3.4.6.tar.gz root@192.168.2.212:/software/

[root@localhost software]# scp -r /software/zookeeper-3.4.6.tar.gz root@192.168.2.213:/software/

3.copy /software/zookeeper-3.4.6.tar.gz到/zookeeper/目录(service1、service2、service3都执行)

[root@localhost software]# cp /software/zookeeper-3.4.6.tar.gz /zookeeper/

4.安装解压zookeeper-3.4.6.tar.gz(service1、service2、service3都执行)

[root@localhost /]# cd /zookeeper/

[root@localhost zookeeper]# tar -zxvf zookeeper-3.4.6.tar.gz

5.在/zookeeper创建两个目录:zkdata、zkdatalog(service1、service2、service3都创建)

[root@localhost zookeeper]# mkdir zkdata

[root@localhost zookeeper]# mkdir zkdatalog

6.进入/zookeeper/zookeeper-3.4.6/conf/目录

[root@localhost zookeeper]# cd /zookeeper/zookeeper-3.4.6/conf/

[root@localhost conf]# ls

configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg

  1. 修改zoo.cfg文件

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=/zookeeper/zkdata

dataLogDir=/zookeeper/zkdatalog

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.

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

server.1=192.168.2.211:12888:13888

server.2=192.168.2.212:12888:13888

server.3=192.168.2.213:12888:13888

  1. 同步修改service2、service3的zoo.cfg配置
  2. myid文件写入(进入/zookeeper/zkdata目录下)

[root@localhost /]# cd /zookeeper/zkdata

[root@localhost /]# echo 1 > myid

  1. myid文件写入service2、service3

echo 2 > myid

echo 3 > myid

11.查看zk命令:

[root@localhost ~]# cd /zookeeper/zookeeper-3.4.6/bin/

[root@localhost bin]# ls

README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer.sh zookeeper.out

12.执行zkServer.sh查看详细命令:

[root@localhost bin]# ./zkServer.sh

JMX enabled by default

Using config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg

Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}

  1. 在service1、service2、service3分别启动zk服务

[root@localhost bin]# ./zkServer.sh start

  1. jps查看zk进程

[root@localhost bin]# jps

31483 QuorumPeerMain

31664 Jps

  1. 分别在service1、service2、service3查看zk状态(可以看到leader和follower节点)

[root@localhost bin]# ./zkServer.sh status

JMX enabled by default

Using config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg

Mode: follower

[root@localhost bin]# ./zkServer.sh status

JMX enabled by default

Using config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg

Mode: leader

  1. 看到leader和follower节点已经安装成功。
相关实践学习
基于MSE实现微服务的全链路灰度
通过本场景的实验操作,您将了解并实现在线业务的微服务全链路灰度能力。
目录
相关文章
|
7月前
|
存储 Java Linux
【Zookeeper】基于3台linux虚拟机搭建zookeeper集群(二)
【Zookeeper】基于3台linux虚拟机搭建zookeeper集群
344 1
【Zookeeper】基于3台linux虚拟机搭建zookeeper集群(二)
|
4月前
|
开发工具
部署安装zookeeper集群
部署安装zookeeper集群
|
7月前
|
网络协议 Linux 数据安全/隐私保护
【Zookeeper】基于3台linux虚拟机搭建zookeeper集群(一)
【Zookeeper】基于3台linux虚拟机搭建zookeeper集群
350 1
【Zookeeper】基于3台linux虚拟机搭建zookeeper集群(一)
|
7月前
|
存储 Java 网络安全
ZooKeeper【部署 02】apache-zookeeper-3.6.0 集群版(准备+安装配置+启动验证)
ZooKeeper【部署 02】apache-zookeeper-3.6.0 集群版(准备+安装配置+启动验证)
227 0
|
Dubbo 应用服务中间件
Dubbo的Zookeeper单机配置和Zookeeper集群配置
Zookeeper单机配置: 方式一、 <dubbo:registry address="zookeeper://10.20.153.10:2181"/> 方式二、 <dubbo:registry protocol="zookeeper" address="10.
9945 0
|
分布式计算 Java Hadoop
zookeeper的安装与部署
zookeeper的安装与部署
|
云安全 Oracle Java
阿里云上部署zookeeper
阿里云上部署zookeeper
阿里云上部署zookeeper
|
分布式计算 Hadoop 分布式数据库
ZooKeeper完全分布式安装与配置
Zookeeper是一个很好的集群管理工具,被大量用于分布式计算。如Hadoop以及Storm系统中。这里简单记录下Zookeeper集群环境的搭建过程。本文以Centos6.5作为操作系统环境。
9055 0
|
存储 分布式计算 监控
分布式服务框架 Zookeeper安装和配置详解
本文介绍的 Zookeeper 是以 3.5.2 版本为基础,最新的版本可以通过官网 http://hadoop.apache.org/zookeeper/获取 下面将从单机模式和集群模式两个方面介绍 Zookeeper 的安装和配置 ...
1192 0