一.鏈接
官網(wǎng):https://github.com/apolloconfig/apollo
中文文檔:https://www.apolloconfig.com/#/zh/README
java客戶端使用指南: https://www.apolloconfig.com/#/zh/usage/java-sdk-user-guide
二. 在線功能了解:
http://81.68.181.139/ apollo/admin
三.快速部署(本地試用):
git clone https://github.com/apolloconfig/apollo-quick-start.git
四.啟動
端口不能被占用:
lsof -i:8070 --- Potal管理界面
lsof -i:8080 --- Config service+Eureka Server + Meta Server
lsof -i:8090 --- Admin Service
docker-compose up
Portal訪問: http://Ip:8070 apollo/admin
五.試用
步驟:創(chuàng)建項(xiàng)目-》選擇環(huán)境-》添加/修改配置=》發(fā)布 (name, spring.application.name)
六.客戶端讀取配置:
- application.yml
app:
id: apollo_client
apollo:
bootstrap:
enabled: true
namespaces: application,test
meta: http://192.168.1.155:8080
config-service: http://192.168.1.155:8080
- pom.xml
<!-- https://mvnrepository.com/artifact/com.ctrip.framework.apollo/apollo-client -->
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client-config-data</artifactId>
<version>1.9.0</version>
</dependency>
3.測試代碼
Config appConfig = ConfigService.getAppConfig();
String property = appConfig.getProperty("name", "aaa");
String property1 = appConfig.getProperty("spring.application.name", "aaa");
System.out.println(property + "=name===spring.application.name=" + property1);
// 啟動加參數(shù)-Denv=DEV
七.核心組成部分
https://mp.weixin.qq.com/s/-hUaQPzfsl9Lm3IqQW3VDQ (4+3 七個(gè)模塊)
應(yīng)用-》環(huán)境=》集群=》命名空間
Config Service: 提供配置的讀取推送等功能-----Apollo客戶端
Admin Service: 提供配置的修改,發(fā)布等功能-----Apollo Portal
Eureka提供服務(wù)注冊和發(fā)現(xiàn),Eureka與config service在一個(gè)JVM進(jìn)程中
Eureka之上架了一層Meta Server 用于封裝Eureka的服務(wù)發(fā)現(xiàn)接口
特點(diǎn):
配置熱更新(管理后臺改完發(fā)布后,客戶端不用重啟能獲得最新配置)
灰度發(fā)布
多環(huán)境,多集群配置管理
版本管理,支持回滾
權(quán)限管理、發(fā)布審核、操作審計(jì)
客戶端配置信息監(jiān)控 等
八.源碼學(xué)習(xí)
git clone https://github.com/apolloconfig/apollo.git
//todo