磐基2.0部署apisix集群

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是在两台 CentOS 7 服务器上部署 Apache APISIX 集群的步骤: 1. 安装必要的软件包。在两台服务器上分别运行以下命令: ``` sudo yum install -y gcc-c++ git make openssl openssl-devel pcre-devel zlib-devel ``` 2. 安装 etcd。在两台服务器上分别运行以下命令: ``` sudo curl -L https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz -o /tmp/etcd-v3.5.0-linux-amd64.tar.gz sudo tar xzf /tmp/etcd-v3.5.0-linux-amd64.tar.gz -C /usr/local/bin --strip-components=1 ``` 3. 克隆 Apache APISIX 代码。在一台服务器上运行以下命令: ``` git clone https://github.com/apache/apisix.git cd apisix/ ``` 4. 编译和安装 Apache APISIX。在一台服务器上运行以下命令: ``` sudo make deps sudo make sudo make install ``` 5. 修改 Apache APISIX 配置文件。在一台服务器上打开 `conf/config.yaml` 文件,修改以下配置: ``` node_listen: - 0.0.0.0:9080 ``` 这里将监听端口修改为 9080,因为默认的 9080、9081 端口会被 Kubernetes Ingress Controller 占用。 6. 启动 Apache APISIX。在一台服务器上运行以下命令: ``` sudo /usr/local/apisix/bin/apisix start ``` 7. 配置 etcd 集群。在另一台服务器上运行以下命令: ``` sudo /usr/local/bin/etcd --name=apisix-node2 \ --initial-advertise-peer-urls=http://<node2-ip>:2380 \ --listen-peer-urls=http://<node2-ip>:2380 \ --advertise-client-urls=http://<node2-ip>:2379 \ --listen-client-urls=http://<node2-ip>:2379 \ --initial-cluster-token=apisix-cluster \ --initial-cluster=apisix-node1=http://<node1-ip>:2380,apisix-node2=http://<node2-ip>:2380 \ --initial-cluster-state=new \ --data-dir=/var/lib/etcd ``` 这里将 `<node1-ip>` 替换为第一台服务器的 IP 地址,`<node2-ip>` 替换为第二台服务器的 IP 地址。 8. 修改 Apache APISIX 配置文件。在一台服务器上打开 `conf/config.yaml` 文件,修改以下配置: ``` etcd: host: - <node1-ip>:2379 - <node2-ip>:2379 prefix: "/apisix" ``` 这里将 `<node1-ip>` 和 `<node2-ip>` 分别替换为两台服务器的 IP 地址。 9. 启动 Apache APISIX。在一台服务器上运行以下命令: ``` sudo /usr/local/apisix/bin/apisix start ``` 10. 验证 Apache APISIX 集群是否正常工作。在任意一台服务器上运行以下命令: ``` curl -i http://<node1-ip>:9080/hello ``` 如果返回以下响应,则说明 Apache APISIX 集群已经部署成功: ``` HTTP/1.1 200 OK Content-Type: text/plain Content-Length: 5 Date: Tue, 21 Sep 2021 00:00:00 GMT Server: APISIX web server hello ``` 以上就是在两台 CentOS 7 服务器上部署 Apache APISIX 集群的步骤。希望能对你有所帮助!

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

七七powerful

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

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

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

打赏作者

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

抵扣说明:

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

余额充值