前面提到过bin/zkServer.sh: line 109: ./zookeeper.out: Permission denied STARTED错误的解决方法,但是,今天再次启动Zookeeper后,同样的错误再次出现,再查找其他解决方法无效后,准备重装Zookeeper。
具体过程如下:
在Slave1上:
[hadoop@Slave1 ~]$ su
Password:
[root@Slave1 hadoop]# cd /usr/local/
[root@Slave1 local]# tar -zcf ./zookeeper.tar.gz ./zookeeper
[root@Slave1 local]# scp zookeeper.tar.gz Slave2:/usr/local/
root@slave2's password:
zookeeper.tar.gz 100% 18MB 17.9MB/s 00:00
[root@Slave1 local]#
在Slave2上:
解压:
[hadoop@Slave2 ~]$ cd /usr/local/
[hadoop@Slave2 local]$ su
Password:
[root@Slave2 local]# tar -zxvf zookeeper.tar.gz -C /usr/local/
修改配置及启动:
[root@Slave2 local]# cd /usr/local/zookeeper/zkdata/
[root@Slave2 zkdata]# ls
myid version-2 zookeeper_server.pid
[root@Slave2 zkdata]# vim myid #这里,将myid中的“1”改成“2”
[root@Slave2 zkdata]# cd ../..
[root@Slave2 local]# chown -R hadoop:hadoop zookeeper
[root@Slave2 local]# ll
total 18392
drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin
drwxr-xr-x. 7 hadoop hadoop 4096 Oct 27 22:59 elasticsearch
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 11 hadoop hadoop 4096 Oct 29 01:44 hadoop
drwxr-xr-x. 2 root root 4096 Sep 23 2011 include
drwxr-xr-x. 4 hadoop hadoop 4096 Oct 27 19:35 java
drwxr-xr-x. 6 hadoop hadoop 4096 Sep 9 10:27 kafka
drwxr-xr-x. 7 hadoop hadoop 4096 Sep 8 13:12 kibana
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
drwxr-xr-x. 6 hadoop hadoop 4096 Oct 27 23:46 logstash
drwxr-xr-x. 3 hadoop hadoop 4096 Sep 5 18:21 mongodb
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 5 root root 4096 Aug 25 01:40 share
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
drwxrwxrwx. 11 hadoop hadoop 4096 Oct 28 00:02 zookeeper
-rw-r--r--. 1 root root 18756343 Nov 2 18:13 zookeeper.tar.gz
[root@Slave2 local]# cd zookeeper
[root@Slave2 zookeeper]# exit
exit
[hadoop@Slave2 local]$ cd /usr/local/zookeeper
[hadoop@Slave2 zookeeper]$ bin/zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@Slave2 zookeeper]$ bin/zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[hadoop@Slave2 zookeeper]$