apisix apisix-dashboard 单机部署
Apisix
1 | sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm |
1 | sudo yum-config-manager --add-repo https://repos.apiseven.com/packages/centos/apache-apisix.repo |
1 | # 查看仓库中最新的 apisix 软件包的信息 |
1 | ETCD_VERSION='3.4.13' |
vim /usr/local/apisix/conf/config-default.yaml
apisix:
node_listen: # This style support multiple ports
80
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
0.0.0.0/0
1 | apisix init |
1 | apisix test |
1 | apisix start |
1 | # stop Apache APISIX server gracefully |
执行强制停机的命令如下所示:
1 | # stop Apache APISIX server immediately |
apisix-dashboard
1 | sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.10.1/apisix-dashboard-2.10.1-0.el7.x86_64.rpm |
1 | # run dashboard in the shell |
vim /usr/local/apisix/dashboard/conf/conf.yaml
Allow all IPv4 access
By default, the IPv4 range of 127.0.0.0/24
is allowed to access APISIX Dashboard
. If you want to allow all IPv4 access, then just configure conf.allow_list
in the configuration file of conf/conf.yaml
as follows:
1 | conf: |
Allow all IPv6 access
By default, the IPv6 range of ::1
is allowed to access APISIX Dashboard
. If you want to allow all IPv6 access, then just configure conf.allow_list
in the configuration file of conf/conf.yaml
as follows:
1 | conf: |
Allow all IP access
If you want to allow all IPs to access APISIX Dashboard
, you only need to do the following configuration in the configuration file of conf/conf.yaml
:
1 | conf: |
自动备份
自动备份
#!/bin/bash
#时间戳,用来区分不同备份
timestamp=date +%Y%m%d-%H%M%S
#备份到哪个文件夹
back_dir=“/root/etcd_db_bak”
#etcd集群列表
endpoints=“https://127.0.0.1:2379”
#etcd证书路径
#cert_file=“/etc/etcd/ssl/etcd.pem”
#etcd证书的key路径
#key_file=“/etc/etcd/ssl/etcd-key.pem”
#ca证书路径
#cacert_file=“/etc/kubernetes/ssl/ca.pem”
mkdir -p $back_dir
ETCDCTL_API=3 /usr/bin/etcdctl
snapshot save back_dir/snapshot_timestamp.db
#–endpoints="{endpoints}" \
#--cert=cert_file
#–key=key_file \
#--cacert=cacert_file
#snapshot save back_dir/snapshot_timestamp.db
数据恢复
关闭etcd
恢复数据之前需要先将etcd的旧工作目录
执行恢复命令
ETCDCTL_API=3 etcdctl --data-dir=/root/default.etcd snapshot restore /root/etcd_db_bak/snapshot_20220427-021136.db
启动etcd
nohup etcd >/tmp/etcd.log 2>&1 &
重启apisix-dashboard
systemctl restart apisix-dashboard