在 CentOS7 上安装 zookeeper-3.5.2 服务
Posted gdwkong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在 CentOS7 上安装 zookeeper-3.5.2 服务相关的知识,希望对你有一定的参考价值。
1 [[email protected] src]# pwd 2 /usr/local/src 3 4 # 1、创建 /usr/local/src/zookeeper 文件夹 5 [[email protected] src]# mkdir -p /usr/local/src/zookeeper 6 7 # 2、进入到 /usr/local/src/zookeeper 目录中 8 [[email protected] src]# cd /usr/local/src/zookeeper 9 10 # 3、下载 zookeeper-3.5.2-alpha.tar.gz 11 [[email protected] zookeeper]# wget http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.5.2-alpha/zookeeper-3.5.2-alpha.tar.gz 12 --2018-04-20 19:48:09-- http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.5.2-alpha/zookeeper-3.5.2-alpha.tar.gz 13 正在解析主机 mirrors.shu.edu.cn (mirrors.shu.edu.cn)... 202.121.199.235 14 正在连接 mirrors.shu.edu.cn (mirrors.shu.edu.cn)|202.121.199.235|:80... 已连接。 15 已发出 HTTP 请求,正在等待回应... 200 OK 16 长度:18443679 (18M) [application/x-gzip] 17 正在保存至: “zookeeper-3.5.2-alpha.tar.gz” 18 19 100%[=========================================================================>] 18,443,679 126KB/s 用时 2m 24s 20 21 2018-04-20 19:50:33 (125 KB/s) - 已保存 “zookeeper-3.5.2-alpha.tar.gz” [18443679/18443679]) 22 23 #4、解压缩 zookeeper-3.5.2-alpha.tar.gz 24 [[email protected] zookeeper]# tar -zxvf zookeeper-3.5.2-alpha.tar.gz 25 26 #5、进入到 /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/conf 目录中 27 28 [[email protected] zookeeper]# cd zookeeper-3.5.2-alpha/conf 29 [[email protected] conf]# ls 30 configuration.xsl log4j.properties zoo_sample.cfg 31 32 # 6、复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg 33 [[email protected] conf]# cp zoo_sample.cfg zoo.cfg 34 [[email protected] conf]# ls 35 configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg 36 37 # 7、用 vim 打开 zoo.cfg 文件并修改其内容为如下 38 [[email protected]linux conf]# vim zoo.cfg 39 40 # dataDir=/tmp/zookeeper 41 # The number of milliseconds of each tick 42 tickTime=2000 43 # The number of ticks that the initial 44 # synchronization phase can take 45 initLimit=10 46 # The number of ticks that can pass between 47 # sending a request and getting an acknowledgement 48 syncLimit=5 49 # the directory where the snapshot is stored. 50 # do not use /tmp for storage, /tmp here is just 51 # example sakes. 52 # dataDir=/tmp/zookeeper 53 #数据文件夹 54 dataDir=/urs/local/src/zookeeper/zookeeper-3.5.2-alpha/data 55 #日志文件夹 56 dataLogDir=/urs/local/src/zookeeper/zookeeper-3.5.2-alpha/logs 57 # the port at which the clients will connect 58 clientPort=2181 59 # the maximum number of client connections. 60 # increase this if you need to handle more clients 61 #maxClientCnxns=60 62 # 63 # Be sure to read the maintenance section of the 64 # administrator guide before turning on autopurge. 65 # 66 67 # 8、保存并关闭 zoo.cfg 文件 68 [[email protected]linux conf]# cd .. 69 [[email protected] zookeeper-3.5.2-alpha]# cd bin 70 [[email protected] bin]# ls 71 README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer-initialize.sh zkServer.sh 72 73 #9、用 vim 打开 /etc/ 目录下的配置文件 profile 74 75 [[email protected] bin]# vim /etc/profile 76 77 #10、并在其尾部追加如下内容 78 79 # idea - zookeeper-3.5.2 config start - 2017-04-20 80 81 export ZOOKEEPER_HOME=/usr/local/src/zookeeper/zookeeper-3.5.2-alpha/ 82 export PATH=$ZOOKEEPER_HOME/bin:$PATH 83 export PATH 84 85 # idea - zookeeper-3.5.2 config end - 2017-04-20 86 87 # 11、使 /etc/ 目录下的 profile 文件即可生效 88 [[email protected] bin]# source /etc/profile 89 90 # 12、启动 zookeeper 服务 91 92 [[email protected] bin]# zkServer.sh start 93 ZooKeeper JMX enabled by default 94 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 95 Starting zookeeper ... STARTED 96 97 #13、查询 zookeeper 状态 98 [[email protected] bin]# zkServer.sh status 99 ZooKeeper JMX enabled by default 100 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 101 Client port found: 2181. Client address: localhost. 102 Mode: standalone 103 104 # 14、关闭 zookeeper 服务 105 [[email protected] bin]# zkServer.sh stop 106 ZooKeeper JMX enabled by default 107 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 108 Stopping zookeeper ... STOPPED 109 [[email protected] bin]# zkServer.sh start 110 ZooKeeper JMX enabled by default 111 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 112 Starting zookeeper ... STARTED 113 114 # 15、重启 zookeeper 服务 115 [[email protected] bin]# zkServer.sh restart 116 ZooKeeper JMX enabled by default 117 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 118 ZooKeeper JMX enabled by default 119 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 120 Stopping zookeeper ... STOPPED 121 ZooKeeper JMX enabled by default 122 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg 123 Starting zookeeper ... STARTED
以上是关于在 CentOS7 上安装 zookeeper-3.5.2 服务的主要内容,如果未能解决你的问题,请参考以下文章
在 CentOS7 上安装 Zookeeper-3.4.9 服务
CentOS7 上安装 Zookeeper-3.4.9 服务