文章目录
1.下载APOLLO源码
https://gitee.com/nobodyiam/apollo
2.执行Sql脚本
3.启动项目
编译项目后
3.1 启动ConfigServiceApplication
-Denv=dev
-Dspring.profiles.active=github
-Deureka.service.url=http://localhost:8080/eureka/
-Dspring.datasource.url=jdbc:mysql://localhost:3306/apolloconfigdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai
-Dspring.datasource.username=root
-Dspring.datasource.password=123456
-Dlogging.file=D:/logs/apollo-assembly.log
3.2 启动apollo-assembly
VM
-Denv=dev
-Dspring.profiles.active=github
-Deureka.service.url=http://localhost:8080/eureka/
-Dspring.datasource.url=jdbc:mysql://localhost:3306/apolloconfigdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai
-Dspring.datasource.username=root
-Dspring.datasource.password=123456
-Dlogging.file=D:/logs/apollo-assembly.log
Program arguments
–configservice --adminservice
3.3 启动 apollo-portal
VM
-Denv=dev
-Ddev_meta=http://localhost:8080
-Dhibernate.query.plan_cache_max_size=192
-Dspring.datasource.url=jdbc:mysql://localhost:3306/apolloportaldb?characterEncoding=utf8&serverTimezone=Asia/Shanghai
-Dspring.datasource.username=root
-Dspring.datasource.password=123456
-Dlogging.file=D:/logsh/apollo-portal.log
Program arguments
–portal
增加apollo-portal 下的application.yml中增加配置
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
有可能遇到数据库连接问题:
Data source rejected establishment of connection, message from server: “Too many connections”
修改mysql下的my.ini文件
# 允许最大连接数
max_connections=1000
# max_user_connections设置每用户最大连接数为500
max_user_connections=500
# wait_timeout表示200秒后将关闭空闲(IDLE)的连接,但是对正在工作的连接不影响。
wait_timeout=200
然后重启mysql服务 net stop mysql,net start mysql
4.打开apollo控制台
http://localhost:8070
用户名:apollo
密码:admin
5.源码分析
这边简单易懂
https://cloud.tencent.com/developer/article/1964636
参考:
https://gitee.com/nobodyiam/apollo/wikis/Quick-Start
https://blog.csdn.net/yang1076180972/article/details/121058159?ops_request_misc=&request_id=&biz_id=102&utm_term=apollo%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E6%BA%90%E7%A0%81%E5%90%AF%E5%8A%A8&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-121058159.142v35pc_rank_34&spm=1018.2226.3001.4187