Yeah .. I knew it was a different Apache project, but figured that since it was so tightly integrated with SolrCloud that others may have run into this issue.

I did some poking around and have (for now) ended up with this .. implemented it as a service through the "systemd.unit" configuration. Created the following unit file here .. /etc/systemd/system/zookeeper.service

-----
[Unit]
Description=Zookeeper Daemon
Wants=syslog.target

[Service]
Type=forking
ExecStart=/apps/local_data/apps/solr/zk_installation/zookeeper/bin/zkServer.sh start /apps/local_data/apps/solr/zk_distribution/zoo.cfg ExecStop=/apps/local_data/apps/solr/zk_installation/zookeeper/bin/zkServer.sh stop /apps/local_data/apps/solr/zk_distribution/zoo.cfg
TimeoutSec=30
Restart=on-failure

[Install]
WantedBy=multi-user.target
-----

Rebooted the server and it seems to work. Your implementation sounds reasonable as well. I may post a query to the ZK list to see what other options are out there. The zookeeperd install seemed like it was going to require more hacking than I wanted to do since our config was already set up and working.

Thanks Shawn!

...scott



On 3/14/18 5:17 PM, Shawn Heisey wrote:
On 3/14/2018 12:24 PM, Scott Prentice wrote:
We might be going at this wrong, but we've got Solr set up as a
service, so if the machine goes down it'll restart. But without
Zookeeper running as a service, that's not much help.
You're probably going to be very unhappy to be told this ... but
ZooKeeper is a completely separate Apache project.  This mailing list
handles Solr.  While SolrCloud does require ZK, setting it up is outside
the scope of this mailing list.

I can tell you what I did to get it running as a service on CentOS 6.
It works, but it's not very robust, and if you ask the zookeeper user
mailing list, they may have better options.  I do strongly recommend
that you ask that mailing list.

---------------------

I extracted the .tar.gz file to the "/opt" folder.  Then I renamed the
zookeeper-X.Y.Z directory to something else.  I used "mbzoo" ... which
only makes sense if you're familiar with our locally developed software.

Next I created a very small shell script, and saved it as
/usr/local/sbin/zkrun (script is below between the lines of equal signs):

=====
#!/bin/sh

# chkconfig: - 75 50
# description: Starts and stops ZK

cd /opt/mbzoo
bin/zkServer.sh $1
=====

I made that script executable and created a symlink for init.d:

chown +x /usr/local/sbin/zkrun
ln -s /usr/local/sbin/zkrun /etc/init.d/zookeeper

Then all I had to do was activate the init script:

chkconfig --add zookeeper
chkconfig zookeeper on

Once that's done, a "service zookeeper start" command should work.

On debian/ubuntu/mint and similar distros, you'd probably use
update-rc.d instead of chkconfig, with different options.  If you're on
an OS other than Linux, everything I've described might need changes.

If you're on Windows, chances are that you'll end up using a program
named NSSM.  If you can get your company to accept using it once they
find out the FULL program name.

Thanks,
Shawn



Reply via email to