zookeeper3.4.9集群模式安装部署
来源:互联网 发布:数据库查重复数据 编辑:程序博客网 时间:2024/06/05 11:29
- 环境要求
- 下载解压
- 配置说明
- 复制 zoo_samplecfg 文件的并命名为为 zoocfg
- 修改配置文件zoocfg
- 配置项说明
- 配置环境变量
- 刷新环境变量
- 关闭系统防火墙或配置防火墙规则
- zookeeper命令
- 启动 zookeeper 服务
- 查看zookeeper 服务状态
- 关闭zookeeper服务
- 重启zookeeper服务
- zookeeper自启动服务
- 新建zookeeper脚本
- 给zookeeper脚本授可执行权限
- 添加开机自启动服务
- 查看自启动状态
环境要求
下载解压
按照上述提供的地址下载zookeeper后,使用命令tar -zxvf zookeeper-3.4.9.tar.gz进行解压后,可得到下图的文件目录结构
bin目录
zk的可执行脚本目录,包括zk服务进程,zk客户端,等脚本。其中,.sh是Linux环境下的脚本,.cmd是Windows环境下的脚本。
conf目录
配置文件目录。zoo_sample.cfg为样例配置文件,需要修改为自己的名称,一般为zoo.cfg。log4j.properties为日志配置文件。
contrib目录
一些用于操作zk的工具包。
recipes目录
zk某些用法的代码示例
配置说明
复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg
cp zoo_sample.cfg zoo.cfg
修改配置文件zoo.cfg
# The number of milliseconds of each ticktickTime=2000 # The number of ticks that the initial # synchronization phase can takeinitLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/data/ms/zookeeper-3.4.9/datadataLogDir=/data/ms/zookeeper-3.4.9/logs # the port at which the clients will connectclientPort=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=1server.1=zk149:2888:3888server.2=zk150:2888:3888server.3=zk151:2888:3888
配置项说明
配置环境变量
vim /etc/profile
并在其尾部追加如下内容:
ZOOKEEPER_HOME=/data/ms/zookeeper-3.4.9JAVA_HOME=/data/java/jdk1.8.0_111JRE_HOME=/data/java/jdk1.8.0_111/jreCLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHPATH=$JAVA_HOME/bin:$JRE_HOME/bin:$ZOOKEEPER_HOME/bin:$PATH
刷新环境变量
source /etc/profile
关闭系统防火墙或配置防火墙规则
直接关闭防火墙
systemctl stop firewalld.service
禁止firewall开机启动
禁用防火墙命令 systemctl disable firewalld.service
停止防火墙 systemctl stop firewalld.service
zookeeper命令
启动 zookeeper 服务
zkServer.sh start
如打印如下信息则表明启动成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper … STARTED
查看zookeeper 服务状态
zkServer.sh status
关闭zookeeper服务
zkServer.sh stop
如打印如下信息则表明成功关闭:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
Stopping zookeeper … STOPPED
重启zookeeper服务
zkServer.sh restart
如打印如下信息则表明重启成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
Stopping zookeeper … STOPPED
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper … STARTED
zookeeper自启动服务
新建zookeeper脚本
[root@zookeeper ~]# cd /etc/rc.d/init.d/ [root@zookeeper init.d]# pwd /etc/rc.d/init.d [root@zookeeper init.d]# vim zookeeper
#!/bin/bash #chkconfig:2345 20 90 #description:zookeeper #processname:zookeeper export JAVA_HOME=/data/java/jdk1.8.0_111export ZOOKEEPER_HOME=/data/ms/zookeeper-3.4.9case $1 in start) su root $ZOOKEEPER_HOME/bin/zkServer.sh start;; stop) su root $ZOOKEEPER_HOME/bin/zkServer.sh stop;; status) su root $ZOOKEEPER_HOME/bin/zkServer.sh status;; restart) su $ZOOKEEPER_HOME/bin/zkServer.sh restart;; *) echo "require start|stop|status|restart" ;;esac
给zookeeper脚本授可执行权限
chmod +x zookeeper
添加开机自启动服务
chkconfig --add zookeeper
查看自启动状态
chkconfig --list
Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'.netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:offnetwork 0:off 1:off 2:on 3:on 4:on 5:on 6:offvmware-tools 0:off 1:off 2:on 3:on 4:on 5:on 6:offzookeeper 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- zookeeper3.4.9集群模式安装部署
- CentOS7 Zookeeper3.4.9集群部署
- zookeeper3.4.6分布式集群安装部署记录
- centos7安装zookeeper3.4.9集群
- Zookeeper3.4.10集群模式安装和配置
- zookeeper3.4.6集群部署
- zookeeper3.4.6集群部署
- zookeeper3.4.6集群部署
- zookeeper3.4.6集群部署
- Zookeeper3.4.6集群部署
- zookeeper3.4.6集群安装
- Zookeeper3.4.9安装
- Linux安装zookeeper集群(CentOS7+Zookeeper3.4.10)
- Centos7 下zookeeper3.4.9集群搭建
- linux zookeeper3.4.9集群搭建图文详解
- storm-0.8.2集群模式安装部署
- Zookeeper3.4.9、Hbase1.3.1、Pig0.16.0安装及配置(基于Hadoop2.7.3集群)
- ubuntu12.04下安装zookeeper3.4.5集群环境
- mysql数据库自动备份 保留最近5天备份
- 关于在maven下使用jetty打成war包,发布到tomcat报错找不到文件问题
- 修改input的type属性的几种方法
- android 学习
- Chrome推荐的插件
- zookeeper3.4.9集群模式安装部署
- MyBatis根据数组、集合查询
- U3D粒子系统基础详解(详细版)
- Coursera 深度学习 deep learning.ai 吴恩达 第三课 结构化机器学习项目 第二周 测试题目 Autonomous driving
- 机器学习 数据特征分析 特征工程
- Mapreduce之自定义OutputFormat应用-日志增强
- [py]登录注册逻辑设置
- 数据结构实验之栈与队列十:走迷宫
- 事务的ACID特性及四种隔离级别