apollo本地啟動

  • 2019 年 12 月 7 日
  • 筆記

使用apollo最新的1.1版本:https://github.com/ctripcorp/apollo 導入idea設置啟動配置

1.新建ConfigAdminService

主要類:

com.ctrip.framework.apollo.assembly.ApolloApplication

虛擬機選項:

-Dapollo_profile=github  -Dspring.datasource.url=jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8  -Dspring.datasource.username=apollo  -Dspring.datasource.password=  -Dlogging.file=D:/app/apollo-assembly.log

程式參數:

--configservice --adminservice

使用模組的類路徑apollo-assembly

2.新建PortalService

主要類:

com.ctrip.framework.apollo.portal.PortalApplication

虛擬機選項:

-Dapollo_profile=github,auth  -Ddev_meta=http://localhost:8080/  -Dserver.port=8070  -Dspring.datasource.url=jdbc:mysql://localhost:3306/ApolloPortalDB?characterEncoding=utf8  -Dspring.datasource.username=apollo  -Dspring.datasource.password=  -Dlogging.file=D:/app/apollo-portal.log

使用模組的類路徑apollo-portal

3.新建Demo

主要類:

com.ctrip.framework.apollo.demo.api.SimpleApolloConfigDemo

虛擬機選項:

-Denv=dev -Ddev_meta=http://localhost:8080

使用模組的類路徑apollo-demo

按順序啟動,訪問127.0.0.1:8080查看3個服務是否註冊成功 訪問127.0.0.1:8070 默認帳號密碼apollo/admin 新建應用100004458,添加配置key:timeout value:255

在demo運行框內輸入timeout回車後暫無顯示 點擊網頁上的發布,再在demo中輸入timeout回車後顯示255