centos7 安装apisix2.10

1、安装依赖

# 安装 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/

# 添加 OpenResty 源
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

# 安装 OpenResty 和 编译工具
sudo yum install -y openresty curl git gcc openresty-openssl111-devel unzip pcre pcre-devel

# 安装 LuaRocks
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -

# 开启 etcd server
nohup etcd &

【etcd检查】

# 查看etcd安装版本
etcd --version
curl -L http://127.0.0.1:2380/version

# 查看端口
netstat -anp | grep 2380

# 安装目录
/usr/bin/

2、安装apisix

# 通过RPM包安装,这种安装方式适用于CentOS7操作系统
sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/apisix-2.10.0-0.el7.x86_64.rpm

【初始化和启动 】

# 初始化依赖
apisix init

# 启动
apisix start

【若启动报错!】

[root@bpm-web apisix]# apisix start
/usr/local/openresty/luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua start
Warning! Current maximum number of open file descriptors [1024] is too small, please increase user limits by execute 'ulimit -n <new user limits>' , otherwise the performance is low.
Warning! Request etcd endpoint 'http://127.0.0.1:2379/version' error, connection refused, retry time=1
Warning! Request etcd endpoint 'http://127.0.0.1:2379/version' error, connection refused, retry time=2
request etcd endpoint 'http://127.0.0.1:2379/version' error, connection refused

【原因:系统open files设置太少】 

 【解决】

vim /etc/security/limits.conf

【追加两行】 

* soft nofile 65536
* hard nofile 65536

【再次启动】

[root@bpm-web tyke]# apisix start
/usr/local/openresty/luajit/bin/luajit /usr/local/apisix/apisix/cli/apisix.lua start

【apisix检查】

# 查看帮助命令
[root@bpm-web tyke]# apisix help 

# 查看端口
netstat -anp | grep 9080

# 安装目录
/usr/local/apisix

3、安装dashboard

# yum安装rpm
sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.9.0/apisix-dashboard-2.9.0-0.el7.x86_64.rpm

# 服务方式启动
sudo manager-api start -p /usr/local/apisix/dashboard/

# 查看帮助命令
[root@bpm-web conf]# manager-api help

【浏览器访问】 

# 访问http://ip:9000/

#报IP address not allowed
{"Code":20002,"Message":"IP address not allowed","Data":null,"SourceSrv":""}

【设置允许其他IP访问 】

[root@bpm-web conf]# pwd
/usr/local/apisix/dashboard/conf
[root@bpm-web conf]# vim conf.yaml

 【重新启动】

[root@i-E42D8BAE conf]# manager-api stop
[root@i-E42D8BAE conf]# manager-api start
Starting Apache APISIX Dashboard:                                       [  OK  ]

【检查】

# 查看dashboard状态
[root@i-E42D8BAE conf]# manager-api status
Service (pid  18338) is running...

# 安装目录
/usr/local/apisix/dashboard/

# 查看帮助命令
[root@i-E42D8BAE conf]# manager-api help

【访问验证】

浏览器访问http://ip:9000/

登录账号密码默认:admin/admin

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值