Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FAILED TO WRITE PID installing Zookeeper

I am new to Zookeeper and it has being a real issue to install it and run. I am not sure what is wrong in here but I will explain what I've being doing to make it more clear:

1.- I've followed the installation guide provided by Apache. This means download the Zookeeper distribution (stable release) extracted the file and moved into the home directory.

2.- As I am using Ubuntu 12.04 I've modified the .bashrc file including this:

export ZOOKEEPER_INSTALL=/home/myusername/zookeeper-3.4.5
export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

3.- Create a config file on conf/zoo.cfg

tickTime=2000
dataDir=/var/zookeeper
clientPort=2181

and also tried with:

dataDir=/var/log/zookeeper

and

dataDir=/var/bin/zookeeper

4.- When running the start command

zkServer.sh start or `bin/zkServer.sh start` nothing happens and always returns this

JMX enabled by default
Using config: /home/sasuke/zookeeper-3.4.5/bin/../conf/zoo.cfg
mkdir: cannot create directory `/var/zookeeper': Permission denied
Starting zookeeper ... /home/sasuke/zookeeper-3.4.5/bin/zkServer.sh: line 113: /var/zookeeper/zookeeper_server.pid: No such file or directory
FAILED TO WRITE PID

I have Java installed and inside the zookeper directory there is a zookeeper.jar file that I think it's not running. Checking here on stackoverflow there was a guy that said he could run zookeeper after typing

ssh localhost

But when I try to do it I get this error

ssh: connect to host localhost port 22: Connection refused

Please help. I've being here trying to solve it for too long.

Getting started guide of zookeeper: http://zookeeper.apache.org/doc/r3.1.2/zookeeperStarted.html Previous case solved with the shh localhost Zookeeper: FAILED TO WRITE PID

UPDATE: The permissions for log are:

drwxr-xr-x 19 root root     4096 Oct 10 07:52 log

and for zookeeper:

drwxr-xr-x  2 zookeeper         zookeeper    4096 Mar 23  2012 zookeeper

Should I change any of these?

like image 592
Rodrigo Avatar asked Oct 10 '13 12:10

Rodrigo


People also ask

What is Zookeeper_server PID?

Zookeeper stores the process id and snapshot of data in that directory. The process id of the spawned zookeeper server is stored in a file - zookeeper_server.pid (as of 3.3.6) If you have root previleges, you could start zookeeper with sudo (root) previleges, it should work but definitely not recommended.


2 Answers

I have had the same problem. In my case was useful to start Zookeeper and directly specify a configuration file:

/bin/zkServer.sh start conf/zoo.conf

like image 50
Ilya Lapitan Avatar answered Oct 10 '22 10:10

Ilya Lapitan


It seems you do not have the required permissions. The /var/log owner is is going to be root. Zookeeper stores the process id and snapshot of data in that directory. The process id of the spawned zookeeper server is stored in a file -zookeeper_server.pid (as of 3.3.6)

If you have root previleges, you could start zookeeper with sudo (root) previleges, it should work but definitely not recommended. Make sure you start zookeeper with the same(or higher) permissions as the owner of the directory.

Create a new directory in your home folder like /home/username/zookeeper-data. Let dataDir point to that directory and it should work.

like image 6
bsd Avatar answered Oct 10 '22 10:10

bsd