apisix 单机部署 linux

本文详细描述了如何在Linux环境中安装etcd版本3.5.4,设置其配置并启动服务,同时介绍了如何安装和配置ApacheAPISIX及Dashboard,包括上传配置文件、启动/停止服务和监控状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装etcd:

cd /home/app
rz 
tar -zxvf etcd-v3.5.4-linux-amd64.tar.gz
cd etcd-v3.5.4-linux-amd64
vim start.sh

内容:
#!/bin/sh
nohup etcd --name infra0 --initial-advertise-peer-urls http://127.0.0.1:2380 \
  --listen-peer-urls http://127.0.0.1:2380 \
  --listen-client-urls http://127.0.0.1:2379\
  --advertise-client-urls http://127.0.0.1:2379 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-cluster infra0=http://127.0.0.1:2380\
  --initial-cluster-state new >./logs/etcd.log 2>&1 &
  

chmod 755 start.sh
mkdir logs

sudo cp -a etcd etcdctl /usr/bin/

sh start.sh

tail -f logs/etcd.log

etcdctl member list
etcdctl put key value
etcdctl get key

#安装apisix

cd /home/app
sudo yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --add-repo https://repos.apiseven.com/packages/centos/apache-apisix.repo
sudo yum install -y apisix 3.2

cd /usr/local/apisix/conf

rm -rf config-default.yaml

#上传config-default.yaml
rz   
chmod 755 config-default.yaml

cd /usr/local/apisix

#启动apisix
apisix start

#安装dashboard

cd /home/app

sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v3.0.0/apisix-dashboard-3.0.0-0.el7.x86_64.rpm

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.
    #- 0.0.0.0           # The rules are checked in sequence until the first match is found.
    #- ::1 

启动:
sudo systemctl start apisix-dashboard

停止:
sudo systemctl stop apisix-dashboard

查看状态:
sudo systemctl status apisix-dashboard
### Apisix 安装部署教程 #### 使用 Docker 部署 Apache APISIX 对于希望快速上手并测试 APISIX 功能的开发者来说,Docker 是一种便捷的选择。只需几条命令即可完成环境搭建[^5]。 ```bash docker pull apache/apisix:latest docker run -it --rm \ --name apisix \ -p 9080:9080 \ -p 9443:9443 \ apache/apisix:latest ``` 上述命令会拉取最新版的官方镜像,并启动容器,在本地映射 HTTP 和 HTTPS 端口用于访问 API 网关服务。 #### Kubernetes 上使用 Helm Chart 部署 为了实现更灵活高效的资源管理和调度,推荐在生产环境中采用基于 Kubernetes 的部署方式。Helm 图表简化了复杂应用程序的一键式安装过程,允许用户自定义参数来适应不同场景需求。 ```yaml # values.yaml 示例片段 replicaCount: 2 image: repository: apache/apisix tag: "latest" service: type: LoadBalancer port: 9080 configProvider: type: etcd endpoints: - http://etcd.default.svc.cluster.local:2379 ``` 执行如下指令以应用配置文件: ```bash helm repo add apache https://apache.github.io/incubator-apisix-helm-chart helm install my-release apache/apisix -f values.yaml ``` 这将依据指定设置自动创建所需的服务实例及相关组件,极大地方便运维人员的操作维护工作。 #### 关于配置中心的选择 默认情况下,APISIX 将依赖 Etcd 来存储路由规则和其他动态数据。Etcd 凭借其出色的性能表现以及广泛的社区支持成为首选方案之一;不过根据实际业务特点也可以考虑其他替代品如 Consul 或 Nacos 等[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值