Jay Taylor's notes

back to listing index

Exec Riak in the foreground instead of spawning in the background · Issue #13 · joukou/joukou-docker-riak

[web search]
Original source (github.com)
Tags: riak docker github.com
Clipped on: 2016-03-14

Skip to content

Exec Riak in the foreground instead of spawning in the background #13

Closed
superstructor opened this Issue on Sep 9, 2014 · 9 comments

Labels

Milestone

No milestone

Assignee

No one assigned

Notifications

You’re not receiving notifications from this thread.

2 participants

Image (Asset 2/7) alt= superstructor Image (Asset 3/7) alt= tazjin
Image (Asset 4/7) alt=

Pick your reaction

No description provided.

Image (Asset 6/7) alt=

Pick your reaction

@tazjin continuing the discussion from #11

First,  exec riak console  results in immediate failure of the container on docker run with exit code 138.

I needed to use the method from Hector Castro's repository to get it working which you can see here.

In testing and further thought there are a couple of significant problems with  exec... 

  •  riak start  properly manages its children; i.e. there are no "defunct" (aka zombie) processes. Whereas with  exec...  directly Riak leaves a lot of "defunct" processes running. e.g.
normalroot@8e913936a7ff:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
riak         1  0.0  0.1  19236  1804 ?        Ss   10:18   0:00 /usr/lib/riak/erts-5.10.3/bin/run_erl /tmp/riak /var/log/riak exec /usr/sbin/riak console
riak        19 11.6 23.2 25636712 237988 pts/0 Ssl+ 10:18   0:07 /usr/lib/riak/erts-5.10.3/bin/beam.smp -P 256000 -e 256000 -Q 65536 -A 64 -K true -W w -zdbbl 32768 -- -root /usr
riak        69  0.0  0.0      0     0 ?        Z    10:18   0:00 [inet_gethost] <defunct>
riak        72  0.0  0.0      0     0 ?        Zs   10:18   0:00 [epmd] <defunct>
riak        73  0.0  0.0  10848   108 ?        S    10:18   0:00 /usr/lib/riak/erts-5.10.3/bin/epmd -daemon
riak        74  0.0  0.0      0     0 ?        Zs   10:18   0:00 [inet_gethost] <defunct>
riak        75  0.0  0.0      0     0 ?        Z    10:18   0:00 [inet_gethost] <defunct>
riak        94  0.0  0.0      0     0 ?        Z    10:18   0:00 [inet_gethost] <defunct>
riak       113  0.0  0.0      0     0 ?        Z    10:18   0:00 [inet_gethost] <defunct>
riak       116  0.0  0.0      0     0 ?        Zs   10:18   0:00 [epmd] <defunct>
riak       118  0.0  0.0      0     0 ?        Z    10:18   0:00 [epmd] <defunct>
riak       126  0.0  0.0      0     0 ?        Zs   10:18   0:00 [epmd] <defunct>
riak       127  0.0  0.0      0     0 ?        Z    10:18   0:00 [epmd] <defunct>
riak       197  0.0  0.0   4192   460 ?        Ss   10:18   0:00 sh -s disksup
riak       198  0.1  0.1   4084  1296 ?        Ss   10:18   0:00 /usr/lib/riak/lib/os_mon-2.2.13/priv/bin/memsup
riak       199  0.0  0.0   4084   412 ?        Ss   10:18   0:00 /usr/lib/riak/lib/os_mon-2.2.13/priv/bin/cpu_sup
riak       299  5.0 12.4 875996 126888 ?       Ssl  10:18   0:03 /usr/bin/java -Djava.awt.headless=true -Djetty.home=/usr/lib/riak/lib/yokozuna-2.0.0-0-geb4919c/priv/solr -Djetty
riak       312  0.0  0.0  10812   544 ?        Ss   10:18   0:00 inet_gethost 4
riak       314  0.0  0.1  12908  1656 ?        S    10:18   0:00 inet_gethost 4
root       330  0.0  0.2  35664  2324 ?        S    10:18   0:00 su - root
root       331  0.0  0.2  17864  2720 ?        S    10:18   0:00 -su
root       337  0.0  0.1  15320  1896 ?        R+   10:19   0:00 ps aux
normal
  • Although I can do service announcement to etcd via a sidekick container, I don't see how I can do auto-clustering. i.e.  riak-admin cluster...  commands need to run inside this container after riak has started. It is not possible to run any commands after  exec...  as the shell no longer exists (it has been replaced by riak).
Image (Asset 7/7) alt=

Pick your reaction

What about running  riak start , checking cluster status and  exec ing  riak console  afterwards?

Pick your reaction

@tazjin that is a good idea.

The equivalent once riak has already been started is  riak attach  or  riak direct-attach .

I'll try that.

Pick your reaction

That's what I meant, sorry - I wrote that literally two minutes after waking up :)

Pick your reaction

Also just to mention it: The reason I want to have the console running is that we use systemd-journald to collect all the container logs and I don't want to fetch them out of log volumes etc.

Pick your reaction

That is a good reason, thanks for the insight. Do you think it needs to be  exec riak attach...  so it is directly monitored by systemd/docker or would riak attach running within the shell without  exec  be sufficient ?

Pick your reaction

Depends, do you still need the shell? Probably not

Pick your reaction

Tested the latest proposal of initially running  riak start  then  exec..  to attach to the Riak console.

This fixes the zombie processes. However the Riak console process does not respond to SIGINT / SIGTERM for proper shutdown. This is handled in the current version by Bash: https://github.com/joukou/joukou-docker-riak/blob/develop/bin/boot#L82

Pick your reaction

Closing as impractical.

superstructor removed the ready label on Sep 15, 2014

Attach files by dragging & dropping, selecting them, or pasting from the clipboard.