zookeeper同一台服务器创建伪集群
下载zk
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.7.0/apache-zookeeper-3.7.0-bin.tar.gz
解压
tar -zxvf apache-zookeeper-3.7.0-bin.tar.gz
copy配置成3份
# 进入zk的conf目录
cd conf
# copy1
cp zoo.cfg zoo1.cfg
# copy2
cp zoo.cfg zoo2.cfg
# copy3
cp zoo.cfg zoo3.cfg
zoo1.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=/usr/local/zk/zookeeper/data/zk1
dataLogDir=/usr/local/zk/zookeeper/log/log1
# the port at which the clients will connect
#客户端连接 zk 服务器的端口,zk 监听这个端口,接受客户端请求
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
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
quorumListenOnAllIPs=true
server.1=47.103.72.160:2887:3887
server.2=47.103.72.160:2888:3888
server.3=47.103.72.160:2889:3889
#server.a=b:c:d , a:表示第几号服务器,b:服务器的ip地址,
#c:集群中与 leader 交换信息的端口,d:当 leader 服务器挂了,通过这个端口来重新选举 leader
#因为是在同一台机器上搭建的伪集群,所有 c,d 都不能一样
zoo2.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=/usr/local/zk/zookeeper/data/zk2
dataLogDir=/usr/local/zk/zookeeper/log/log2
# the port at which the clients will connect
clientPort=2182
# 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
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
quorumListenOnAllIPs=true
server.1=47.103.72.160:2887:3887
server.2=47.103.72.160:2888:3888
server.3=47.103.72.160:2889:3889
zoo3.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=/usr/local/zk/zookeeper/data/zk3
dataLogDir=/usr/local/zk/zookeeper/log/log3
# the port at which the clients will connect
clientPort=2183
# 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
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
quorumListenOnAllIPs=true
server.1=47.103.72.160:2887:3887
server.2=47.103.72.160:2888:3888
server.3=47.103.72.160:2889:3889
修改clientPort属性 (客户端连接 zk 服务器的端口,zk 监听这个端口,接受客户端请求)
修改dataDir属性(数据保存地址)
修改dataLogDir属性(日志保存地址)
server.n (集群地址,n 是dataDir目录下的myid文件中内容,用来标记该服务器在集群中的地址)
日志路径创建3份
# 进入log
cd log
# 创建zk1日志目录
mkdir log1
# 创建zk2日志目录
mkdir log2
# 创建zk3日志目录
mkdir log4
数据路径创建3份
# 进入data
cd data
# 创建zk1保存数据目录
mkdir zk1
cd zk1
vim myid
输入:1
保存退出
# 创建zk2保存数据目录
mkdir zk2
cd zk2
vim myid
输入:2
保存退出
# 创建zk3保存数据目录
mkdir zk3
cd zk3
vim myid
输入:3
保存退出
zk命令
cd bin
# 启动
sh zkServer.sh start zoo1.cfg
sh zkServer.sh start zoo2.cfg
sh zkServer.sh start zoo3.cfg
# 状态
sh zkServer.sh status zoo1.cfg
sh zkServer.sh status zoo2.cfg
sh zkServer.sh status zoo3.cfg
# 关闭
sh zkServer.sh stop zoo1.cfg
sh zkServer.sh stop zoo2.cfg
sh zkServer.sh stop zoo3.cfg
zookeeper同一台服务器创建伪集群的更多相关文章
- zookeeper的单实例和伪集群部署
原文链接: http://gudaoyufu.com/?p=1395 zookeeper工作方式 ZooKeeper 是一个开源的分布式协调服务,由雅虎创建,是 Google Chubby 的开源实现 ...
- 俩台服务器搭建redis集群5.0.4
俩台服务器搭建redis集群 1.俩服务器分别新建目录:usr/local/redis-cluster 2.下载源码并解压编译(使用redis版本5.0.4) 3.tar xzf redis-5.0. ...
- zookeeper在windows下的伪集群模式
参考:zookeeper在windows下的伪集群模式 踩到的坑: 注意windows下路径需要使用\ dataDir=D:\Program Files\Java\zookeeper-3.4.10-c ...
- zookeeper安装和配置(单机+伪集群+集群)
#单机模式 解压到合适目录. 进入zookeeper目录下的conf子目录, 复制zoo_sample.cfg-->zoo.cfg(如果没有data和logs就新建):tickTime=2000 ...
- zookeeper的安装与部署-伪集群
1.Zookeeper的下载与解压 通过后面的链接下载Zookeeper: Zookeeper下载在此我们下载zookeeper-3.4.5下载后解压至安装目录下,本文我们解压到目录:/ ...
- 【实验级】Docker-Compose搭建单服务器ELK伪集群
本文说明 由于最近在搭ELK的日志系统,为了演示方案搭了个单台服务器的日志系统,就是前一篇文章中所记,其实这些笔记已经整理好久了,一直在解决各种问题就没有发出来.在演示过程中我提到了两个方案,其中之一 ...
- ZooKeeper(3.4.5) - 配置伪集群模式
1. 准备 Java 运行环境,需要安装 Java1.6 或更高版本的 JDK. 2. 下载 ZooKeeper 的稳定版本 zookeeper-x.x.x.tar.gz,将其解压,约定目录名称为 % ...
- 将 master 节点服务器从 k8s 集群中移除并重新加入
背景 1 台 master 加入集群后发现忘了修改主机名,而在 k8s 集群中修改节点主机名非常麻烦,不如将 master 退出集群改名并重新加入集群(前提是用的是高可用集群). 操作步骤 ssh 登 ...
- 伪集群zookeeper模式下codis的部署安装
1,zookeeper伪集群部署 部署在192.168.0.210服务器上 下载 去官网将3.4.6版本的zookeeper下载下来到/app目录下解压 首先 ...
随机推荐
- 深入理解Java并发类——AQS
目录 什么是AQS 为什么需要AQS AQS的核心思想 AQS的内部数据和方法 如何利用AQS实现同步结构 ReentrantLock对AQS的利用 尝试获取锁 获取锁失败,排队竞争 参考 什么是AQ ...
- SpringBoot自动装配原理之Configuration以及@Bean注解的使用
Configuration以及Bean注解的使用 该知识点在Spring中应该学过,没有学过或者遗忘的的朋友需要预习或温习前置知识点.SpringBoot其实就是Spring的进一步简化,所以前置知识 ...
- Spring BeanFactory和现实工厂的对比
本文不分析Spring的源码流程,只是介绍一些基础的概念,在阅读源码之前,我们应该首先明确研究的对象是什么,才能有的放矢. Spring作为BeanFactory, 和现实工厂有着许多类似之处. 需要 ...
- SOA-面向服务的架构
一.什么是SOA? SOA 面向服务架构,是一个架构思想,是跨语言和平台的.SOA宗旨简单明了,根据项目服务完成架构搭建,以服务为基准点完成组件化和模块化.提供服务是项目的基本内容,其他的contro ...
- Java基础00-分支语句6
1. 流程控制 1.1 流程控制语句概述 1.2 流程控制语句分类 1.3 顺序结构 2. if语句 2.1 if语句格式1 适合一种情况的判断 执行流程图: 2.2 if语句格式2 适合两种情况的判 ...
- 新iPhone有望加入指纹解锁,你会买吗?
苹果新款iPhone即将在9月份正式发布,或命名为iPhone 13或者iPhone 12s.据外媒报道,新一代iPhone的屏幕和相机都将迎来重大升级,同时还将首次加入屏下指纹解锁技术.你期待吗? ...
- 动态 WebApi 引擎使用教程(3行代码完成动态 WebApi 构建)
目录 什么是 WebApiEngine? 开源地址 使用方法 使用 [ApiBind] 标签让任何方法变成 WebApi 对 API 进行分类 自定义 API 名称 复制特性 为整个类配置 WebAp ...
- 基于小熊派Hi3861鸿蒙开发的IoT物联网学习【三】
软件定时器:是基于系统Tick时钟中断且由软件来模拟的定时器,当经过设定的Tick时钟计数值后会触发用户定义的回调函数.定时精度与系统Tick时钟的周期有关. 定时器运行机制: cmsis_os2的A ...
- 第二章 Vant的v-cell的v-for使用
遍历加载list数据,类似el-table 一.问题描述 由于VantUI中没有类似于el-table的table组件,看官网的范例,只找到了cell组件有v-for
- SpringMVC 参数中接收之一 List
作者:张艳涛 time:2020-07-31 SpingMVC 一.前台传数组,SpingMVC用addusers(@RequestBody List<UserPojo> userlist ...