ShenYu网关如何配置本地环境使其能够启动运行?

2026-04-11 12:261阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计716个文字,预计阅读时间需要3分钟。

ShenYu网关如何配置本地环境使其能够启动运行?

1. 安装前提:无论什么方式安装,都需要先初始化数据库。我选择本地通过Docker启动一个mysql 5.7服务。命令如下:`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=xyzj1a2y3 -e TZ=Asia/Shanghai mysql:5.7`

ShenYu网关如何配置本地环境使其能够启动运行?

1.先决条件

无论什么方式安装,都需要先初始化数据库,这里我选择了在本地通过 Docker 启用一个 mysql 5.7

docker run -d \ --name mysql \ -p 3306:3306 \ -e MYSQL_ROOT_PASSWORD=xyzj1a2y3 \ -e TZ=Asia/Shanghai \ mysql:5.7

启动以后,可以通过数据库管理软件进行连接 localhost:3306 用户名和密码都是 root。

然后根据文档执行 mysql 数据库初始化,我是直接通过数据库管理软件执行的 sql。执行成功以后创建一个 shenyu 数据库,并且会创建一些表并插入必须数据。

2.本地部署

文档:shenyu.apache.org/zh/docs/deployment/deployment-local

Clone 代码到本地

git clone github.com/apache/incubator-shenyu.git cd incubator-shenyu mvn clean install -Dmaven.javadoc.skip=true -B -Drat.skip=true -Djacoco.skip=true -DskipITs -DskipTests

配置 Mysql

cd shenyu-admin/src/main/resources

application-mysql.yml:

# 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 # # 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. shenyu: database: dialect: mysql init_enable: true spring: datasource: url: jdbc:mysql://localhost:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull username: root password: xyzj1a2y3 driver-class-name: com.mysql.cj.jdbc.Driver

启动 ShenYu Admin

使用 IDE 启动 org.apache.shenyu.admin.ShenyuAdminBootstrap 并配置参数 --spring.profiles.active = mysql

启用 ShenYu Bootstrap

使用 IDE 启动 org.apache.shenyu.bootstrap.ShenyuBootstrapApplication

访问 Admin

访问 localhost:9095 ,默认用户名密码分别为 admin 和 123456

3.运行测试

ShenYu 提供了多方方式接入网关,直接在 UI 操作,通过 client 接入,client 又分为 xcmaster.com/posts/64946.html

目前学习.NET Core 最好的教程 .NET Core 官方教程 ASP.NET Core 官方教程
.NET Core 交流群:923036995欢迎加群交流
如果您认为这篇文章还不错或者有所收获,您可以点击右下角的支持,或请我喝杯咖啡,这将是我继续写作,分享的最大动力!

本文共计716个文字,预计阅读时间需要3分钟。

ShenYu网关如何配置本地环境使其能够启动运行?

1. 安装前提:无论什么方式安装,都需要先初始化数据库。我选择本地通过Docker启动一个mysql 5.7服务。命令如下:`docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=xyzj1a2y3 -e TZ=Asia/Shanghai mysql:5.7`

ShenYu网关如何配置本地环境使其能够启动运行?

1.先决条件

无论什么方式安装,都需要先初始化数据库,这里我选择了在本地通过 Docker 启用一个 mysql 5.7

docker run -d \ --name mysql \ -p 3306:3306 \ -e MYSQL_ROOT_PASSWORD=xyzj1a2y3 \ -e TZ=Asia/Shanghai \ mysql:5.7

启动以后,可以通过数据库管理软件进行连接 localhost:3306 用户名和密码都是 root。

然后根据文档执行 mysql 数据库初始化,我是直接通过数据库管理软件执行的 sql。执行成功以后创建一个 shenyu 数据库,并且会创建一些表并插入必须数据。

2.本地部署

文档:shenyu.apache.org/zh/docs/deployment/deployment-local

Clone 代码到本地

git clone github.com/apache/incubator-shenyu.git cd incubator-shenyu mvn clean install -Dmaven.javadoc.skip=true -B -Drat.skip=true -Djacoco.skip=true -DskipITs -DskipTests

配置 Mysql

cd shenyu-admin/src/main/resources

application-mysql.yml:

# 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 # # 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. shenyu: database: dialect: mysql init_enable: true spring: datasource: url: jdbc:mysql://localhost:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull username: root password: xyzj1a2y3 driver-class-name: com.mysql.cj.jdbc.Driver

启动 ShenYu Admin

使用 IDE 启动 org.apache.shenyu.admin.ShenyuAdminBootstrap 并配置参数 --spring.profiles.active = mysql

启用 ShenYu Bootstrap

使用 IDE 启动 org.apache.shenyu.bootstrap.ShenyuBootstrapApplication

访问 Admin

访问 localhost:9095 ,默认用户名密码分别为 admin 和 123456

3.运行测试

ShenYu 提供了多方方式接入网关,直接在 UI 操作,通过 client 接入,client 又分为 xcmaster.com/posts/64946.html

目前学习.NET Core 最好的教程 .NET Core 官方教程 ASP.NET Core 官方教程
.NET Core 交流群:923036995欢迎加群交流
如果您认为这篇文章还不错或者有所收获,您可以点击右下角的支持,或请我喝杯咖啡,这将是我继续写作,分享的最大动力!