Apisix网关单机部署

官网文档:https://apisix.apache.org/zh/docs/apisix/getting-started/README/
安装包

一、安装依赖

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm

添加OpenResty源

yum install yum-utils
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

安装OpenResty

yum install -y openresty

二、安装etcd

apisix需要3.4及以上的etcd,安装的同时需要注意自己服务器的架构是arm还是amd

1.下载etcd并解压
tar -zxvf etcd-v3.4.15-linux-amd64.tar.gz
2.环境配置
cd etcd-v3.4.15-linux-amd64/
mv etcd /usr/local/bin/
mv etcdctl /usr/local/bin/

修改环境变量

vim /etc/profile

在文件最后添加:

export ETCDCTL_API=3

变量生效:

source /etc/profile
3.查看版本信息
etcdctl version
---------------
etcdctl version: 3.4.15
API version: 3.4
4.创建etcd配置文件
mkdir -p /var/lib/etcd/
cat <<EOF | sudo tee /etc/etcd.conf
#节点名称
ETCD_NAME=$(hostname -s)
#数据存放位置
ETCD_DATA_DIR=/var/lib/etcd/
EOF
5.创建开机启动文件
cat <<EOF | sudo tee /etc/systemd/system/etcd.service
[Unit]
Description=Etcd Server
Documentation=https://github.com/coreos/etcd
After=network.target
 
[Service]
User=root
Type=notify
#这个文件特别关键,etcd使用的环境变量都需要通过环境变量文件读取
EnvironmentFile=-/etc/etcd.conf
ExecStart=/usr/local/bin/etcd
Restart=on-failure
RestartSec=10s
LimitNOFILE=40000
 
[Install]
WantedBy=multi-user.target
EOF
6.重新加载配置 && 开机启动 && 启动etcd
systemctl daemon-reload && systemctl enable etcd && systemctl start etcd

开机启动设置状态,状态enabled

systemctl list-unit-files etcd.service
--------------------------------------
UNIT FILE    STATE  
etcd.service enabled
1 unit files listed.

查看etcd状态

systemctl show etcd.service

查看2379端口是否启动成功

netstat -an |grep 2379

三、安装apisix

1.下载安装apisix
yum install -y https://github.com/apache/apisix/releases/download/2.5/apisix-2.5-0.x86_64.rpm
2.检查 apisix的版本号
apisix version
3.启动apisix(etcd>=3.4)
apisix start
4.安装dashboard

dashboard需要比apisix高0.1个版本。apisix=2.5,那么dashboard就是2.6

yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.6/apisix-dashboard-2.6-0.x86_64.rpm
5.配置dashboard
cd /usr/local/apisix/dashboard/conf
vim conf.yaml

修改host为0.0.0.0并注释掉allow_list

6.启动并访问
nohup manager-api -p /usr/local/apisix/dashboard/ &

http://127.0.0.1:9000 admin/admin

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dream答案

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值