You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2020/10/04 11:16:11 UTC

[apisix] branch master updated: doc: update etcd installation step for v3.4 (#2346)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new c228675  doc: update etcd installation step for v3.4 (#2346)
c228675 is described below

commit c228675a81f2ecbeca8b9897f0b7b83c8a22a485
Author: Shuyang Wu <wo...@gmail.com>
AuthorDate: Sun Oct 4 19:15:58 2020 +0800

    doc: update etcd installation step for v3.4 (#2346)
---
 README.md                         |  9 +++----
 README_CN.md                      |  9 +++----
 bin/apisix                        | 14 +++++------
 doc/install-dependencies.md       | 50 ++++++++++++++++++++++++---------------
 doc/zh-cn/install-dependencies.md |  6 +----
 5 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/README.md b/README.md
index d26056e..c856505 100644
--- a/README.md
+++ b/README.md
@@ -139,7 +139,7 @@ There are several ways to install the Apache Release version of APISIX:
         ```shell
         ./bin/apisix version
         ```
-    - start APISIX (Please make sure that etcd is started and enabled the v2 protocol):
+    - start APISIX:
         ```shell
         ./bin/apisix start
         ```
@@ -163,15 +163,12 @@ There are several ways to install the Apache Release version of APISIX:
         ```shell
         apisix version
         ```
-    - start APISIX (Please make sure that etcd is started and enabled the v2 protocol):
+    - start APISIX:
         ```shell
         apisix start
         ```
 
-**Note**: Apache APISIX would not support the v2 protocol of etcd anymore since APISIX v2.0, so you need to enable v3 protocol when starting etcd, if etcd version is below v3.4.
-```shell
-export ETCDCTL_API=3
-```
+**Note**: Apache APISIX would not support the v2 protocol of etcd anymore since APISIX v2.0, and the minimum etcd version supported is v3.4.0. Please update etcd when needed. If you need to migrate your data from etcd v2 to v3, please follow [etcd migration guide](https://etcd.io/docs/v3.4.0/op-guide/v2-migration/).
 
 ## For Developer
 
diff --git a/README_CN.md b/README_CN.md
index 0f44e46..829633f 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -138,7 +138,7 @@ CentOS 7, Ubuntu 16.04, Ubuntu 18.04, Debian 9, Debian 10, macOS, **ARM64** Ubun
         ```shell
         ./bin/apisix version
         ```
-    - 启动 APISIX (请先确保已经启动了 etcd,并打开了 v2 协议):
+    - 启动 APISIX:
         ```shell
         ./bin/apisix start
         ```
@@ -162,15 +162,12 @@ CentOS 7, Ubuntu 16.04, Ubuntu 18.04, Debian 9, Debian 10, macOS, **ARM64** Ubun
         ```shell
         apisix version
         ```
-    - 启动 APISIX (请先确保已经启动了 etcd,并打开了 v2 协议):
+    - 启动 APISIX:
         ```shell
         apisix start
         ```
 
-**注意**:Apache APISIX 从 v2.0 开始不再支持 etcd v2 协议,如果 etcd 版本低于 v3.4,启动 etcd 时需要开启 v3 协议的支持。
-```shell
-export ETCDCTL_API=3
-```
+**注意**:Apache APISIX 从 v2.0 开始不再支持 etcd v2 协议,并且 etcd 最低支持版本为 v3.4.0,如果有需要请进行升级。如果需要将数据迁移至 etcd v3,请按照 [etcd 迁移指南](https://etcd.io/docs/v3.4.0/op-guide/v2-migration/) 进行迁移。
 
 ## 针对开发者
 
diff --git a/bin/apisix b/bin/apisix
index 42309f3..32519a6 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -993,24 +993,24 @@ local function init_etcd(show_output)
         uri = host .. "/version"
         local cmd = string.format("curl -s -m %d %s", timeout * 2, uri)
         local res = execute_cmd(cmd)
-        local errmsg = string.format("got malformed version message: \"%s\" from etcd", res)
+        local errmsg = string.format("got malformed version message: \"%s\" from etcd\n", res)
         local body, _, err = dkjson.decode(res)
         if err then
             io.stderr:write(errmsg)
-            return
+            os.exit(1)
         end
 
         local cluster_version = body["etcdcluster"]
         if not cluster_version then
             io.stderr:write(errmsg)
-            return
+            os.exit(1)
         end
 
         if compare_semantic_version(cluster_version, min_etcd_version) then
-            io.stderr:write("etcd cluster version ", cluster_version,
-                            " is less than the required version ", min_etcd_version,
-                            ", please upgrade your etcd cluster")
-            return
+            io.stderr:write("etcd cluster version ".. cluster_version ..
+                            " is less than the required version ".. min_etcd_version ..
+                            ", please upgrade your etcd cluster\n")
+            os.exit(1)
         end
 
         break
diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md
index 99ec723..827d698 100644
--- a/doc/install-dependencies.md
+++ b/doc/install-dependencies.md
@@ -28,13 +28,7 @@
 
 Note
 ====
-- Apache APISIX would not support the v2 protocol storage to etcd anymore. If etcd version is below 3.4, the default protocol is still v2 and you need to turn on v3 protocol mannually.
-
-You need to add `ETCDCTL_API=3` to the environmental variables to enable the v3 protocol.
-
-```shell
-export ETCDCTL_API=3
-```
+- Since v2.0 Apache APISIX would not support the v2 protocol storage to etcd anymore, and the minimum etcd version supported is v3.4.0.
 
 - If you want use Tengine instead of OpenResty, please take a look at this installation step script [Install Tengine at Ubuntu](../.travis/linux_tengine_runner.sh).
 
@@ -47,15 +41,21 @@ CentOS 7
 wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 sudo rpm -ivh epel-release-latest-7.noarch.rpm
 
+# install etcd
+wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
+tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
+    cd etcd-v3.4.13-linux-amd64 && \
+    sudo cp -a etcd etcdctl /usr/bin/
+
 # add OpenResty source
 sudo yum install yum-utils
 sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
 
-# install OpenResty, etcd and some compilation tools
-sudo yum install -y etcd openresty curl git gcc luarocks lua-devel
+# install OpenResty and some compilation tools
+sudo yum install -y openresty curl git gcc luarocks lua-devel
 
 # start etcd server
-sudo service etcd start
+nohup etcd &
 ```
 
 Fedora 31 & 32
@@ -66,11 +66,17 @@ Fedora 31 & 32
 sudo yum install yum-utils
 sudo yum-config-manager --add-repo https://openresty.org/package/fedora/openresty.repo
 
-# install OpenResty, etcd and some compilation tools
-sudo yum install -y etcd openresty curl git gcc luarocks lua-devel
+# install etcd
+wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
+tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
+    cd etcd-v3.4.13-linux-amd64 && \
+    sudo cp -a etcd etcdctl /usr/bin/
+
+# install OpenResty and some compilation tools
+sudo yum install -y openresty curl git gcc luarocks lua-devel
 
 # start etcd server
-sudo etcd &
+nohup etcd &
 ```
 
 Ubuntu 16.04 & 18.04
@@ -84,11 +90,17 @@ sudo apt-get -y install software-properties-common
 sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
 sudo apt-get update
 
-# install OpenResty, etcd and some compilation tools
-sudo apt-get install -y git etcd openresty curl luarocks
+# install etcd
+wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
+tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
+    cd etcd-v3.4.13-linux-amd64 && \
+    sudo cp -a etcd etcdctl /usr/bin/
+
+# install OpenResty and some compilation tools
+sudo apt-get install -y git openresty curl luarocks
 
 # start etcd server
-sudo service etcd start
+nohup etcd &
 ```
 
 Debian 9 & 10
@@ -108,9 +120,9 @@ sudo add-apt-repository -y "deb http://openresty.org/package/debian $(lsb_releas
 sudo apt-get update
 
 # install etcd
-wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz
-tar -xvf etcd-v3.3.13-linux-amd64.tar.gz && \
-    cd etcd-v3.3.13-linux-amd64 && \
+wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
+tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
+    cd etcd-v3.4.13-linux-amd64 && \
     sudo cp -a etcd etcdctl /usr/bin/
 
 # install OpenResty and some compilation tools
diff --git a/doc/zh-cn/install-dependencies.md b/doc/zh-cn/install-dependencies.md
index 967c429..63a569a 100644
--- a/doc/zh-cn/install-dependencies.md
+++ b/doc/zh-cn/install-dependencies.md
@@ -27,11 +27,7 @@
 
 注意
 ====
-- Apache APISIX 不再支持 `v2` 版本的 etcd。在 etcd 版本低于 3.4 时,默认 API 协议仍为 v2,因此需要添加 `ETCDCTL_API=3` 至环境变量以启动 v3 协议。
-
-```shell
-export ETCDCTL_API=3
-```
+- Apache APISIX 从 v2.0 开始不再支持 `v2` 版本的 etcd,并且 etcd 最低支持版本为 v3.4.0。
 
 - 如果你要想使用 Tengine 替代 OpenResty,请参考 [Install Tengine at Ubuntu](../../.travis/linux_tengine_runner.sh)。