[PATCH compass-ci] sparrow/7-systemd: fix failed to resume dnsmasq and es service

[why] when execute sparrow/4-docker/buildall reboot, error: ==================== es ======================= [2020-11-02T10:24:23,046][INFO ][o.e.n.Node ] [] initializing ... [2020-11-02T10:24:23,084][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/srv/es/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])? at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.3.jar:6.4.3] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.3.jar:6.4.3] =================== dnsmasq =================== dnsmasq: failed to bind DHCP server socket: Address in use because sometimes even if 'docker stop&&rm -f $container', there will still be a legacy process running, causing container to fail to start. [how] kill process before start container Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/7-systemd/cci-network | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sparrow/7-systemd/cci-network b/sparrow/7-systemd/cci-network index 6e59dbb..dfe7cc9 100755 --- a/sparrow/7-systemd/cci-network +++ b/sparrow/7-systemd/cci-network @@ -12,6 +12,9 @@ $CCI_SRC/sparrow/2-network/iptables $CCI_SRC/sparrow/2-network/nfs $CCI_SRC/sparrow/2-network/cifs +# fix failed to start container dnsmasq and es. +kill $(ps -ef| grep -E "dnsmasq|elasticsearch"| awk '{print $2}' ) 2> /dev/null + # --restart=always option is not absolutely reliable # container need to start its dependences firstly. $CCI_SRC/sparrow/4-docker/buildall reboot -- 2.23.0

On Mon, Nov 02, 2020 at 08:33:13PM +0800, Liu Yinsi wrote:
[why] when execute sparrow/4-docker/buildall reboot, error:
==================== es ======================= [2020-11-02T10:24:23,046][INFO ][o.e.n.Node ] [] initializing ... [2020-11-02T10:24:23,084][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/srv/es/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])? at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.3.jar:6.4.3] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.3.jar:6.4.3]
=================== dnsmasq =================== dnsmasq: failed to bind DHCP server socket: Address in use
because sometimes even if 'docker stop&&rm -f $container', there will still be a legacy process running,
Is there a clean solution from docker to kill its processes? Thanks, Fengguang
causing container to fail to start.
[how] kill process before start container
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/7-systemd/cci-network | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/sparrow/7-systemd/cci-network b/sparrow/7-systemd/cci-network index 6e59dbb..dfe7cc9 100755 --- a/sparrow/7-systemd/cci-network +++ b/sparrow/7-systemd/cci-network @@ -12,6 +12,9 @@ $CCI_SRC/sparrow/2-network/iptables $CCI_SRC/sparrow/2-network/nfs $CCI_SRC/sparrow/2-network/cifs
+# fix failed to start container dnsmasq and es. +kill $(ps -ef| grep -E "dnsmasq|elasticsearch"| awk '{print $2}' ) 2> /dev/null + # --restart=always option is not absolutely reliable # container need to start its dependences firstly. $CCI_SRC/sparrow/4-docker/buildall reboot -- 2.23.0
participants (2)
-
Liu Yinsi
-
Wu Fengguang