登录linux服务器
JDK:1.8.0_161(提前准备好,不介绍安装了哦)
Maven:3.5.2(提前准备好,不介绍安装了哦)
MySQL:5.7.18(5.7以上,不介绍安装了哦)
apollo:v1.4.0
创建目录
mkdir -p /data/apollo cd /data/apollo
下载apollo
wget https://codeload.github.com/ctripcorp/apollo/zip/v1.4.0 unzip v1.4.0
修改数据库配置
# 导入数据库 https://gitee.com/lepdou/apollo/tree/master/scripts/sql
vi /data/apollo/apollo-1.4.0/scripts/build.sh
# apollo config db info apollo_config_db_url=jdbc:mysql://120.78.127.53:3306/ApolloConfigDB?characterEncoding=utf8 apollo_config_db_username=******* apollo_config_db_password=*******
# apollo portal db info
apollo_portal_db_url=jdbc:mysql://120.78.127.53:3306/ApolloPortalDB?characterEncoding=utf8
apollo_portal_db_username=********
apollo_portal_db_password=********
# meta server url, different environments should have different meta server addresses
dev_meta=http://localhost:8080
fat_meta=http://localhost:8080
uat_meta=http://localhost:8080
pro_meta=http://localhost:8080
增加start脚本
vi start.sh (复制下面的脚本保存)
最后sh start.sh
#!/bin/sh
sh /data/apollo/apollo-1.4.0/apollo-configservice/target/scripts/shutdown.sh
sh /data/apollo/apollo-1.4.0/apollo-adminservice/target/scripts/shutdown.sh
sh /data/apollo/apollo-1.4.0/apollo-portal/target/scripts/shutdown.sh
# 打包
sh /data/apollo/apollo-1.4.0/scripts/build.sh
# 启动apollo-configservice 端口8080
cd /data/apollo/apollo-1.4.0/apollo-configservice/target
unzip -o apollo-configservice-1.4.0-github.zip
sh /data/apollo/apollo-1.4.0/apollo-configservice/target/scripts/startup.sh
# 启动apollo-adminservice 端口8090
cd /data/apollo/apollo-1.4.0/apollo-adminservice/target
unzip -o apollo-adminservice-1.4.0-github.zip
sh /data/apollo/apollo-1.4.0/apollo-adminservice/target/scripts/startup.sh
# 启动apollo-adminservice 端口8070
cd /data/apollo/apollo-1.4.0/apollo-portal/target
unzip -o apollo-portal-1.4.0-github.zip
sh /data/apollo/apollo-1.4.0/apollo-portal/target/scripts/startup.sh
正确启动完成后 ip:8070 访问OK
已测试3次OK的了
遇到的问题:
1. 阿里云 linux部署apollo时候,用springboot连apollo的时候总连不上。 注意下报错,发现连接的IP不是自己服务器的IP. eureka 注册时使用的不是你的外网IP 。
解决方式:
在build之前,修改文件(/data/apollo/apollo-1.4.0/apollo-configservice/src/main/resources/bootstrap.yml),
eureka: instance: ip-address: 127.0.0.1 prefer-ip-address: true
2. apollo配置多环境时,数据库中需要配置多环境。需要修改数据库
ApolloConfigDB.ServerConfig.【eureka.service.url】 : Eureka服务Url,多个service以英文逗号分隔
ApolloPortalDB.ServerConfig.【apollo.portal.envs】:可支持的环境列表
转载:https://www.cnblogs.com/moonandstar08/p/7571610.html
apollo:https://gitee.com/lepdou/apollo