Zookeeper starts using bin/zkServer.sh but not with service nor zookeeper-server

zookeeper

On Linux Scientific I have installed ZooKeeper from CDH5.

When starting zookeeper using sudo service zookeeper-server start or zookeeper-server start it reports the server running, but fails silently. If I start it using bin/zkServer.sh it runs successfully.

How come?
How can I fix this so it will work with the former two?
It seems that service and the binary don't start the server as the user zookeeper, which has permissions to the dataDir

Best Answer

Maybe you ran into the same problem as I did. Zookeeper runs as user zookeeper, but if you've run bin/zkServer.sh once as root, various files will have been created with root as owner. Trying to start zookeeper with the upstart scripts will then fail.

My solution was to delete the directory /var/lib/zookeeper/version-2/