RE: ZooKeeper Cluster Health Checking

2020-09-23 Thread adrien ruffie
Hello all,

I have a problem in production ...

We have the following zoo configuration file:

tickTime=4000
dataDir=/var/lib/zookeeper

dataLogDir=/var/log/zookeeper

initLimit=30
syncLimit=15

autopurge.snapRetainCount=3
autopurge.purgeInterval=48

clientPort=2181
maxClientCnxns=60

server.1=ZOO1:2888:3888
server.2=ZOO2:2888:3888
server.3=ZOO3:2888:3888
server.4=ZOO4:2888:3888
server.5=ZOO5:2888:3888

We are in zookeeper-3.4.10, but we recently saw, that log and snapshot aren't 
purge ...
do you know this issue, is a bug, or bad configuration ?

Thank you very much and best regards

Adrien Ruffié

De : adrien ruffie 
Envoyé : mercredi 18 juillet 2018 09:01
À : user@zookeeper.apache.org 
Objet : RE: ZooKeeper Cluster Health Checking

Ok thank Harish,

I keep the idea !


Best regards,


Adrien


De : harish lohar 
Envoyé : mardi 17 juillet 2018 23:13:28
À : user@zookeeper.apache.org
Objet : Re: ZooKeeper Cluster Health Checking

We did it via java monitoring app , using zookeeper java api which sends 4
lw commands to zookeeper and returns the output.


Thanks
Harish

On Tue, Jul 17, 2018 at 2:00 AM adrien ruffie 
wrote:

> Hi Harish,
>
>
> thank you very much for this advise and explanation !
>
> Do you think with just a simple script shell for checking all this metrics
> is enough ? Or would better to do it in a Java with a simple monitoring
> application?
>
>
> Thank again,
>
>
> Best regards,
>
>
> Adrien
>
> 
> De : harish lohar 
> Envoyé : mardi 17 juillet 2018 04:13:51
> À : user@zookeeper.apache.org
> Objet : Re: ZooKeeper Cluster Health Checking
>
> Hi Adrian,
> Below zookeeper commands are generally used to get health of zookeeper
> cluster
> stat
>
> Lists brief details for the server and connected clients.
>
> usage echo stat | nc server port
>
> This gives whether cluster is up /down. If down this will give that
>
> Zookeeper instance is currently not serving any request -  which means
> either the leader election is failing or <= 50% of zookeeper node in
> cluster are down.
>
>
> mntr
>
> *New in 3.4.0:* Outputs a list of variables that could be used for
> monitoring the health of the cluster.
>
> $ echo mntr | nc localhost 2185
>
> zk_version  3.4.0
> zk_avg_latency  0
> zk_max_latency  0
> zk_min_latency  0
> zk_packets_received 70
> zk_packets_sent 69
> zk_outstanding_requests 0
> zk_server_state leader
> zk_znode_count   4
> zk_watch_count  0
> zk_ephemerals_count 0
> zk_approximate_data_size27
> zk_followers4   - only exposed by the Leader
> zk_synced_followers 4   - only exposed by the Leader
> zk_pending_syncs0   - only exposed by the Leader
> zk_open_file_descriptor_count 23- only available on Unix platforms
> zk_max_file_descriptor_count 1024   - only available on Unix platforms
>
> The output is compatible with java properties format and the content may
> change over time (new keys added). Your scripts should expect changes.
>
> ATTENTION: Some of the keys are platform specific and some of the keys are
> only exported by the Leader.
>
> The output contains multiple lines with the following format:
>
>
> On Mon, Jul 16, 2018 at 10:13 AM adrien ruffie 
> wrote:
>
> > Hello all,
> >
> >
> > In my company we have a Zookeeper production cluster.
> >
> >
> > But we don't really know how can we check the health of our cluster...
> >
> >
> > Can we advise us about this topic ?
> >
> >
> > I know this topic may has been cropping up for a while, but I don't
> really
> > found any concrete solution.
> >
> >
> > Do you use a monitoring tools ? Which can launch alert ?
> >
> > What metrics/properties/any thing which can indicate that our cluster
> > isn't in good health.
> >
> >
> > Thank you very much and best regards
> >
> >
> > Adrien
> >
>


RE: Zookeeper monitoring

2019-04-05 Thread adrien ruffie
The community does not look too active, unfortunately ...

De : adrien ruffie
Envoyé : mercredi 3 avril 2019 14:24
À : user@zookeeper.apache.org
Objet : Zookeeper monitoring

Hello all,

I order to set to correct values for several monitoring parameters, I would 
like to know the best value to monitor for following parameter:
(from what value would it be necessary to worry about the following parameters)

zk_outstanding_requests
zk_open_file_descriptor_count
zk_approximate_data_size
zk_fsync_threshold_exceed_count
zk_avg_latency
zk_pending_syncs

Example for zk_open_file_descriptor_count tell me if I'm wrong, but I think
this should be a percentage value that should not be exceeded depending on the 
parameter.

throws an alerte if zk_open_file_descriptor_count > 50 % of 
zk_max_file_descriptor_count , right ?


I am looking for relatively correct values for triggering alert.

Thnak a lot and best regards

Adrien


Zookeeper monitoring

2019-04-03 Thread adrien ruffie
Hello all,

I order to set to correct values for several monitoring parameters, I would 
like to know the best value to monitor for following parameter:
(from what value would it be necessary to worry about the following parameters)

zk_outstanding_requests
zk_open_file_descriptor_count
zk_approximate_data_size
zk_fsync_threshold_exceed_count
zk_avg_latency
zk_pending_syncs

Example for zk_open_file_descriptor_count tell me if I'm wrong, but I think
this should be a percentage value that should not be exceeded depending on the 
parameter.

throws an alerte if zk_open_file_descriptor_count > 50 % of 
zk_max_file_descriptor_count , right ?


I am looking for relatively correct values for triggering alert.

Thnak a lot and best regards

Adrien


RE: ZooKeeper Cluster Health Checking

2018-07-18 Thread adrien ruffie
Ok thank Harish,

I keep the idea !


Best regards,


Adrien


De : harish lohar 
Envoyé : mardi 17 juillet 2018 23:13:28
À : user@zookeeper.apache.org
Objet : Re: ZooKeeper Cluster Health Checking

We did it via java monitoring app , using zookeeper java api which sends 4
lw commands to zookeeper and returns the output.


Thanks
Harish

On Tue, Jul 17, 2018 at 2:00 AM adrien ruffie 
wrote:

> Hi Harish,
>
>
> thank you very much for this advise and explanation !
>
> Do you think with just a simple script shell for checking all this metrics
> is enough ? Or would better to do it in a Java with a simple monitoring
> application?
>
>
> Thank again,
>
>
> Best regards,
>
>
> Adrien
>
> 
> De : harish lohar 
> Envoyé : mardi 17 juillet 2018 04:13:51
> À : user@zookeeper.apache.org
> Objet : Re: ZooKeeper Cluster Health Checking
>
> Hi Adrian,
> Below zookeeper commands are generally used to get health of zookeeper
> cluster
> stat
>
> Lists brief details for the server and connected clients.
>
> usage echo stat | nc server port
>
> This gives whether cluster is up /down. If down this will give that
>
> Zookeeper instance is currently not serving any request -  which means
> either the leader election is failing or <= 50% of zookeeper node in
> cluster are down.
>
>
> mntr
>
> *New in 3.4.0:* Outputs a list of variables that could be used for
> monitoring the health of the cluster.
>
> $ echo mntr | nc localhost 2185
>
> zk_version  3.4.0
> zk_avg_latency  0
> zk_max_latency  0
> zk_min_latency  0
> zk_packets_received 70
> zk_packets_sent 69
> zk_outstanding_requests 0
> zk_server_state leader
> zk_znode_count   4
> zk_watch_count  0
> zk_ephemerals_count 0
> zk_approximate_data_size27
> zk_followers4   - only exposed by the Leader
> zk_synced_followers 4   - only exposed by the Leader
> zk_pending_syncs0   - only exposed by the Leader
> zk_open_file_descriptor_count 23- only available on Unix platforms
> zk_max_file_descriptor_count 1024   - only available on Unix platforms
>
> The output is compatible with java properties format and the content may
> change over time (new keys added). Your scripts should expect changes.
>
> ATTENTION: Some of the keys are platform specific and some of the keys are
> only exported by the Leader.
>
> The output contains multiple lines with the following format:
>
>
> On Mon, Jul 16, 2018 at 10:13 AM adrien ruffie 
> wrote:
>
> > Hello all,
> >
> >
> > In my company we have a Zookeeper production cluster.
> >
> >
> > But we don't really know how can we check the health of our cluster...
> >
> >
> > Can we advise us about this topic ?
> >
> >
> > I know this topic may has been cropping up for a while, but I don't
> really
> > found any concrete solution.
> >
> >
> > Do you use a monitoring tools ? Which can launch alert ?
> >
> > What metrics/properties/any thing which can indicate that our cluster
> > isn't in good health.
> >
> >
> > Thank you very much and best regards
> >
> >
> > Adrien
> >
>


Re: Permission denied as zookeeper user

2018-07-17 Thread adrien ruffie
Thank Andor !
I have found thé problème.
My zookeeper user doesn't have right on /Var/lib/zookeeper and 
/usr/local/zookeeper
Because directoires were créateur as Root !

Télécharger Outlook pour Android<https://aka.ms/ghei36>



De : Andor Molnar
Envoyé : mardi 17 juillet 21:04
Objet : Re: Permission denied as zookeeper user
À : user@zookeeper.apache.org


Hi Adrian, Check the ‘dataDir’ and ‘dataLogDir’ (might be the same) directory 
permissions. Zookeeper running user must have write permissions to them. 
Regards, Andor > On 2018. Jul 17., at 18:39, adrien ruffie wrote: > > Hello 
everyone, > > > I have a little problem when I try to launch "./zkServer.sh 
start" with my "zookeeper" user ... > > I get the following stacktrace: > > > 
2018-07-17 18:26:53,569 [myid:5] - INFO 
[WorkerReceiver[myid=5]:FastLeaderElection@600] - Notification: 1 (message 
format version), 3 (n.leader), 0x276590006 (n.zxid), 0x43 (n.round), 
FOLLOWING (n.state), 1 (n.sid), 0x2765a (n.peerEpoch) FOLLOWING (my state) > 
2018-07-17 18:26:53,574 [myid:5] - INFO 
[QuorumPeer[myid=5]/0:0:0:0:0:0:0:0:2181:Learner@326] - Getting a diff from the 
leader 0x276590006 > 2018-07-17 18:26:53,575 [myid:5] - WARN 
[QuorumPeer[myid=5]/0:0:0:0:0:0:0:0:2181:Follower@87] - Exception when 
following the leader > java.io.IOException: Permission denied > at 
java.io.UnixFileSystem.createFileExclusively(Native Method) > at 
java.io.File.createNewFile(File.java:1012) > at 
org.apache.zookeeper.server.quorum.Learner.syncWithLeader(Learner.java:436) > 
at org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:80) > 
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:846) > 
2018-07-17 18:26:53,575 [myid:5] - INFO 
[QuorumPeer[myid=5]/0:0:0:0:0:0:0:0:2181:Follower@164] - shutdown called > 
java.lang.Exception: shutdown Follower > at 
org.apache.zookeeper.server.quorum.Follower.shutdown(Follower.java:164) > at 
org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:850) > > > > 
> > But when I launch as root, the problem disappears ... > > I understand 
which is a permission denied for my zookeeper user, but the stack doesn't give 
me, the concerned file or directory ... > > > Do you already get the same 
problem ? > > > Thank, and best regards, > > > Adrien



Permission denied as zookeeper user

2018-07-17 Thread adrien ruffie
Hello everyone,


I have a little problem when I try to launch "./zkServer.sh start" with my 
"zookeeper" user ...

I get the following stacktrace:


2018-07-17 18:26:53,569 [myid:5] - INFO  
[WorkerReceiver[myid=5]:FastLeaderElection@600] - Notification: 1 (message 
format version), 3 (n.leader), 0x276590006 (n.zxid), 0x43 (n.round), 
FOLLOWING (n.state), 1 (n.sid), 0x2765a (n.peerEpoch) FOLLOWING (my state)
2018-07-17 18:26:53,574 [myid:5] - INFO  
[QuorumPeer[myid=5]/0:0:0:0:0:0:0:0:2181:Learner@326] - Getting a diff from the 
leader 0x276590006
2018-07-17 18:26:53,575 [myid:5] - WARN  
[QuorumPeer[myid=5]/0:0:0:0:0:0:0:0:2181:Follower@87] - Exception when 
following the leader
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at org.apache.zookeeper.server.quorum.Learner.syncWithLeader(Learner.java:436)
at org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:80)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:846)
2018-07-17 18:26:53,575 [myid:5] - INFO  
[QuorumPeer[myid=5]/0:0:0:0:0:0:0:0:2181:Follower@164] - shutdown called
java.lang.Exception: shutdown Follower
at org.apache.zookeeper.server.quorum.Follower.shutdown(Follower.java:164)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:850)





But when I launch as root, the problem disappears ...

I understand which is a permission denied for my zookeeper user, but the stack 
doesn't give me, the concerned file or directory ...


Do you already get the same problem ?


Thank, and best regards,


Adrien


RE: zookeeper as systemd

2018-07-17 Thread adrien ruffie
thank you very much Norbert !

I take your useful suggestion, and try to launch zookeeper with your

service file.


Great thank,


Adrien


De : Norbert Kalmar 
Envoyé : lundi 16 juillet 2018 16:18:36
À : user@zookeeper.apache.org
Objet : Re: zookeeper as systemd

Some prefer to use start-foreground to basically "bypass" the bash script
(and the background management), and make systemd care about it. Also to
ignore any nohup. So while it is also my understanding that the recommended
way is to start ZK with simple start, some use start-foreground to start as
a systemd service.

Type=simple - drawback is depending services (if any) will not know if it
is truly ready (sockets as well)
Type=forking - drawback is there might be some issues with the PID (file).
So you should also define where the pid file
is: PIDFILE="/var/run/zookeeper/zookeeper_server.pid"

Any combinations should work. It really comes down to preferans I think.

Disclaimer: I'm kind of trying to make educated guesses here, so a
Linux-slash-zookeeper guru could probably be more of a help here :)

This is how I would create systemd service file (this time using start not
start-foreground) - or something like that:
Put the systemd service file in: /etc/systemd/system/zookeeper.service

[Unit]

Description=Zookeeper

After=network.target syslog.target


[Service]

SyslogIdentifier=zookeeper

TimeoutStartSec=10min

Type=forking

User=zookeeper

Group=zookeeper

PIDFILE="/var/run/zookeeper/zookeeper_server.pid"

ExecStart=/usr/lib/zookeeper/bin/zkServer.sh start

ExecStop=/usr/lib/zookeeper/bin/zkServer.sh stop

WorkingDirectory=/var/lib/zookeeper


[Install]

WantedBy=multi-user.target


Of course not everything is required (User, Group, WorkingDirectory
possibly optional)


But I would dig deeper before saying anything for sure.


Regards,

Norbert

On Mon, Jul 16, 2018 at 3:01 PM adrien ruffie 
wrote:

> Thank Norbert for this good explanation.
>
> Yes I'm also a really lost here a bit ...
>
> But it's a zookeeper production's cluster of 5 nodes.
> It should be start instead start-foreground isn't it ? (with simple type)
> 
> De : Norbert Kalmar 
> Envoyé : lundi 16 juillet 2018 13:49:16
> À : user@zookeeper.apache.org
> Objet : Re: zookeeper as systemd
>
> 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 
> 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 ?
> >
> >
> > Adri

RE: ZooKeeper Cluster Health Checking

2018-07-17 Thread adrien ruffie
Hi Harish,


thank you very much for this advise and explanation !

Do you think with just a simple script shell for checking all this metrics is 
enough ? Or would better to do it in a Java with a simple monitoring 
application?


Thank again,


Best regards,


Adrien


De : harish lohar 
Envoyé : mardi 17 juillet 2018 04:13:51
À : user@zookeeper.apache.org
Objet : Re: ZooKeeper Cluster Health Checking

Hi Adrian,
Below zookeeper commands are generally used to get health of zookeeper
cluster
stat

Lists brief details for the server and connected clients.

usage echo stat | nc server port

This gives whether cluster is up /down. If down this will give that

Zookeeper instance is currently not serving any request -  which means
either the leader election is failing or <= 50% of zookeeper node in
cluster are down.


mntr

*New in 3.4.0:* Outputs a list of variables that could be used for
monitoring the health of the cluster.

$ echo mntr | nc localhost 2185

zk_version  3.4.0
zk_avg_latency  0
zk_max_latency  0
zk_min_latency  0
zk_packets_received 70
zk_packets_sent 69
zk_outstanding_requests 0
zk_server_state leader
zk_znode_count   4
zk_watch_count  0
zk_ephemerals_count 0
zk_approximate_data_size27
zk_followers4   - only exposed by the Leader
zk_synced_followers 4   - only exposed by the Leader
zk_pending_syncs0   - only exposed by the Leader
zk_open_file_descriptor_count 23- only available on Unix platforms
zk_max_file_descriptor_count 1024   - only available on Unix platforms

The output is compatible with java properties format and the content may
change over time (new keys added). Your scripts should expect changes.

ATTENTION: Some of the keys are platform specific and some of the keys are
only exported by the Leader.

The output contains multiple lines with the following format:


On Mon, Jul 16, 2018 at 10:13 AM adrien ruffie 
wrote:

> Hello all,
>
>
> In my company we have a Zookeeper production cluster.
>
>
> But we don't really know how can we check the health of our cluster...
>
>
> Can we advise us about this topic ?
>
>
> I know this topic may has been cropping up for a while, but I don't really
> found any concrete solution.
>
>
> Do you use a monitoring tools ? Which can launch alert ?
>
> What metrics/properties/any thing which can indicate that our cluster
> isn't in good health.
>
>
> Thank you very much and best regards
>
>
> Adrien
>


ZooKeeper Cluster Health Checking

2018-07-16 Thread adrien ruffie
Hello all,


In my company we have a Zookeeper production cluster.


But we don't really know how can we check the health of our cluster...


Can we advise us about this topic ?


I know this topic may has been cropping up for a while, but I don't really 
found any concrete solution.


Do you use a monitoring tools ? Which can launch alert ?

What metrics/properties/any thing which can indicate that our cluster isn't in 
good health.


Thank you very much and best regards


Adrien


RE: zookeeper as systemd

2018-07-16 Thread adrien ruffie
Thank Norbert for this good explanation.

Yes I'm also a really lost here a bit ...

But it's a zookeeper production's cluster of 5 nodes.
It should be start instead start-foreground isn't it ? (with simple type)

De : Norbert Kalmar 
Envoyé : lundi 16 juillet 2018 13:49:16
À : user@zookeeper.apache.org
Objet : Re: zookeeper as systemd

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 
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 
> 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 
> 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

RE: zookeeper as systemd

2018-07-16 Thread adrien ruffie
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 
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 
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
>