在 CentOS7 上安装 zookeeper-3.5.2 服务

2018-06-18 01:55:52来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

  1 [root@centos-linux src]# pwd 
  2 /usr/local/src
  3 
  4 # 1、创建 /usr/local/src/zookeeper 文件夹
  5 [root@centos-linux src]# mkdir -p /usr/local/src/zookeeper
  6 
  7 # 2、进入到 /usr/local/src/zookeeper 目录中
  8 [root@centos-linux src]# cd /usr/local/src/zookeeper
  9 
 10 # 3、下载 zookeeper-3.5.2-alpha.tar.gz
 11 [root@centos-linux 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 [root@centos-linux 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 [root@centos-linux zookeeper]# cd zookeeper-3.5.2-alpha/conf
 29 [root@centos-linux conf]# ls
 30 configuration.xsl log4j.properties zoo_sample.cfg
 31 
 32 # 6、复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg
 33 [root@centos-linux conf]# cp zoo_sample.cfg zoo.cfg
 34 [root@centos-linux conf]# ls
 35 configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg
 36 
 37 # 7、用 vim 打开 zoo.cfg 文件并修改其内容为如下
 38 [root@centos-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 [root@centos-linux conf]# cd ..
 69 [root@centos-linux zookeeper-3.5.2-alpha]# cd bin
 70 [root@centos-linux 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 [root@centos-linux 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 [root@centos-linux bin]# source /etc/profile
 89 
 90 # 12、启动 zookeeper 服务
 91 
 92 [root@centos-linux 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 [root@centos-linux 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 [root@centos-linux 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 [root@centos-linux 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 [root@centos-linux 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

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Hibernate | Spring JPA | MySQL 使用过程遇到的一些问题

下一篇:java利用poi来读取execl表格返回对象