apollo开启多环境配置

这篇博客介绍了如何在Apollo中添加新环境并进行端口配置。首先,需要创建新数据库并修改配置文件,如将ApolloConfigDB更名为ApolloConfigDB_fat,端口改为8180。接着,更新apollo-configservice和apollo-adminservice的端口,包括application.yml、bootstrap.yml、adminservice.properties等文件。然后,编译项目,并在新目录下启动服务。最后,强调uat、lpt、pro等环境可按相同步骤操作,只需更换相应服务的端口。

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

新环境的配置端口设置为8180 管理端口设置为8190

apollo添加新环境需要复刻apollo-configservice和apollo-adminservice(每个环境要求有独立的这些配置),apollo-portal是公用的

1、创建新的apolloconfigdb库,操作很简单直接编辑原生的 apolloconfigdb.sql文件 修改如下三个部分就可以

(1)、数据库名字换成ApolloConfigDB_fat
(2)、端口换成8180(新服务) 'default', 'http://localhost:8180/eureka/'
  (3)、再次导入mysql数据库

2、apollo-configservice的配置

路径:/soft/apollo/apollo-portal/src/main/config
文件:application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloPortalDB_fat?useSSL=false&characterEncoding=utf8
spring.datasource.username = root
spring.datasource.password = 123456
路径:/soft/apollo/apollo-configservice
如下文件的端口都要从8080换成8180
src/main/resources/application.yml
src/main/resources/bootstrap.yml
src/main/resources/configservice.properties
src/main/scripts/startup.sh

3、apollo-adminservice的配置

路径:/soft/apollo/apollo-adminservice/src/main/config
文件:application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDB_fat?useSSL=false&characterEncoding=utf8
spring.datasource.username = root
spring.datasource.password = 123456
路径:/soft/apollo
如下文件的端口都要从8090换成8190
# grep -r 8190|grep -v target
apollo-adminservice/src/main/resources/adminservice.properties:server.port= 8190
apollo-adminservice/src/main/resources/application.yml: port: 8190
apollo-adminservice/src/main/scripts/startup.sh:SERVER_PORT=${SERVER_PORT:=8190}

4、编译即可

编译文件路径:/soft/apollo/scripts
#build.sh 执行完毕即可

5、启动服务

创建工作目录

#mkdir -p  /soft/apollo-service/{apollo-configservice_fat,apollo-adminservice_fat,apollo-portal}

拷贝编译生成后的文件

#cp /soft/apollo/apollo-configservice/target/apollo-configservice-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-configservice_fat/
#cp /soft/apollo/apollo-adminservice/target/apollo-adminservice-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-adminservice_fat/
#cp /soft/apollo/apollo-portal/target/apollo-portal-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-portal/

进入各自的目录unzip文件 进scipts目录启动服务即可

#uat,lpt,pro都可以按照这个步骤操作,只需要换configservice和adminservice的端口即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

完颜振江

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

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

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

打赏作者

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

抵扣说明:

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

余额充值