Zookeeper安装使用--单机模式
1.version package准备
zookeeper-3.4.5.tar.gz
2.mkdir zookeeper folder.tar the package
mkdir zookeeper
tar xvf zookeeper-3.4..tar.gz
[root@localhost zookeeper]# pwd
/root/zookeeper
[root@localhost zookeeper]# ll
total
drwxr-xr-x. games Jan : zookeeper-3.4.
-rw-r--r--. root root Apr zookeeper-3.4..tar.gz
[root@localhost zookeeper]#
3.将zookeeper-3.4.10/conf目录下的zoo_sample.cfg文件拷贝一份,命名为zoo.cfg.然后修改zoo.cfg文件
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/root/zookeeper/zookeeper-3.4./data
dataLogsDir=/root/zookeeper/zookeeper-3.4./logs
# the port at which the clients will connect
clientPort=
#
# 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
#
server.=192.168.106.133::
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval=
4.配置myid文件
path:dataDir=/root/zookeeper/zookeeper-3.4.5/data 创建myid文件(编辑myid文件,并在对应的IP的机器上输入对应的编号。如在zookeeper上,myid 文件内容就是1。如果只在单点上进行安装配置,那么只有一个server.1)
5.修改.bash_profile,增加zookeeper配置:path =etc/profile,编辑完成使profile文件夹生效:source etc/profile
# zookeeper env export
ZOOKEEPER_HOME=/root/zookeeper/zookeeper-3.4. export
PATH=$ZOOKEEPER_HOME/bin:$PATH
6.关闭防火墙
systemctl stop firewalld.service
7.测试Zookeeper
切换至/root/zookeeper/zookeeper-3.4.5/bin目录中执行
./zkServer.sh start #查看进程
jps 其中,QuorumPeerMain是zookeeper进程,启动正常。 #查看状态
./zkServer.sh status #服务器输出信息
tail -500f zookeeper.out #停止zookeeper进程
./zkServer.sh stop
8.设置zookeeper服务开机启动
1.切换至/etc/rc.d/init.d/目录下
cd /etc/rc.d/init.d
[root@localhost init.d]# pwd
-rwxr-xr-x. root root Jan : zookeeper /etc/rc.d/init.d
2. 创建zookeeper文件
touch zookeeper 3.更新权限
chmod +x zookeeper #编辑文件,在zookeeper里面输入如下内容
# chkconfig: 2345 10 90
# description: zookeeper
#processname:zookeeper
export JAVA_HOME=/root/jdk/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH
case $1 in
start)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh start;;
stop)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh stop;;
status)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh status;;
restart)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh restart;;
*) echo "require start|stop|status|restart" ;;
esac
4.添加服务到开机项 chkconfig --add zookeeper
5.chkconfig --list查看服务是否添加
chkconfig --list验证zookeeper是否添加开机启动
[root@localhost init.d]# chkconfig --list
netconsole :off :off :off :off :off :off :off
network :off :off :on :on :on :on :off
zookeeper :off :off :on :on :on :on :off
[root@localhost init.d]#
开机通过命令启动zookeeper服务
service zookeeper start
查看zookeeper服务
service zookeeper status
最新文章
- SQL经典面试题及答案
- 事件委托 documentFragment
- 批处理将字符串输出到Windows剪贴板
- Java Socket网络编程的经典例子(转)
- git不常用命令
- [原]Java修炼 之 基础篇(二)Java语言构成
- codeforces Gym 100187F F - Doomsday 区间覆盖贪心
- javascript看你能够做对几题
- ServiceStack.Redis
- Foreman 企业级配置管理解决方案
- 通过ionice和nice降低shell脚本运行的优先级
- 关于 Bootstrap的知识
- Android程序员的Flutter学习笔记
- Linux 逻辑卷管理LVM
- 【mock】后端不来过夜半,闲敲mock落灯花 (mockjs+Vuex+Vue实战)
- 《Flask Web开发实战:入门、进阶与原理解析(李辉著 )》PDF+源代码
- linux nohup screen注解
- UVa 1610 聚会游戏
- MyEclipse2017CI破解教程
- Python学习-39.Python中的生成器