request help: config_etcd.lua has been consistently and frequently reporting errors
Issue description
After installing APISIX 2.0, the apisix/logs/error.log file shows that config_etcd.lua has been consistently and frequently reporting errors. The phenomenon still exists after reinstalling apisix and etcd without modifying any configuration during the period. Nearly 2,200 lines of error logs typed in nearly 20 minutes, similar to the following:
2020/11/10 20:18:30 [error] 31545#31545: *7224 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/plugin_metadata, context: ngx.timer
2020/11/10 20:18:30 [error] 31545#31545: *7226 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/proto, context: ngx.timer
2020/11/10 20:18:30 [error] 31545#31545: *7225 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/ssl, context: ngx.timer
2020/11/10 20:18:30 [error] 31545#31545: *7227 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/consumers, context: ngx.timer
2020/11/10 20:18:30 [error] 31545#31545: *7228 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/upstreams, context: ngx.timer
2020/11/10 20:18:30 [error] 31550#31550: *7229 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/services, context: ngx.timer
2020/11/10 20:18:30 [error] 31550#31550: *7232 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/proto, context: ngx.timer
2020/11/10 20:18:30 [error] 31550#31550: *7233 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/global_rules, context: ngx.timer
2020/11/10 20:18:30 [error] 31550#31550: *7231 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/upstreams, context: ngx.timer
2020/11/10 20:18:30 [error] 31550#31550: *7230 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/plugin_metadata, context: ngx.timer
Installation method
yum install -y apisix-2.0-0.el7.noarch.rpm
Environment
- apisix version (cmd:
apisix version): 2.0 - OS: CentOS Linux release 7.8.2003 (Core)
$ apisix version
2.0
$ etcd --version
etcd Version: 3.4.13
Git SHA: ae9734ed2
Go Version: go1.12.17
Go OS/Arch: linux/amd64
What should I do?
hi,does your etcd enable auth?
can you try to check etcd data like this?
etcdctl get --prefix "/apisix"
hi,does your etcd enable auth?
No configuration, a freshly installed state of etcd
can you try to check etcd data like this?
etcdctl get --prefix "/apisix"
No information was returned after execution😐😐
Can you try to run make init in the APISIX directory?
Can you try to run
make initin the APISIX directory?
No make command can be used.
$ pwd
/usr/local/apisix
$ ls
apisix client_body_temp conf deps fastcgi_temp logs proxy_temp scgi_temp uwsgi_temp
$ cd apisix/
$ pwd
/usr/local/apisix/apisix
$ ls
admin api_router.lua balancer balancer.lua consumer.lua core core.lua debug.lua discovery http init.lua plugin.lua plugins router.lua schema_def.lua script.lua ssl stream upstream.lua utils
No change after trying to execute apisix init and apisix init_etcd😔
$ apisix
Usage: apisix [action] <argument>
help: show this message, then exit
init: initialize the local nginx.conf
init_etcd: initialize the data of etcd
start: start the apisix server
stop: stop the apisix server
restart: restart the apisix server
reload: reload the apisix server
version: print the version of apisix
the same wrong can't work now on 2.0 apisix run in k8s & apache/apisix:latest docker image
but apisix-dashboard 2.0rc3 works well
./etcd --version etcd Version: 3.4.13 Git SHA: ae9734ed2 Go Version: go1.12.17 Go OS/Arch: linux/amd64
./etcdctl --endpoints=10.111.9.154:2379 get --prefix "/apisix"
/apisix/routes/328088132001988967
{"id":"328088132001988967","create_time":1605085365,"update_time":1605086330,"uris":["/*"],"name":"test-pre","methods":["GET","HEAD","POST","PUT","DELETE","OPTIONS","PATCH"],"hosts":["venice.test-pre.com"],"vars":[],"upstream":{"nodes":[{"host":"venice.test-pre.svc.cluster.local","port":80,"weight":1}],"timeout":{"connect":6000,"read":6000,"send":6000},"type":"roundrobin"}}```
/usr/local/apisix $ curl http://127.0.0.1:9080/apisix/admin/routes/328088132001988967 -H 'X-AP
I-KEY: edd1c9f034335f136f87ad84b625c8f1'
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>openresty</center>
</body>
</html>
/usr/local/apisix/logs $ tail -n 10 error.log
2020/11/11 17:57:00 [error] 26#26: *223005 [lua] config_etcd.lua:428: failed to fetch data from etcd: failed to read etcd dir, etcd key: /apisix/routes, context: ngx.timer
2020/11/11 17:57:07 [error] 32#32: *226586 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/core/etcd.lua:80: attempt to index field 'body' (a nil value)
stack traceback:
coroutine 0:
/usr/local/apisix/apisix/core/etcd.lua: in function 'get'
/usr/local/apisix/apisix/admin/routes.lua:166: in function </usr/local/apisix/apisix/admin/routes.lua:160>
/usr/local/apisix/apisix/admin/init.lua:146: in function 'handler'
/usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:730: in function 'dispatch'
/usr/local/apisix/apisix/init.lua:754: in function 'http_admin'
content_by_lua(nginx.conf:148):2: in main chunk, client: 127.0.0.1, server: , request: "GET /apisix/admin/routes/328088132001988967 HTTP/1.1", host: "127.0.0.1:9080"```
cc @gxthrj Do you have any idea?
by test just now, apisix2.0 will report error above when run wtih etcd-3.4.13 instead of etcd3.4.9 run ok
by test just now, apisix2.0 will report error above when run wtih etcd-3.4.13 instead of etcd3.4.9 run ok
@nic-chen please take a look
by test just now, apisix2.0 will report error above when run wtih etcd-3.4.13 instead of etcd3.4.9 run ok
@nic-chen please take a look
working on it.
@souzens
Thanks for feedback.
but it works fine on my env using etcd-3.4.13. could you please provide more details ? thanks.
@idbeta please help check. thanks
I also have this problem, and both versions of etcd3.4.13 and etcd 3.4.9 report errors
I also have this problem, and both versions of etcd3.4.13 and etcd 3.4.9 report errors
Thanks for feedback.
Could you provide the steps and config details ? thanks.
I also have this problem, and both versions of etcd3.4.13 and etcd 3.4.9 report errors
Thanks for feedback.
Could you provide the steps and config details ? thanks.
apisix2.0-alpine helm install etcd bitnami/etcd -n api-gateway --set auth.rbac.enabled=false --set image.tag=3.4.9
I have no name!@etcd-0:/opt/bitnami/etcd$ etcdctl get --prefix "/apisix"
/apisix/consumers/
init_dir
/apisix/global_rules/
init_dir
/apisix/node_status/
init_dir
/apisix/plugin_metadata/
init_dir
/apisix/plugins/
init_dir
/apisix/proto/
init_dir
/apisix/routes/
init_dir
/apisix/services/
init_dir
/apisix/ssl/
init_dir
/apisix/stream_routes/
init_dir
/apisix/upstreams/
init_dir
@ziyou434 Could you provides the options that used for etcd start.
@ziyou434 Could you provides the options that used for etcd start.
I use bitnami/etcd chart ,and --set auth.rbac.enabled=false. The chart use setup.sh to start etcd
setup.sh
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# Debug section
exec 3>&1
exec 4>&2
if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then
echo "==> Bash debug is on"
else
echo "==> Bash debug is off"
exec 1>/dev/null
exec 2>/dev/null
fi
# Constants
HOSTNAME="$(hostname -s)"
AUTH_OPTIONS=""
export ETCDCTL_ENDPOINTS="etcd-0.etcd-headless.api-gateway.svc.cluster.local:2380"
export ROOT_PASSWORD="${ETCD_ROOT_PASSWORD:-}"
if [[ -n "${ETCD_ROOT_PASSWORD:-}" ]]; then
unset ETCD_ROOT_PASSWORD
fi
# Functions
## Store member id for later member replacement
store_member_id() {
while ! etcdctl $AUTH_OPTIONS member list; do sleep 1; done
etcdctl $AUTH_OPTIONS member list | grep -w "$HOSTNAME" | awk '{ print $1}' | awk -F "," '{ print $1}' > "$ETCD_DATA_DIR/member_id"
echo "==> Stored member id: $(cat ${ETCD_DATA_DIR}/member_id)" 1>&3 2>&4
exit 0
}
## Configure RBAC
configure_rbac() {
# When there's more than one replica, we can assume the 1st member
# to be created is "etcd-0" since a statefulset is used
if [[ -n "${ROOT_PASSWORD:-}" ]] && [[ "$HOSTNAME" == "etcd-0" ]]; then
echo "==> Configuring RBAC authentication!" 1>&3 2>&4
etcd &
ETCD_PID=$!
while ! etcdctl $AUTH_OPTIONS member list; do sleep 1; done
echo "$ROOT_PASSWORD" | etcdctl $AUTH_OPTIONS user add root --interactive=false
etcdctl $AUTH_OPTIONS auth enable
kill "$ETCD_PID"
sleep 5
fi
}
## Checks whether there was a disaster or not
is_disastrous_failure() {
local endpoints_array=(${ETCDCTL_ENDPOINTS//,/ })
local active_endpoints=0
local -r min_endpoints=$(((1 + 1)/2))
for e in "${endpoints_array[@]}"; do
if [[ "$e" != "$ETCD_ADVERTISE_CLIENT_URLS" ]] && (unset -v ETCDCTL_ENDPOINTS; etcdctl $AUTH_OPTIONS endpoint health --endpoints="$e"); then
active_endpoints=$((active_endpoints + 1))
fi
done
if [[ $active_endpoints -lt $min_endpoints ]]; then
true
else
false
fi
}
## Check wether the member was succesfully removed from the cluster
should_add_new_member() {
return_value=0
if (grep -E "^Member[[:space:]]+[a-z0-9]+\s+removed\s+from\s+cluster\s+[a-z0-9]+$" "$(dirname "$ETCD_DATA_DIR")/member_removal.log") || \
! ([[ -d "$ETCD_DATA_DIR/member/snap" ]] && [[ -f "$ETCD_DATA_DIR/member_id" ]]); then
rm -rf $ETCD_DATA_DIR/* 1>&3 2>&4
else
return_value=1
fi
rm -f "$(dirname "$ETCD_DATA_DIR")/member_removal.log" 1>&3 2>&4
return $return_value
}
if [[ ! -d "$ETCD_DATA_DIR" ]]; then
echo "==> Creating data dir..." 1>&3 2>&4
echo "==> There is no data at all. Initializing a new member of the cluster..." 1>&3 2>&4
store_member_id & 1>&3 2>&4
configure_rbac
else
echo "==> Detected data from previous deployments..." 1>&3 2>&4
if [[ $(stat -c "%a" "$ETCD_DATA_DIR") != *700 ]]; then
echo "==> Setting data directory permissions to 700 in a recursive way (required in etcd >=3.4.10)" 1>&3 2>&4
chmod -R 700 $ETCD_DATA_DIR
else
echo "==> The data directory is already configured with the proper permissions" 1>&3 2>&4
fi
if [[ 1 -eq 1 ]]; then
echo "==> Single node cluster detected!!" 1>&3 2>&4
elif is_disastrous_failure; then
echo "==> Cluster not responding!!" 1>&3 2>&4
echo "==> Disaster recovery is disabled, the cluster will try to recover on it's own..." 1>&3 2>&4
elif should_add_new_member; then
echo "==> Adding new member to existing cluster..." 1>&3 2>&4
etcdctl $AUTH_OPTIONS member add "$HOSTNAME" --peer-urls="http://${HOSTNAME}.etcd-headless.api-gateway.svc.cluster.local:2380" | grep "^ETCD_" > "$ETCD_DATA_DIR/new_member_envs"
sed -ie "s/^/export /" "$ETCD_DATA_DIR/new_member_envs"
echo "==> Loading env vars of existing cluster..." 1>&3 2>&4
source "$ETCD_DATA_DIR/new_member_envs" 1>&3 2>&4
store_member_id & 1>&3 2>&4
else
echo "==> Updating member in existing cluster..." 1>&3 2>&4
etcdctl $AUTH_OPTIONS member update "$(cat "$ETCD_DATA_DIR/member_id")" --peer-urls="http://${HOSTNAME}.etcd-headless.api-gateway.svc.cluster.local:2380" 1>&3 2>&4
fi
fi
exec etcd 1>&3 2>&4
@ziyou434 Could you provides the options that used for etcd start.
I use bitnami/etcd chart ,and --set auth.rbac.enabled=false. The chart use setup.sh to start etcd
setup.sh
#!/bin/bash set -o errexit set -o pipefail set -o nounset # Debug section exec 3>&1 exec 4>&2 if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then echo "==> Bash debug is on" else echo "==> Bash debug is off" exec 1>/dev/null exec 2>/dev/null fi # Constants HOSTNAME="$(hostname -s)" AUTH_OPTIONS="" export ETCDCTL_ENDPOINTS="etcd-0.etcd-headless.api-gateway.svc.cluster.local:2380" export ROOT_PASSWORD="${ETCD_ROOT_PASSWORD:-}" if [[ -n "${ETCD_ROOT_PASSWORD:-}" ]]; then unset ETCD_ROOT_PASSWORD fi # Functions ## Store member id for later member replacement store_member_id() { while ! etcdctl $AUTH_OPTIONS member list; do sleep 1; done etcdctl $AUTH_OPTIONS member list | grep -w "$HOSTNAME" | awk '{ print $1}' | awk -F "," '{ print $1}' > "$ETCD_DATA_DIR/member_id" echo "==> Stored member id: $(cat ${ETCD_DATA_DIR}/member_id)" 1>&3 2>&4 exit 0 } ## Configure RBAC configure_rbac() { # When there's more than one replica, we can assume the 1st member # to be created is "etcd-0" since a statefulset is used if [[ -n "${ROOT_PASSWORD:-}" ]] && [[ "$HOSTNAME" == "etcd-0" ]]; then echo "==> Configuring RBAC authentication!" 1>&3 2>&4 etcd & ETCD_PID=$! while ! etcdctl $AUTH_OPTIONS member list; do sleep 1; done echo "$ROOT_PASSWORD" | etcdctl $AUTH_OPTIONS user add root --interactive=false etcdctl $AUTH_OPTIONS auth enable kill "$ETCD_PID" sleep 5 fi } ## Checks whether there was a disaster or not is_disastrous_failure() { local endpoints_array=(${ETCDCTL_ENDPOINTS//,/ }) local active_endpoints=0 local -r min_endpoints=$(((1 + 1)/2)) for e in "${endpoints_array[@]}"; do if [[ "$e" != "$ETCD_ADVERTISE_CLIENT_URLS" ]] && (unset -v ETCDCTL_ENDPOINTS; etcdctl $AUTH_OPTIONS endpoint health --endpoints="$e"); then active_endpoints=$((active_endpoints + 1)) fi done if [[ $active_endpoints -lt $min_endpoints ]]; then true else false fi } ## Check wether the member was succesfully removed from the cluster should_add_new_member() { return_value=0 if (grep -E "^Member[[:space:]]+[a-z0-9]+\s+removed\s+from\s+cluster\s+[a-z0-9]+$" "$(dirname "$ETCD_DATA_DIR")/member_removal.log") || \ ! ([[ -d "$ETCD_DATA_DIR/member/snap" ]] && [[ -f "$ETCD_DATA_DIR/member_id" ]]); then rm -rf $ETCD_DATA_DIR/* 1>&3 2>&4 else return_value=1 fi rm -f "$(dirname "$ETCD_DATA_DIR")/member_removal.log" 1>&3 2>&4 return $return_value } if [[ ! -d "$ETCD_DATA_DIR" ]]; then echo "==> Creating data dir..." 1>&3 2>&4 echo "==> There is no data at all. Initializing a new member of the cluster..." 1>&3 2>&4 store_member_id & 1>&3 2>&4 configure_rbac else echo "==> Detected data from previous deployments..." 1>&3 2>&4 if [[ $(stat -c "%a" "$ETCD_DATA_DIR") != *700 ]]; then echo "==> Setting data directory permissions to 700 in a recursive way (required in etcd >=3.4.10)" 1>&3 2>&4 chmod -R 700 $ETCD_DATA_DIR else echo "==> The data directory is already configured with the proper permissions" 1>&3 2>&4 fi if [[ 1 -eq 1 ]]; then echo "==> Single node cluster detected!!" 1>&3 2>&4 elif is_disastrous_failure; then echo "==> Cluster not responding!!" 1>&3 2>&4 echo "==> Disaster recovery is disabled, the cluster will try to recover on it's own..." 1>&3 2>&4 elif should_add_new_member; then echo "==> Adding new member to existing cluster..." 1>&3 2>&4 etcdctl $AUTH_OPTIONS member add "$HOSTNAME" --peer-urls="http://${HOSTNAME}.etcd-headless.api-gateway.svc.cluster.local:2380" | grep "^ETCD_" > "$ETCD_DATA_DIR/new_member_envs" sed -ie "s/^/export /" "$ETCD_DATA_DIR/new_member_envs" echo "==> Loading env vars of existing cluster..." 1>&3 2>&4 source "$ETCD_DATA_DIR/new_member_envs" 1>&3 2>&4 store_member_id & 1>&3 2>&4 else echo "==> Updating member in existing cluster..." 1>&3 2>&4 etcdctl $AUTH_OPTIONS member update "$(cat "$ETCD_DATA_DIR/member_id")" --peer-urls="http://${HOSTNAME}.etcd-headless.api-gateway.svc.cluster.local:2380" 1>&3 2>&4 fi fi exec etcd 1>&3 2>&4
The start up script seems normal, could you paste some etcd logs?
@ziyou434 Could you provides the options that used for etcd start.
I use bitnami/etcd chart ,and --set auth.rbac.enabled=false. The chart use setup.sh to start etcd setup.sh
#!/bin/bash set -o errexit set -o pipefail set -o nounset # Debug section exec 3>&1 exec 4>&2 if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then echo "==> Bash debug is on" else echo "==> Bash debug is off" exec 1>/dev/null exec 2>/dev/null fi # Constants HOSTNAME="$(hostname -s)" AUTH_OPTIONS="" export ETCDCTL_ENDPOINTS="etcd-0.etcd-headless.api-gateway.svc.cluster.local:2380" export ROOT_PASSWORD="${ETCD_ROOT_PASSWORD:-}" if [[ -n "${ETCD_ROOT_PASSWORD:-}" ]]; then unset ETCD_ROOT_PASSWORD fi # Functions ## Store member id for later member replacement store_member_id() { while ! etcdctl $AUTH_OPTIONS member list; do sleep 1; done etcdctl $AUTH_OPTIONS member list | grep -w "$HOSTNAME" | awk '{ print $1}' | awk -F "," '{ print $1}' > "$ETCD_DATA_DIR/member_id" echo "==> Stored member id: $(cat ${ETCD_DATA_DIR}/member_id)" 1>&3 2>&4 exit 0 } ## Configure RBAC configure_rbac() { # When there's more than one replica, we can assume the 1st member # to be created is "etcd-0" since a statefulset is used if [[ -n "${ROOT_PASSWORD:-}" ]] && [[ "$HOSTNAME" == "etcd-0" ]]; then echo "==> Configuring RBAC authentication!" 1>&3 2>&4 etcd & ETCD_PID=$! while ! etcdctl $AUTH_OPTIONS member list; do sleep 1; done echo "$ROOT_PASSWORD" | etcdctl $AUTH_OPTIONS user add root --interactive=false etcdctl $AUTH_OPTIONS auth enable kill "$ETCD_PID" sleep 5 fi } ## Checks whether there was a disaster or not is_disastrous_failure() { local endpoints_array=(${ETCDCTL_ENDPOINTS//,/ }) local active_endpoints=0 local -r min_endpoints=$(((1 + 1)/2)) for e in "${endpoints_array[@]}"; do if [[ "$e" != "$ETCD_ADVERTISE_CLIENT_URLS" ]] && (unset -v ETCDCTL_ENDPOINTS; etcdctl $AUTH_OPTIONS endpoint health --endpoints="$e"); then active_endpoints=$((active_endpoints + 1)) fi done if [[ $active_endpoints -lt $min_endpoints ]]; then true else false fi } ## Check wether the member was succesfully removed from the cluster should_add_new_member() { return_value=0 if (grep -E "^Member[[:space:]]+[a-z0-9]+\s+removed\s+from\s+cluster\s+[a-z0-9]+$" "$(dirname "$ETCD_DATA_DIR")/member_removal.log") || \ ! ([[ -d "$ETCD_DATA_DIR/member/snap" ]] && [[ -f "$ETCD_DATA_DIR/member_id" ]]); then rm -rf $ETCD_DATA_DIR/* 1>&3 2>&4 else return_value=1 fi rm -f "$(dirname "$ETCD_DATA_DIR")/member_removal.log" 1>&3 2>&4 return $return_value } if [[ ! -d "$ETCD_DATA_DIR" ]]; then echo "==> Creating data dir..." 1>&3 2>&4 echo "==> There is no data at all. Initializing a new member of the cluster..." 1>&3 2>&4 store_member_id & 1>&3 2>&4 configure_rbac else echo "==> Detected data from previous deployments..." 1>&3 2>&4 if [[ $(stat -c "%a" "$ETCD_DATA_DIR") != *700 ]]; then echo "==> Setting data directory permissions to 700 in a recursive way (required in etcd >=3.4.10)" 1>&3 2>&4 chmod -R 700 $ETCD_DATA_DIR else echo "==> The data directory is already configured with the proper permissions" 1>&3 2>&4 fi if [[ 1 -eq 1 ]]; then echo "==> Single node cluster detected!!" 1>&3 2>&4 elif is_disastrous_failure; then echo "==> Cluster not responding!!" 1>&3 2>&4 echo "==> Disaster recovery is disabled, the cluster will try to recover on it's own..." 1>&3 2>&4 elif should_add_new_member; then echo "==> Adding new member to existing cluster..." 1>&3 2>&4 etcdctl $AUTH_OPTIONS member add "$HOSTNAME" --peer-urls="http://${HOSTNAME}.etcd-headless.api-gateway.svc.cluster.local:2380" | grep "^ETCD_" > "$ETCD_DATA_DIR/new_member_envs" sed -ie "s/^/export /" "$ETCD_DATA_DIR/new_member_envs" echo "==> Loading env vars of existing cluster..." 1>&3 2>&4 source "$ETCD_DATA_DIR/new_member_envs" 1>&3 2>&4 store_member_id & 1>&3 2>&4 else echo "==> Updating member in existing cluster..." 1>&3 2>&4 etcdctl $AUTH_OPTIONS member update "$(cat "$ETCD_DATA_DIR/member_id")" --peer-urls="http://${HOSTNAME}.etcd-headless.api-gateway.svc.cluster.local:2380" 1>&3 2>&4 fi fi exec etcd 1>&3 2>&4The start up script seems normal, could you paste some etcd logs?
sure.
2020-11-12 03:02:10.270824 I | pkg/flags: recognized and used environment variable ETCD_ADVERTISE_CLIENT_URLS=http://etcd-0.etcd-headless.api-gateway.svc.cluster.local:2379 2020-11-12 03:02:10.270943 I | pkg/flags: recognized and used environment variable ETCD_DATA_DIR=/bitnami/etcd/data 2020-11-12 03:02:10.271003 I | pkg/flags: recognized and used environment variable ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd-0.etcd-headless.api-gateway.svc.cluster.local:2380 2020-11-12 03:02:10.271030 I | pkg/flags: recognized and used environment variable ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 2020-11-12 03:02:10.271049 I | pkg/flags: recognized and used environment variable ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 2020-11-12 03:02:10.271073 I | pkg/flags: recognized and used environment variable ETCD_NAME=etcd-0 2020-11-12 03:02:10.271194 W | pkg/flags: unrecognized environment variable ETCD_SERVICE_HOST=172.20.199.58 2020-11-12 03:02:10.271210 W | pkg/flags: unrecognized environment variable ETCD_PORT_2380_TCP_ADDR=172.20.199.58 2020-11-12 03:02:10.271222 W | pkg/flags: unrecognized environment variable ETCD_PORT_2379_TCP=tcp://172.20.199.58:2379 2020-11-12 03:02:10.271241 W | pkg/flags: unrecognized environment variable ETCD_PORT_2380_TCP_PROTO=tcp 2020-11-12 03:02:10.271254 W | pkg/flags: unrecognized environment variable ETCD_PORT_2379_TCP_PORT=2379 2020-11-12 03:02:10.271262 W | pkg/flags: unrecognized environment variable ETCD_PORT_2379_TCP_ADDR=172.20.199.58 2020-11-12 03:02:10.271273 W | pkg/flags: unrecognized environment variable ETCD_PORT_2380_TCP_PORT=2380 2020-11-12 03:02:10.271287 W | pkg/flags: unrecognized environment variable ETCD_PORT_2380_TCP=tcp://172.20.199.58:2380 2020-11-12 03:02:10.271309 W | pkg/flags: unrecognized environment variable ETCD_SERVICE_PORT_CLIENT=2379 2020-11-12 03:02:10.271323 W | pkg/flags: unrecognized environment variable ETCD_SERVICE_PORT_PEER=2380 2020-11-12 03:02:10.271335 W | pkg/flags: unrecognized environment variable ETCD_PORT_2379_TCP_PROTO=tcp 2020-11-12 03:02:10.271350 W | pkg/flags: unrecognized environment variable ETCD_PORT=tcp://172.20.199.58:2379 2020-11-12 03:02:10.271361 W | pkg/flags: unrecognized environment variable ETCD_SERVICE_PORT=2379 [WARNING] Deprecated '--logger=capnslog' flag is set; use '--logger=zap' flag instead 2020-11-12 03:02:10.271400 I | etcdmain: etcd Version: 3.4.9 2020-11-12 03:02:10.271413 I | etcdmain: Git SHA: 54ba95891 2020-11-12 03:02:10.271423 I | etcdmain: Go Version: go1.12.17 2020-11-12 03:02:10.271429 I | etcdmain: Go OS/Arch: linux/amd64 2020-11-12 03:02:10.271439 I | etcdmain: setting maximum number of CPUs to 2, total number of available CPUs is 2 2020-11-12 03:02:10.271522 W | etcdmain: found invalid file/dir member_id under data dir /bitnami/etcd/data (Ignore this if you are upgrading etcd) 2020-11-12 03:02:10.271540 N | etcdmain: the server is already initialized as member before, starting as etcd member... [WARNING] Deprecated '--logger=capnslog' flag is set; use '--logger=zap' flag instead 2020-11-12 03:02:10.271813 I | embed: name = etcd-0 2020-11-12 03:02:10.271836 I | embed: data dir = /bitnami/etcd/data 2020-11-12 03:02:10.271847 I | embed: member dir = /bitnami/etcd/data/member 2020-11-12 03:02:10.271859 I | embed: heartbeat = 100ms 2020-11-12 03:02:10.271865 I | embed: election = 1000ms 2020-11-12 03:02:10.271881 I | embed: snapshot count = 100000 2020-11-12 03:02:10.271895 I | embed: advertise client URLs = http://etcd-0.etcd-headless.api-gateway.svc.cluster.local:2379 2020-11-12 03:02:10.271908 I | embed: initial advertise peer URLs = http://etcd-0.etcd-headless.api-gateway.svc.cluster.local:2380 2020-11-12 03:02:10.271920 I | embed: initial cluster = 2020-11-12 03:02:10.276156 I | etcdserver: restarting member 8ecb0b7cde5e4235 in cluster 2b0eb2956f410bc1 at commit index 107 raft2020/11/12 03:02:10 INFO: 8ecb0b7cde5e4235 switched to configuration voters=() raft2020/11/12 03:02:10 INFO: 8ecb0b7cde5e4235 became follower at term 4 raft2020/11/12 03:02:10 INFO: newRaft 8ecb0b7cde5e4235 [peers: [], term: 4, commit: 107, applied: 0, lastindex: 107, lastterm: 4] 2020-11-12 03:02:10.279984 W | auth: simple token is not cryptographically signed 2020-11-12 03:02:10.283770 I | etcdserver: starting server... [version: 3.4.9, cluster version: to_be_decided] raft2020/11/12 03:02:10 INFO: 8ecb0b7cde5e4235 switched to configuration voters=(10289330404592599605) 2020-11-12 03:02:10.284749 I | etcdserver/membership: added member 8ecb0b7cde5e4235 [http://etcd-0.etcd-headless.api-gateway.svc.cluster.local:2380] to cluster 2b0eb2956f410bc1 2020-11-12 03:02:10.285151 N | etcdserver/membership: set the initial cluster version to 3.4 2020-11-12 03:02:10.285318 I | etcdserver/api: enabled capabilities for version 3.4 2020-11-12 03:02:10.287927 I | embed: listening for peers on [::]:2380 raft2020/11/12 03:02:11 INFO: 8ecb0b7cde5e4235 is starting a new election at term 4 raft2020/11/12 03:02:11 INFO: 8ecb0b7cde5e4235 became candidate at term 5 raft2020/11/12 03:02:11 INFO: 8ecb0b7cde5e4235 received MsgVoteResp from 8ecb0b7cde5e4235 at term 5 raft2020/11/12 03:02:11 INFO: 8ecb0b7cde5e4235 became leader at term 5 raft2020/11/12 03:02:11 INFO: raft.node: 8ecb0b7cde5e4235 elected leader 8ecb0b7cde5e4235 at term 5 2020-11-12 03:02:11.477491 I | etcdserver: published {Name:etcd-0 ClientURLs:[http://etcd-0.etcd-headless.api-gateway.svc.cluster.local:2379]} to cluster 2b0eb2956f410bc1 2020-11-12 03:02:11.477626 I | embed: ready to serve client requests 2020-11-12 03:02:11.478714 N | embed: serving insecure client requests on [::]:2379, this is strongly discouraged!
@souzens
Thanks for feedback.
but it works fine on my env using
etcd-3.4.13. could you please provide more details ? thanks.@idbeta please help check. thanks
you deployed etcd in single mode or cluster mode?
i tested that apisix2.0 works ok in etcd single mode..
nohup /home/admin/etcd-v3.4.9-linux-amd64/etcd --data-dir /home/admin/etcd/data --listen-client-urls http://10.111.9.155:2379 --advertise-client-urls http://10.111.9.155:2379 >> /home/admin/etcd.log 2>&1 &
but in cluster mode will report errors
etcd.conf
name: [email protected]
data-dir: /home/admin/etcd/data
listen-peer-urls: http://10.111.9.155:2380
listen-client-urls: http://10.111.9.155:2379
advertise-client-urls: http://10.111.9.155:2379
listen-peer-urls: http://10.111.9.155:2380
initial-advertise-peer-urls: http://10.111.9.155:2380
initial-cluster-token: etcd-cluster-token
initial-cluster-state: new
initial-cluster: [email protected]=http://10.111.9.154:2380,[email protected]=http://10.111.21.245:2380,[email protected]=http://10.111.9.155:2380