FAILED TO WRITE PID installing Zookeeper

后端 未结 11 2747
小蘑菇
小蘑菇 2021-02-19 22:10

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:

相关标签:
11条回答
  • 2021-02-19 22:35

    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.

    0 讨论(0)
  • 2021-02-19 22:37

    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.

    0 讨论(0)
  • 2021-02-19 22:38

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

    0 讨论(0)
  • 2021-02-19 22:41

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

    But its generally not advisable to use tmp directory.

    0 讨论(0)
  • This seems to be an ownership issue; running the following solved this for me.

    $ sudo chown -R $USER /var/lib/zookeeper
    

    N.B. I've outlined my steps below which show the error I was getting (the same as the error in this SO question) and the attempt at trying the solution proposed by a user above, which advised to provide zoo.cfg as an argument.

    13:01:29 ✔ ~  :: $ZK/bin/zkServer.sh start
    ZooKeeper JMX enabled by default
    Using config: /usr/local/Cellar/zookeeper/3.4.14/libexec/bin/../conf/zoo.cfg
    Starting zookeeper ... /usr/local/Cellar/zookeeper/3.4.14/libexec/bin/zkServer.sh: line 149: /var/lib/zookeeper/zookeeper_server.pid: Permission denied
    FAILED TO WRITE PID
    
    13:01:32 ✘ ~  :: $ZK/bin/zkServer.sh start $ZK/conf/zoo.cfg
    ZooKeeper JMX enabled by default
    Using config: /usr/local/Cellar/zookeeper/3.4.14/libexec/conf/zoo.cfg
    Starting zookeeper ... /usr/local/Cellar/zookeeper/3.4.14/libexec/bin/zkServer.sh: line 149: /var/lib/zookeeper/zookeeper_server.pid: Permission denied
    FAILED TO WRITE PID
    
    13:04:45 ✔ /var/lib  :: ls -la
    total 0
    drwxr-xr-x  4 root     wheel 128 Apr 19 18:55 .
    drwxr-xr-x 27 root     wheel 864 Apr 19 18:55 ..
    drwxr--r--  3 root     wheel  96 Mar 24 15:07 zookeeper
    13:04:48 ✔ /var/lib  :: echo $USER
    tallamjr
    13:06:03 ✔ /var/lib  :: sudo chown -R $USER zookeeper
    Password:
    13:06:44 ✔ /var/lib  :: ls -la
    total 0
    drwxr-xr-x  4 root     wheel 128 Apr 19 18:55 .
    drwxr-xr-x 27 root     wheel 864 Apr 19 18:55 ..
    drwxr--r--  3 tallamjr wheel  96 Mar 24 15:07 zookeeper
    
    13:06:48 ✔ ~  :: $ZK/bin/zkServer.sh start
    ZooKeeper JMX enabled by default
    Using config: /usr/local/Cellar/zookeeper/3.4.14/libexec/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED
    

    REF: - https://askubuntu.com/questions/6723/change-folder-permissions-and-ownership

    0 讨论(0)
提交回复
热议问题