工具系列 | docker-apisix 安装记录

官方仓库:https://github.com/iresty/docker-apisix

官方仓库

拉取

git clone [email protected]:iresty/docker-apisix.git

安装 etcd 服务

1、拉去镜像

docker pull bitnami/etcd:3.3.13-r80

2、运行

docker run -it --name etcd-server \
-v /e/github/docker-apisix/example/etcd_conf/etcd.conf.yml:/opt/bitnami/etcd/conf/etcd.conf.yml \
-p 2379:2379 \
-p 2380:2380  \
--env ALLOW_NONE_AUTHENTICATION=yes \
-d bitnami/etcd:3.3.13-r80

3、进入容器查看是否已经开启v2协议

> docker exec -it etcd-server bash
$ etcd --help |grep enable-v2
usage: etcd [flags]
       start an etcd server

       etcd --version
       show the version of etcd

       etcd -h | --help
       show the help information about etcd

       etcd --config-file
       path to the server configuration file

       etcd gateway
       run the stateless pass-through etcd TCP connection forwarding proxy

       etcd grpc-proxy
       run the stateless etcd v3 gRPC L7 reverse proxy

        --enable-v2 'true'
        --experimental-enable-v2v3 ''

--enable-v2 'true' 表示已经开启v2协议。

原因:APISIX 目前仅支持 etcd 的 v2 协议存储,但最新版的 etcd (3.4 开始)已经默认关闭 v2 协议。 需要在启动参数中添加 --enable-v2=true,才能启用 v2 协议。  

安装 apisix 服务

使用官方镜像可能会超时,提示错误:request canceled (Client.Timeout exceeded while awaiting headers)

1、拉去镜像

docker pull registry.cn-beijing.aliyuncs.com/tinywan/apisix:alpine

2、运行服务

> docker run  --name tinywan-api-gateway  \
-v /e/GitHub/docker-apisix/example/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml \
-v /e/GitHub/docker-apisix/example/apisix_log:/usr/local/apisix/logs  \
-p 8080:9080 \
-p 8083:9443 registry.cn-beijing.aliyuncs.com/tinywan/apisix:alpine

 这里挂在配置文件和日志目录都是使用的绝对路径

windows 文件目录为

E:\GitHub\docker-apisix

 则挂在目录地址为

/e/GitHub/docker-apisix

控制台

APISIX 内置了 dashboard,使用浏览器打开 http://127.0.0.1:8080/apisix/dashboard/ 即可使用, 不用填写用户名和密码,直接登录  

猜你喜欢

转载自www.cnblogs.com/tinywan/p/11730034.html