apollo源码本地启动使用

这段时间接手的项目用到apollo配置中心,感觉和cloud的config、阿里的nacos一样,结果。。。还是要了解、学习内部的一些原理,因为遇到一个问题,简单描述一下:应用程序代码修改配置后需要立即调用查询配置,由于adminservice修改配置后会通知configservice,configservice会每隔一秒钟拉取db中的配置,所以不会立即查询到修改后的配置,其实可以用本地缓存+事务代码可以解决,但是看是否可以用apollo本身技术解决该问题,之前也没用过apollo,需要研究学习一下,从头开始。

一、下载地址:apollo源码地址http://xn--apollo-u20k9d284uuzt/

这里我是 git bash环境下载的,zip包没试过,也不知道出现的异常会不会和git一样;
然后用idea打开,并构建编译,保证不编译出错,如果有maven引用编译出错,在idea或者dos命令执行 mvn -U clean install  ,然后再编译打包就可以

二、执行sql,生成数据库

找到目录下的两个sql文件,并数据库执行这两个sql文件,之后会生成两个数据库:

apolloconfigdb、apolloportaldb  

三、修改文件:

先修改build.bat文件里的 下图中画出的配置变量值,然后双击运行。注意,这里url配置如果你的mysql是8.0+的版本,就要加:serverTimezone=Asia/Shanghai  时间区域,不然连接数据库异常。然后是自己的数据库用户名,密码

 四、启动项目:
首先启动:apollo-configservice 注册中心项目,启动参数vmoptions:
-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=root
-Dlogging.file=D:/logs/apollo-assembly.log
附图下:

 然后启动:apollo-assembly ,配置系统启动参数vmoptions:

-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=root
-Dlogging.file=D:/logs/apollo-assembly.log

prigram arguments:

–configservice --adminservice

附下图:

 最后启动:apollo-portal  ,配置系统启动参数vmoptions:

-Denv=dev
-Ddev_meta=http://localhost:8080
-Dspring.profiles.active=github,auth
-Deureka.client.enabled=false
-Dhibernate.query.plan_cache_max_size=192
-Dserver.port=8170
-Dspring.datasource.url=jdbc:mysql://localhost:3306/apolloportaldb?characterEncoding=utf8&serverTimezone=Asia/Shanghai
-Dspring.datasource.username=root
-Dspring.datasource.password=root
-Dlogging.file=D:/logsh/apollo-portal.log

prigram arguments:

–portal

附下图:

 启动无异常后:http://localhost:8080  ,查看注册中心

 然后打开portal,这里端口为:8170 ,http://localhost:8170

 到这里就是整个源码本地启动步骤,之前由于看了好多个博客,踩了好多坑,相信这是该问题最后一坑。

有建议留言,谢谢!

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

焱墩

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

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

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

打赏作者

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

抵扣说明:

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

余额充值