FAILED TO WRITE PID installing Zookeeper

别等时光非礼了梦想. 提交于 2019-12-05 02:52:25

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.

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

Rohit Kataria

The default zookeeper installation (tar extract) comes with the conf file named conf/zoo_sample.cfg while the same extract's bin/zkServer.sh expects the conf file to be called zoo.cfg thereby resulting in a "No such file or dir" and the "failed to write pid" error. So before running zkServer.sh to start or stop zookeeper instance, either:

  • rename the zoo_sample.cfg in the conf dir to zoo.cfg, or
  • give the name (and path) to the conf file (as suggested by Ilya Lapitan), or, of course
  • edit zkServer.sh ;-)

This happens to me due to low disk space. cause zookeeper cant create pid file inside zookeeper data folder.

When you create the Directory for dataDir make sure to use the -p option. This will allow subsequent directories to be created as required by the application placing files.

mkdir -p /var/log/zookeeperData Then set:

dataDir=/var/log/zookeeperData

jack AKA karthik

I have faced the same issue while starting the zookeeper with this command:

hadoop@ubuntu:~/hadoop/zookeeper/zookeeper-3.4.8$ bin/zkServer.sh start

ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper.

It should have been written by the master. Check the value configured in zookeeper.znode.parent. There could be a mismatch with the one configured in the master.

But running the script as su rectified the issue:

hadoop@ubuntu:~/hadoop/zookeeper/zookeeper-3.4.8$ sudo bin/zkServer.sh start

ZooKeeper JMX enabled by default Using config: /home/hadoop/hadoop/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg Starting zookeeper ... STARTED

Go to /usr/local/etc/
You will find zookeeper directory
delete the directory
and restart the server - zkServer start

Change the path give dataDir=/tmp/zookeeper. If it works then its clearly access issues

But its generally not advisable to use tmp directory.

Seems there's all kinds of reasons this can happen. So many helpful answers here!

For me, I had improper line endings in my zoo.cfg file, and possibly invisible characters, so zookeeper was trying to create directories like /var/zookeeper? and /var/zookeeper\r. Reworking my zoo.cfg a bit fixed it for me, along with deleting zoo_sample.conf.

try to use sudo -E bin/zkServer.sh start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!