centos7.9 apisix搭建服务apisix-dashboard安装

2022年7月5日13:34:21

注意:这里还需要注意版本的问题,建议使用比较新的版本,不然会出现api不兼容问题

官方文档:https://apisix.apache.org/zh/docs/apisix/how-to-build

vi /etc/profile
加入一行
ulimit -SHn 65536

source /etc/profile
再次查看ulimit
ulimit -n

该安装方法适用于 CentOS 7 和 CentOS 8。如果你选择该方法安装 APISIX,需要先安装 etcd。具体安装方法请参考安装 etcd。

通过 RPM 仓库安装
如果当前系统没有安装 OpenResty,请使用以下命令来安装 OpenResty 和 APISIX 仓库:
sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm

如果已安装 OpenResty 的官方 RPM 仓库,请使用以下命令安装 APISIX 的 RPM 仓库:
sudo yum-config-manager --add-repo https://repos.apiseven.com/packages/centos/apache-apisix.repo

完成上述操作后使用以下命令安装 APISIX:
sudo yum install apisix

TIP:
你也可以安装指定版本的 APISIX(本示例为 APISIX v2.13.1 LTS 版本):
sudo yum install apisix-2.13.1


apisix操作命令
# 运行以下命令初始化 NGINX 配置文件和 etcd. initialize NGINX config file and etcd
$ apisix init
 
# generate `nginx.conf` from `config.yaml` and test it
$ apisix test
 
# 启动 Apache APISIX. start Apache APISIX server
$ apisix start
 
# 其他命令
# 优雅停机 stop Apache APISIX server gracefully
$ apisix quit
 
# 强制停机 stop Apache APISIX server immediately
$ apisix stop
 
# 其他操作 more actions find by `help`
$ apisix help

rpm包的安装,就可以按照正常的方式操作

systemctl start apisix
systemctl stop apisix
systemctl status apisix


/usr/local/openresty/luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua start
etcd cluster version 3.3.0 is less than the required version 3.4.0, please upgrade your etcd cluster

安装etcd
https://ghproxy.com/ github代理下载
wget https://github.com/etcd-io/etcd/releases/download/v3.4.18/etcd-v3.4.18-linux-amd64.tar.gz

ETCD_VERSION='3.4.18'
wget https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz

tar -xvf etcd-v${ETCD_VERSION}-linux-amd64.tar.gz && \
  cd etcd-v${ETCD_VERSION}-linux-amd64 && \
  sudo cp -a etcd etcdctl /usr/bin/
  
nohup etcd >/tmp/etcd.log 2>&1 &

安装apisix-dashboard
官方文档
https://github.com/apache/apisix-dashboard/blob/master/docs/en/latest/install.md

RPM包安装
sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.13/apisix-dashboard-2.13-0.el7.x86_64.rpm

shell下运行
sudo manager-api -p /usr/local/apisix/dashboard/
或者以服务运行
systemctl start apisix-dashboard

Without changing the configuration, visit http://127.0.0.1:9000 to use the dashboard with GUI, where the default username and password are admin.
在不更改配置的情况下,访问 http://127.0.0.1:9000 以使用带有 GUI 的仪表板,其中默认用户名和密码为 admin。


vim /usr/local/apisix/dashboard/conf/conf.yaml

allow_list:             # If we don't set any IP list, then any IP access is allowed by default.
  #- 127.0.0.1           # The rules are checked in sequence until the first match is found.
  #- ::1
  
注释掉就可以所有ip访问


问题总结:
1,为什么不是独立安装golang lua 等组件
因为rpm包自己动处理的依赖

2,为什么会出现版本问题
因为apisix apisix-dashboard etcd 等发布版本不一致

3,ETCD建议使用rpm安装
这样重启也不会导致apisix apisix-dashboard自动启动失败



posted on 2022-07-06 10:22  zh7314  阅读(1645)  评论(0编辑  收藏  举报