before: es/logging-es startup time is 60s after: es/logging-es startup time is 10s
[how] check es ready or not every 2s, if ok, just set index, rather than sleep 60s.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- container/defconfig.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/container/defconfig.sh b/container/defconfig.sh index c33a790..ee66ea5 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -28,9 +28,18 @@ docker_rm() docker rm -f $container }
-set_es_indices() +check_es_ready() { - find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ; + port=$1 + for num in {1..30} + do + curl -s localhost:$port > /dev/null + if [ $? == "0" ]; then + break + else + sleep 2 + fi + done }
push_image()
On Wed, Feb 24, 2021 at 08:20:13PM +0800, Liu Yinsi wrote:
before: es/logging-es startup time is 60s after: es/logging-es startup time is 10s
[how] check es ready or not every 2s, if ok, just set index, rather than sleep 60s.
Signed-off-by: Liu Yinsi liuyinsi@163.com
container/defconfig.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/container/defconfig.sh b/container/defconfig.sh index c33a790..ee66ea5 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -28,9 +28,18 @@ docker_rm() docker rm -f $container }
-set_es_indices() +check_es_ready() {
- find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ;
- port=$1
delete it.
- for num in {1..30}
- do
curl -s localhost:$port > /dev/null
curl -s localhost:$1 > /dev/null
Thanks, Chenglong
if [ $? == "0" ]; then
break
else
sleep 2
fi
- done
}
push_image()
2.23.0
{
- find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ;
- port=$1
delete it.
ok
- for num in {1..30}
- do
curl -s localhost:$port > /dev/null
curl -s localhost:$1 > /dev/null
ok Thanks, Yinsi
Thanks, Chenglong
if [ $? == "0" ]; then
break
else
sleep 2
fi
- done
}
push_image()
2.23.0
}
-set_es_indices() +check_es_ready() {
- find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ;
- port=$1
- for num in {1..30}
no need so many times,
- do
curl -s localhost:$port > /dev/null
if [ $? == "0" ]; then
break
how about use return?
Thanks, Luan Shengde
else
sleep 2
fi
- done
}
push_image()
2.23.0
{
- find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ;
- port=$1
- for num in {1..30}
no need so many times,
make sure enough times.
- do
curl -s localhost:$port > /dev/null
if [ $? == "0" ]; then
break
how about use return?
it looks like uncessary
Thanks, Yinsi
Thanks, Luan Shengde
else
sleep 2
fi
- done
}
push_image()
2.23.0
On Wed, Feb 24, 2021 at 08:20:13PM +0800, Liu Yinsi wrote:
before: es/logging-es startup time is 60s after: es/logging-es startup time is 10s
[how] check es ready or not every 2s, if ok, just set index, rather than sleep 60s.
Signed-off-by: Liu Yinsi liuyinsi@163.com
container/defconfig.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/container/defconfig.sh b/container/defconfig.sh index c33a790..ee66ea5 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -28,9 +28,18 @@ docker_rm() docker rm -f $container }
-set_es_indices() +check_es_ready()
check_es_ready() => wait_es_ready()
{
- find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ;
- port=$1
local i
for i in ...
- for num in {1..30}
- do
curl -s localhost:$port > /dev/null
if [ $? == "0" ]; then
break
else
sleep 2
fi
=> sleep 2 curl ... && return
- done
What if ES still not up? exit here?
Thanks, Fengguang
}
push_image()
2.23.0
check_es_ready() => wait_es_ready()
ok
{
- find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ;
- port=$1
local i
for i in ...
ok
- for num in {1..30}
- do
curl -s localhost:$port > /dev/null
if [ $? == "0" ]; then
break
else
sleep 2
fi
=> sleep 2 curl ... && return
good
- done
What if ES still not up? exit here?
if exit at here, 4-docker/buildall also exit, is that OK?
Thanks, Yinsi
Thanks, Fengguang
}
push_image()
2.23.0