安装部署前置问题
在我的实际工作情况中,对于部署有这么几个硬性的要求:
1. 各个环境的服务器是无法连接外网的,所以没有办法使用在线安装,所以采用的是离线rpm包的方法进行的。
2. 由于生产环境对于root权限管理比较严格,所以要求我们在安装部署的时候,使用root用户进行安装,并确保后续可以使用非root用户进行启动。
关于更多APISIX的基本背景以及参考资料,详情请参考
APISIX部署问题汇总
使用RPM离线安装APISIX
本次使用的APISIX版本是2.13
参考官方手册:https://apisix.apache.org/zh/docs/apisix/2.13/how-to-build/
使用本地虚拟机,或者任意可以连接外网的云主机,提前预下载rpm离线包:
sudo mkdir -p apisix
sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm
sudo yum clean all && yum makecache
sudo yum install -y --downloadonly --downloaddir=./apisix apisix
下载完成后,每次安装时,将rpm包上传到服务器,并执行:
sudo yum install ./apisix/*.rpm
如果提示缺少包依赖,则执行:
rpm -Uvh ./apisix/*.rpm --nodeps --force
root用户安装,非root用户启动
APISIX解决:使用root用户安装,非root用户启动问题,使用root用户RPM包安装完成后,执行如下操作即可:
修改属主属组:
chown -R cfae:cfae /usr/local/apisix/
chmod -R 775 /usr/local/apisix/
chown -R cfae:cfae /usr/local/openresty/
chmod -R 775 /usr/local/openresty/
APISIX 报错汇总
最大文件数报错
[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
在limits.conf追加两行:
soft nofile 65536
hard nofile 65536
再次启动apisix即可
DNS is Empty
1、编辑DNS配置文件
vim /etc/resolv.conf
2、添加DNS配置信息:
nameserver 47.106.30.119
3、然后执行重启
systemctl restart network
某些生产环境的DNS配置文件是由脚本生成,无法永久修改并生效
解决方案:直接修改配置文件,不重启network服务,临时修改完成后,直接执行sudo apisix init 即可