zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norbert Kalmar <nkal...@cloudera.com.INVALID>
Subject Re: zookeeper as systemd
Date Mon, 16 Jul 2018 11:49:16 GMT
The type is Linux config, and forking is used when we want the process to
call fork() during startup. This should guarantee that when startup is
finished, all ports are open. In my understanding, using FORKING will tell
systemd the startup is complete and ports are open. See
https://www.freedesktop.org/software/systemd/man/systemd.service.html for
more information.
TYPE=simple is mainly for daemons that don't use network channels, or they
have their own socket activation.

So in my opinion, TYPE=forking is better for ZK. But! Forking should
require a PIDfile in order for it to work properly... but since systemd is
used, it should know the PID as it is a supervisor. I'm also lost here a
bit...
Looking at ZK PID file should be
available: ZOOPIDFILE="$ZOO_DATADIR/zookeeper_server.pid"


About the simple start or start-foreground... I think I was quick to say
only use simple start in prod environment. This is much more complicated,
for example start-foreground would just make it ignore nohup.

Doing some search, these 2 questions might help:
https://stackoverflow.com/questions/40620544/systemd-zookeeper-service-failed
https://askubuntu.com/questions/979498/how-to-start-a-zookeeper-daemon-after-booting-under-specific-user-in-ubuntu-serv

Putting this all together, I think if you don't really care when socket is
ready, just use TYPE=simple and call with start-foreground.

Regards,
Norbert



On Mon, Jul 16, 2018 at 11:48 AM adrien ruffie <adriennolarsen@hotmail.fr>
wrote:

> Thank Nobert !
>
>
> It really help me,
>
>
> according to you, what would you recommend?
>
>
> To launch with "Type=simple" and zkServer.sh start ?
>
> Or "Type=forking" and zkServer.sh start ?
>
>
> Because start command launch Zookeeper as a Daemon,
>
> but if I use "Type=simple" the system already daemonize the process ...
>
> Do you think that can be daemonize a daemon ... ? Strange
>
>
> I really ready to use "Type=forking" option but, according to this
> following post
>
>
> https://bbs.archlinux.org/viewtopic.php?id=191669
>
>
> the "Type=forking" is not really recommended ...
>
> what do you think ?
>
>
> Adrien
>
>
> ________________________________
> De : Norbert Kalmar <nkalmar@cloudera.com.INVALID>
> Envoyé : lundi 16 juillet 2018 10:15
> À : user@zookeeper.apache.org
> Objet : Re: zookeeper as systemd
>
> Hi Adrien,
>
> zkServer.sh start-foreground - starts the ZooKeeper process in the
> foreground. Good for debugging (thats what I use it for), or check
> something, as you will have the logs printed to standard output (console
> most probably).
> The "start" is what you want to use in production environment. the process
> will run in the background.
>
>    ' What is "After=network.target" ? ' - ZooKeeper should only start after
> the network... available? I think this should be something like
> After=network-online.target
>
> But looking at the others, I'm not entirely sure either what they really
> do. But checko out this jira -
> https://issues.apache.org/jira/browse/ZOOKEEPER-2095
>
> There was a patch about this, and they added systemd startup/conf files.
>
> Sorry, this is all I could come up with, as I'm not familiar with this part
> either. Hope it helps.
>
> Regards,
> Norbert
>
>
> On Fri, Jul 13, 2018 at 5:30 PM adrien ruffie <adriennolarsen@hotmail.fr>
> wrote:
>
> > Hello Zookeeper's users,
> >
> >
> > I have 2 questions for you.
> >
> >
> > what is the real difference between these 2 following commands ? (I don't
> > find any documentation)
> >
> >
> > zkServer.sh start-foreground
> >
> > and
> >
> > zkServer.sh start
> >
> >
> >
> > My second question is, how I can correctly start my zookeeper as a
> > systemclt service ?
> >
> > What is the common best template to write into
> > /etc/systemd/system/zookeeper.service ?
> >
> > Do you use Restart=always ? RestartSec=0s ?
> >
> > What is "After=network.target" ?
> >
> > If my Zookeeper does not really start in 300 sec, the process will be
> > shutdown ?
> >
> >
> > Do you have any example of zookeeper service file ?
> >
> >
> > Because our zookeeper.service is right now:
> >
> >
> > [Unit]
> > Description=ZooKeeper
> >
> > [Service]
> > Type=simple
> > User=zookeeper
> > Group=zookeeper
> > ExecStart=/usr/local/zookeeper-3.4.9/bin/zkServer.sh start-foreground
> >
> > TimeoutSec=300
> >
> > [Install]
> > WantedBy=multi-user.target
> >
> > ------------------- But I found this following on a blog:
> >
> >
> > [Unit]
> > Description=Apache Zookeeper
> > After=network.target
> >
> > [Service]
> > Type=forking
> > User=zookeeper
> > Group=zookeeper
> > SyslogIdentifier=zookeeper
> > Restart=always
> > RestartSec=0s
> > ExecStart=/usr/bin/zookeeper-server start
> > ExecStop=/usr/bin/zookeeper-server stop
> > ExecReload=/usr/bin/zookeeper-server restart
> >
> > [Install]
> > WantedBy=multi-user.target
> >
> >
> > Thank you very much and best regards
> >
> > Adrien
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message