Arif Ardiasmono
Arif Ardiasmono

Reputation: 11

zookeeper_server.pid: Permission denied FAILED TO WRITE PID

Sorry, if there are the same question. I'll do project on hbase that need to install zookeeper. So I follow the instruction on youtube : https://www.youtube.com/watch?v=ZoYteLiNHNc

Finally I want to start zkServer.sh but

ardias@Arif-Satellite-C800D:~$ zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/hadoop/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... /usr/local/hadoop/zookeeper-3.4.9/bin/zkServer.sh: line 149: /usr/local/hadoop/zoo_data/zookeeper_server.pid: Permission denied
FAILED TO WRITE PID

I think the problem is I am not superuser so I use sudo but

ardias@Arif-Satellite-C800D:~$ sudo zkServer.sh start
[sudo] password for ardias: 
sudo: zkServer.sh: command not found

I've been search any solutions on FAILED TO WRITE PID installing Zookeeper and also Zookeeper: FAILED TO WRITE PID but it doesn't work on me. There's file myid in /usr/local/hadoop/zoo_data contains character "1". Anybody have solutions? This is my zoo.cfg and my ubuntu version is 14.04.

tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/hadoop/zoo_data
clientPort=2181
server.1=localhost:2888:3888

Upvotes: 0

Views: 5064

Answers (3)

Suraj
Suraj

Reputation: 767

If someone is still facing this issue on MAC, then find below

ZOO_DATADIR="$(echo -e "${ZOO_DATADIR}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" 

in zkServer.sh file and remove option -e from echo command.

The final command should be ZOO_DATADIR="$(echo "${ZOO_DATADIR}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"

Restart zookeeper after this.

Upvotes: 2

Shyam Gupta
Shyam Gupta

Reputation: 511

Please check the zoo_sample.cfg

[hadoop@localhost conf]$ vi zoo_sample.cfg
[hadoop@localhost conf]$ ls
configuration.xsl  log4j.properties  zoo_sample.cfg
[hadoop@localhost conf]$ mv zoo_sample.cfg zoo.cfg
change the zoo_sample.cfg to zoo.cfg

Upvotes: 0

sel-fish
sel-fish

Reputation: 4496

Two solutions:
1. change dataDir to a directory that ardias have permission.
2. find the absolute path of zkServer.sh and use sudo /$absolutePath/zkServer.sh start

Upvotes: 2

Related Questions