FAILED TO WRITE PID installing Zookeeper

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


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.