Zookeeper基础—Zookeeper安装与配制(Linux)
来源:互联网 发布:知乐小说猎情 编辑:程序博客网 时间:2024/06/05 17:55
一、前提准备
1、下载zookeeper
2、安装配置JDK
3、移入Linux环境建立相当目录
二、安装配置
1、解压Zookeeper
tar -xzvf zookeeper-3.4.8.tar.gz
2、修改配置文件
把conf目录下的zoo_sample.cfg
文件改成zoo.cfg
,并进行修改
# The number of milliseconds of each tick # 基本事件单元,这个时间是作为Zookeeper服务器之间或客户端与服务器之间维持心跳的时间间隔,# 每隔tickTime时间就会发送一个心跳;最小 的session过期时间为2倍tickTime tickTime=2000# The number of ticks that the initial # synchronization phase can take# 此配置表示,允许follower(相对于Leaderer言的“客户端”)连接并同步到Leader的初始化连接时间,以tickTime为单位。当初始化连接时间超过该值,则表示连接失败。initLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgement# 此配置项表示Leader与Follower之间发送消息时,请求和应答时间长度。如果follower在设置时间内不能与leader通信,那么此follower将会被丢弃。syncLimit=5# the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes.# dataDir=/tmp/zookeeper# 存储内存中数据库快照的位置,如果不设置参数,更新食物的日志将被存储到默认位置。dataDir=/public/software/Zookeeper/workspace/data# 这个操作让管理机器把事务日志写入“dataLogDir”所指定的目录中,而不是“dataDir”所指定的目录。这将允许使用一个专用的日志设备,帮助我们避免日志和快照的竞争。# 日志目录# 应该谨慎的选择日志存放的位置,使用专用的日志存储设备能够大大提高系统的性能,如果将日志存储在比较繁忙的存储设备上,那么将会很大程度上影像系统性能。dataLogDir=/public/software/Zookeeper/workspace/logserver.1=192.168.60.150:2888:3888 server.2=192.168.60.151:2888:3888 server.3=192.168.60.152:2888:3888# server.A=B:C:D:其中 A 是一个数字,表示这个是第几号服务器;# B 是这个服务器的 ip 地址;# C 表示的是这个服务器与集群中的 Leader 服务器交换信息的端口;# D 表示的是万一集群中的 Leader 服务器挂了,需要一个端口来重新进行选举,选出一个新的 Leader,# 而这个端口就是用来执行选举时服务器相互通信的端口。如果是伪集群的配置方式,# 由于 B 都是一样,所以不同的 Zookeeper 实例通信端口号不能一样,所以要给它们分配不同的端口号。# 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# 下面是对maxClientCnxns的解释# 这个操作将限制连接到Zookeeper的客户端数量,并限制并发连接的数量,通过IP来区分不同的客户端。此配置选项可以阻止某些类别的Dos攻击。将他设置为零或忽略不进行设置将会取消对并发连接的限制。#例如,此时我们将maxClientCnxns的值设为1,如下所示:# set maxClientCnxns# maxClientCnxns=1#启动Zookeeper之后,首先用一个客户端连接到Zookeeper服务器上。之后如果有第二个客户端尝试对Zookeeper进行连接,或者有某些隐式的对客户端的连接操作,将会触发Zookeeper的上述配置。#minSessionTimeout和maxSessionTimeout#即最小的会话超时和最大的会话超时时间。在默认情况下,minSession=2*tickTime;maxSession=20*tickTime。## 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
3、设置myid
在新建的data目录下建立myid
myid和zoo.cfg
除了修改 zoo.cfg 配置文件,集群模式下还要配置一个文件 myid,这个文件在 dataDir 目录下,这个文件里面就有一个数据就是 A 的值,Zookeeper 启动时会读取这个文件,拿到里面的数据与 zoo.cfg 里面的配置信息比较从而判断到底是那个 server。
4、设置环境变量
执行命令:vi /etc/profile
,添加 :export ZOOKEEPER_HOME=/usr/local/zookeeper
,添加完成后执行source /etc/profile
三、启动验证
启动Zookeeper进行查看(在Zookeeper的bin目录下启动)
./zkServer.sh start #启动Zookeeper./zkServer.sh stop #关闭Zookeeper./zkServer.sh status #查看Zookeeper状态
也可以输入jps
进行查年。
0 0
- Zookeeper基础—Zookeeper安装与配制(Linux)
- Zookeeper基础—Zookeeper安装与配制(Window版本)
- zookeeper安装(Linux)
- zookeeper安装与配置(Linux)
- linux安装zookeeper与dubbo
- zookeeper配制zoo.cfg
- Zookeeper基础—Zookeeper介绍
- zookeeper单节点与集群的安装(Linux)
- Linux下Zookeeper的(单机)安装与简单测试
- linux下zookeeper安装与测试
- linux下zookeeper安装与测试
- linux下zookeeper安装与测试
- Linux下 zookeeper 安装与配置
- Linux下zookeeper的安装与启动
- Zookeeper(二)ZooKeeper服务器的安装与启动
- zookeeper安装使用(linux)
- Linux安装zookeeper
- linux 安装dubbo+zookeeper
- xshell工具或Linux系统中运行jar文件
- 为新手准备的 Codea 着色器(Shader)教程
- 多态、包装类、抽象类
- Leetcode笔记—最大路径和
- IPC(四)_Aidl的基本使用过程
- Zookeeper基础—Zookeeper安装与配制(Linux)
- 【ssh-copy-id】
- bug:解决httpie测试出现 no module named _cursors
- 彭博士谈伤精与养精~ 中风的原因有哪些?|
- 1.1.3 Hadoop生态系统
- 查看Linux是32位还是64位
- 【ssh-keygen】生成、管理和转换认证密钥
- java 回调函数
- 彭鑫博士:黑芝麻补精粥