Ubuntu部署开源网关Apache APISIX

说明

  • 系统:Ubuntu 24.04 LTS
  • Docker版本:v26.1.3
  • Docker Compose版本:v2.26.1

下载和配置

Ubuntu需要安装Docker和Docker Compose

下载apisix-docker仓库

git clone https://github.com/apache/apisix-docker.git

修改docker-compose

在这里插入图片描述

配置etcd会用到IP。查看本机ip,获取到IP地址为“192.168.8.249”

ip addr show
root@vinci:~/apisix-docker/example# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether bc:24:11:64:57:05 brd ff:ff:ff:ff:ff:ffaltname enp0s18inet 192.168.8.249/24 metric 100 brd 192.168.8.255 scope global dynamic ens18valid_lft 42804sec preferred_lft 42804secinet6 fe80::be24:11ff:fe64:5705/64 scope linkvalid_lft forever preferred_lft forever
3: br-ba3ee5d501df: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group defaultlink/ether 02:42:0e:b1:ea:76 brd ff:ff:ff:ff:ff:ffinet 172.18.0.1/16 brd 172.18.255.255 scope global br-ba3ee5d501dfvalid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group defaultlink/ether 02:42:d8:18:f9:c7 brd ff:ff:ff:ff:ff:ffinet 172.17.0.1/16 brd 172.17.255.255 scope global docker0valid_lft forever preferred_lft forever

修改docker-compose.yml,主要修改如下

...etcd:...environment:...ETCD_ADVERTISE_CLIENT_URLS: "http://192.168.8.249:2379"
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#version: "3"services:apisix:image: apache/apisix:${APISIX_IMAGE_TAG:-3.9.0-debian}restart: alwaysvolumes:- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:rodepends_on:- etcd##network_mode: hostports:- "9180:9180/tcp"- "9080:9080/tcp"- "9091:9091/tcp"- "9443:9443/tcp"- "9092:9092/tcp"networks:apisix:etcd:image: bitnami/etcd:3.5.11restart: alwaysvolumes:- etcd_data:/bitnami/etcdenvironment:ETCD_ENABLE_V2: "true"ALLOW_NONE_AUTHENTICATION: "yes"ETCD_ADVERTISE_CLIENT_URLS: "http://192.168.8.249:2379"ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"ports:- "2379:2379/tcp"networks:apisix:web1:image: nginx:1.19.0-alpinerestart: alwaysvolumes:- ./upstream/web1.conf:/etc/nginx/nginx.confports:- "9081:80/tcp"environment:- NGINX_PORT=80networks:apisix:web2:image: nginx:1.19.0-alpinerestart: alwaysvolumes:- ./upstream/web2.conf:/etc/nginx/nginx.confports:- "9082:80/tcp"environment:- NGINX_PORT=80networks:apisix:prometheus:image: prom/prometheus:v2.25.0restart: alwaysvolumes:- ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.ymlports:- "9090:9090"networks:apisix:grafana:image: grafana/grafana:7.3.7restart: alwaysports:- "3000:3000"volumes:- "./grafana_conf/provisioning:/etc/grafana/provisioning"- "./grafana_conf/dashboards:/var/lib/grafana/dashboards"- "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini"networks:apisix:networks:apisix:driver: bridgevolumes:etcd_data:driver: local

更新Admin API key

建议修改Admin API的key,保护APISIX的安全

在这里插入图片描述

修改config.yaml,主要修改key值和host的IP

...admin_key:- name: "admin"key: edc1c9f034335f136f87ad84b625c8f1role: admin                 # admin: manage all configuration data...etcd:host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.- "http://192.168.8.249:2379"          # multiple etcd address...
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#apisix:node_listen: 9080              # APISIX listening portenable_ipv6: falseenable_control: truecontrol:ip: "0.0.0.0"port: 9092deployment:admin:allow_admin:               # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow- 0.0.0.0/0              # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.admin_key:- name: "admin"key: edc1c9f034335f136f87ad84b625c8f1role: admin                 # admin: manage all configuration data- name: "viewer"key: 4054f7cf07e344346cd3f287985e76a2role: vieweretcd:host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.- "http://192.168.8.249:2379"          # multiple etcd addressprefix: "/apisix"               # apisix configurations prefixtimeout: 30                     # 30 secondsplugin_attr:prometheus:export_addr:ip: "0.0.0.0"port: 9091

启动服务

使用docker-compose​启用APISIX

docker-compose -p docker-apisix up -d

在这里插入图片描述

查看状态

docker stats

在这里插入图片描述

验证etcd,浏览器打开http://192.168.8.249:2379/version​,显示如下

{"etcdserver": "3.5.11","etcdcluster": "3.5.0"
}

安装Apache APISIX Dashboard

sudo mkdir -p /usr/apisix-dashboard/conf
sudo vim /usr/apisix-dashboard/conf/conf.yaml

conf.yaml文件如下。endpoints里的IP地址改为192.168.8.249,username为登录用户名,password为登录密码

conf:listen:host: 0.0.0.0   # the address on which the `Manager API` should listen.# The default value is 0.0.0.0, if want to specify, please enable it.# This value accepts IPv4, IPv6, and hostname.port: 9000      # The port on which the `Manager API` should listen.allow_list:       # If we don't set any IP list, then any IP access is allowed by default.etcd:endpoints:      # supports defining multiple etcd host addresses for an etcd cluster- 192.168.8.249:2379 # etcd install ip
authentication:secret:zQ5w5jkLDh3jZpywJ3sskrw6Yv633ruqexpire_time: 3600     # jwt token expire time, in secondusers:                # yamllint enable rule:comments-indentation- username: admin       # dashboard login infomationpassword: 123456- username: userpassword: 123456
docker pull apache/apisix-dashboard:3.0.1-alpinedocker run -d --name dashboard \-p 9000:9000        \-v /usr/apisix-dashboard/conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml \apache/apisix-dashboard:3.0.1-alpine

浏览器打开“http://192.168.8.249:9000/”,输入用户名和密码登录

在这里插入图片描述

参考

  • APISIX 安装指南 | Apache APISIX® – Cloud-Native API Gateway

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/23625.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C语言小例程8/100

题目&#xff1a;输出特殊图案&#xff0c;请在c环境中运行&#xff0c;看一看 程序分析&#xff1a;字符共有256个。不同字符&#xff0c;图形不一样。 #include<stdio.h> int main() {char a176,b219;printf("%c%c%c%c%c\n",b,a,a,a,b);printf("%c%c%c…

:长亭雷池社区版动态防护体验测评

序 长亭雷池在最近发布了动态防护功能&#xff0c;据说可以动态加密保护网页前端代码和阻止爬虫行为、阻止漏洞扫描行为等。今天就来体验测试一下 WAF 是什么 WAF 是 Web Application Firewall 的缩写&#xff0c;也被称为 Web 应用防火墙。区别于传统防火墙&#xff0c;WAF …

Vivado 设置关联使用第三方编辑器 Notepad++

目录 1.前言2.Vivado关联外部编辑器步骤3.Notepad的一些便捷操作 微信公众号获取更多FPGA相关源码&#xff1a; 1.前言 Vivado软件自带的编辑器超级难用&#xff0c;代码高亮对比不明显&#xff0c;而且白色背景看久了眼睛痛。为了写代码时有更加舒适的体验&#xff0c;可以…

速率限制中间件AspNetCoreRateLimit

AspNetCoreRateLimit AspNetCoreRateLimit 是一种 ASP.NET Core 速率限制解决方案&#xff0c;旨在控制客户端可以根据 IP 地址或客户端 ID 向 Web API 或 MVC 应用发出的请求速率。AspNetCoreRateLimit 包包含一个 IpRateLimitMiddleware 和一个 ClientRateLimitMiddleware&am…

LLama2源码分析——Rotary Position Embedding分析

参考&#xff1a;一文看懂 LLaMA 中的旋转式位置编码&#xff08;Rotary Position Embedding&#xff09; 原理推导参考自上文&#xff0c;以下结合huggingface代码分析公式计算过程 1 旋转角度计算 计算公式如下&#xff0c;其中d为词嵌入维度&#xff0c;这部分和论文原文…

STM32 音乐播放器之音频入门实验(pwm、dac、.wav、.mp3)

1.pwm实现简易电子琴实验 1.改变PWM频率&#xff0c;输出不同音调 2.改变占空比&#xff0c;调节音量大小 3.按键弹奏&#xff0c;支持按按键录取弹奏音 4.播放:中高低音&#xff1b;录取音&#xff1b;指定歌曲 5.支持按上一首&#xff0c;下一首&#xff0c;调弹奏速度&#…

Docker Desktop下载安装

Window下使用Docker推荐使用Docker Desktop; Docker Desktop是一款适用于Windows操作系统的桌面应用&#xff0c;它为开发人员提供了一个界面化操作Docker的环境&#xff0c;以便在本地环境中轻松创建、构建和运行Docker容器: Windows系统下Docker Desktop的安装 官网下载安装…

英国树莓派五大天王和你相约上海国际嵌入式展!

6月12日-14日 上海世博展览馆3号馆 H3馆 237展位 树莓派(Raspberry Pi),这个曾经让全球掀起"创客热潮"的小型单板电脑,如今已经成为嵌入式行业不可或缺的一员。作为行业先驱,树莓派基金会正携手团队,亮相2024年6月12日至6月14日在上海举办的 Embedded World上海国…

如何更精准定位你的Facebook广告受众?

Facebook广告成为吸引目标受众、推广产品和服务的重要工具之一。然而&#xff0c;要让广告取得更好的效果&#xff0c;关键在于精准定位受众。本文将介绍如何通过策略和技巧更精确地定位Facebook广告受众&#xff0c;提高广告投放的效果和转化率。 一、精准受众定位重要吗&…

值传递过程中的开销

当处理很大的字符串时&#xff0c;按值传递和按引用传递的区别会更加明显。让我们详细介绍一下字符串的拷贝过程以及占用的内存情况。 字符串按值传递 当你按值传递一个大字符串时&#xff0c;会发生以下过程&#xff1a; 创建临时副本&#xff1a; 在函数调用时&#xff0c;…

完全背包(从二维数组到一维滚动数组)

完全背包 二维dp数组完全背包1. 确定dp数组以及下标的含义2. 确定递推公式3. dp数组如何初始化4. 确定遍历顺序5. 举例推导dp数组完整代码: 一维滚动dp数组完全背包1.确定dp数组以及下标的含义2. 确定递推公式3. dp数组如何初始化4. 确定遍历顺序5. 举例推导dp数组完整代码&…

填充每个节点的下一个右侧节点Ⅱ-力扣

本题如果使用BFS去层序遍历&#xff0c;代码和 填充每个节点的下一个右侧节点 题没有任何区别。但是使用已经建立好的next链表去做&#xff0c;则需要考虑到next指向的节点子节点是否为空的可能。 class Solution { public:Node* connect(Node* root) {if(root nullptr){retu…

城镇污水处理设施运维服务认证

初次申请认证时需提交的文件/资料 1、通用文件/资料(证明文件复印件需签字盖公章) ☐ 营业执照复印件、统一社会信用代码/组织机构代码证复印件 ☐ 增值税一般纳税人资格证复印件&#xff0c;或其他增值税一般纳税人资格认定文件复印件 ☐ 资质 或 许可证 复印件&#x…

RT-Thread

RT-Thread RT-Thread 版权属于上海睿赛德电子科技有限公司&#xff0c;于 2006年 1月首次发布&#xff0c;初始版 本号为0.1.0&#xff0c;经过 10来年的发展&#xff0c;如今主版本号已经升级到3.0&#xff0c;累计开发者达到数百万&#xff0c; 在各行各业产品中装机量达到了…

C++ 并发编程指南(5)线程状态及切换

文章目录 一、多线程状态及切换1、线程状态2、状态切换 前言&#xff1a; C中的线程状态及切换是操作系统和C线程库&#xff08;如POSIX线程或C11及之后的<thread>库&#xff09;共同管理的。线程的状态和切换是多线程编程中的重要概念&#xff0c;下面将简要介绍C线程的…

大数据的数据变换与价值提炼

大数据的数据变换与价值提炼是指将原始的大数据进行分析和处理&#xff0c;从中提取出有用的信息和洞察&#xff0c;并转化为可以支持决策和创新的价值。这个过程通常包括以下几个步骤&#xff1a; 数据清洗和整理&#xff1a;原始的大数据通常会包含大量的噪音和冗余信息&…

大模型SFT

简介 supervised fine-tuning的缩写&#xff0c;即有监督的微调。如应用到一个新的场景&#xff0c;就可以使用SFT 开发流程 设计prompt选取llm模型制作数据集&#xff0c;子任务1k就可以了。内容要丰富。风格格式统一&#xff1b;尽量不加入新知识SFT微调 疑问 SFT很难学…

【Linux取经路】守护进程

文章目录 一、前台进程和后台进程二、Linux 的进程间关系三、setsid——将当前进程设置为守护进程四、daemon——设置为守护进程五、结语 一、前台进程和后台进程 Linux 中每一次用户登录都是一个 session&#xff0c;一个 session 中只能有一个前台进程在运行&#xff0c;键盘…

国产工业级实时数据库

项目功能描述 Mars数据库的核心功能在于其能够高效地处理来自工业现场的大量传感器数据。它通过简化的可视化配置&#xff0c;允许用户轻松接入各种传感器&#xff0c;并进行数据记录和逻辑处理。Mars数据库在单机模式下支持高达120万个传感器信号的接入&#xff0c;而其分布式…

Python Excel 指定内容修改

需求描述 在处理Excel 自动化时,财务部门经常有一个繁琐的场景,需要读取分发的Excel文件内容复制到汇总Excel文件对应的单元格内,如下图所示: 这种需求可以延申为,财务同事制作一个模板,将模板发送给各员工,财务同事需收取邮件将员工填写的excel文件下载到本机,再类似…