From 5a9420951269d6eb59035c71fec05a7b3df2e0a5 Mon Sep 17 00:00:00 2001 From: spacewander Date: Fri, 22 May 2020 18:14:19 +0800 Subject: [PATCH] bugfix: raise error when none of the configured etcd can be connected Close #1561. --- bin/apisix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/apisix b/bin/apisix index 506af065ddec..f2cee30056fd 100755 --- a/bin/apisix +++ b/bin/apisix @@ -768,6 +768,7 @@ local function init_etcd(show_output) local host_count = #(yaml_conf.etcd.host) + local etcd_ok = false for index, host in ipairs(yaml_conf.etcd.host) do local is_success = true @@ -799,9 +800,14 @@ local function init_etcd(show_output) end if is_success then + etcd_ok = true break end end + + if not etcd_ok then + error("none of the configured etcd works well") + end end _M.init_etcd = init_etcd