0

I've created the following systemd service script for running Zookeeper using Ansible:

[Unit]
Description=ZooKeeper

[Service]
User=root
Type=forking
User=zookeeper
Group=zookeeper
ExecStart=/tmp/zookeeper-3.4.9/bin/zkServer.sh start
ExecStop=/tmp/zookeeper-3.4.9/bin/zkServer.sh stop

TimeoutSec=300

[Install]
WantedBy=multi-user.target 

But, while trying to run the script using sudo service zookeeper start I get the following error:

Nov 15 22:00:35 sharedservicesprovider systemd[1]: Starting ZooKeeper...
-- Subject: Unit zookeeper.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zookeeper.service has begun starting up.
Nov 15 22:00:35 sharedservicesprovider systemd[15287]: zookeeper.service: Failed at step USER spawning /tmp/zookeeper-3.4.9/bin/zkServer.sh: No such process
-- Subject: Process /tmp/zookeeper-3.4.9/bin/zkServer.sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /tmp/zookeeper-3.4.9/bin/zkServer.sh could not be executed and failed.
-- 
-- The error number returned by this process is 3.
Nov 15 22:00:35 sharedservicesprovider systemd[1]: zookeeper.service: Control process exited, code=exited status=217
Nov 15 22:00:35 sharedservicesprovider systemd[1]: Failed to start ZooKeeper.
-- Subject: Unit zookeeper.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Any hint onto why I am unable to start Zookeeper properly since I'm quite new to system services?

dsafa
  • 783
  • 2
  • 8
  • 29

4 Answers4

1

Maybe so late... but use as ExecStart:

/tmp/zookeeper-3.4.9/bin/zkServer.sh start-foreground

1
[Unit]
Description=Zookeeper
After=syslog.target
[Service]
Environment=ZOO_LOG_DIR=/zookeeper/logs
SyslogIdentifier=zookeeper
TimoutStartSec=10min
Type=forking
User=zookeeper
Group=zookeeper
ExecStart=/zookeeper/bin/zkServer.sh start
ExecStop=/zookeeper/bin/zkServer.sh stop
[Install]
WantedBy=multi-user.target

ZOO_LOG_DIR is for permission require

s332401890
  • 121
  • 2
  • 8
0

this sounds like basics to check to me first, make sure the file exists

ls -ltrah /tmp/zookeeper-3.4.9/bin/zkServer.sh

if it doesn't find where you extracted the zookeeper startup script. On my instance, it's /opt/kafka/bin/zookeeper-server-start.sh

Then verify that the user you have specified (you've specified two users, root and zookeeper. I'm assuming the last value is what's valid/desired) can access the script and has executable rights to it.

This would be done with chown and chmod commands, respectively.

CamiloSan
  • 1
  • 2
0

I faced a similar issue, but for me there were no error messages anywhere stating any cause of failure. The issue was related to a recent change that I made in the zoo.cfg file.

Issue

There was an extra space after the server URL which was not visible to the naked eye but I noticed that the Vim cursor was going 1 extra character.

server.1:vmname.domain.com:2888:3888

Notice the extra space at the end.

There were no errors in the log about the incorrect server name, but after removing the space my Zookeeper service started.

systemctl restart zookeeper.service

mukesh.kumar
  • 1,100
  • 16
  • 30