阿里Sentinel控制檯原始碼修改-對接Apollo規則持久化
阿新 • • 發佈:2019-05-27
動態規則擴充套件
https://github.com/alibaba/Sentinel/wiki/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%99%E6%89%A9%E5%B1%95
apollo 資料來源樣例
https://github.com/alibaba/Sentinel/tree/master/sentinel-demo
控制檯接入
https://github.com/alibaba/Sentinel/wiki/%E6%8E%A7%E5%88%B6%E5%8F%B0
api功能測試
參考文件 https://github.com/ctripcorp/apollo/wiki/Apollo%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0
第 3.2.1 節 獲取App的環境,叢集資訊
下載 sentinel 1.6 原始碼,拷貝test 目錄下的 apollo到工程的rule目錄下
解決 user(dataChangeLastModifiedBy) not exists 報錯問題需要 設定 FlowRuleApolloPublisher
openItemDTO.setDataChangeCreatedBy("apollo");
Caused by: com.ctrip.framework.apollo.openapi.client.exception.ApolloOpenApiException: Request to apollo open api failed, status code: 400, reason: , message: {"exception":"com.ctrip.framework.apollo.common.exception.BadRequestException","message":"user(dataChangeLastModifiedBy) not exists","status":400,"timestamp":"2019-05-26T23:03:31.2"} at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.checkHttpResponseStatus(AbstractOpenApiService.java:99) ~[apollo-openapi-1.2.0.jar:1.2.0] at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.execute(AbstractOpenApiService.java:80) ~[apollo-openapi-1.2.0.jar:1.2.0] at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.execute(AbstractOpenApiService.java:74) ~[apollo-openapi-1.2.0.jar:1.2.0] at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.put(AbstractOpenApiService.java:54) ~[apollo-openapi-1.2.0.jar:1.2.0] at com.ctrip.framework.apollo.openapi.client.service.ItemOpenApiService.createOrUpdateItem(ItemOpenApiService.java:120) ~[apollo-openapi-1.2.0.jar:1.2.0] ... 65 common frames omitted
解決 user(releaseBy) not exists 報錯問題需要 設定 FlowRuleApolloPublisher
namespaceReleaseDTO.setReleasedBy("apollo");
Caused by: com.ctrip.framework.apollo.openapi.client.exception.ApolloOpenApiException: Request to apollo open api failed, status code: 400, reason: , message: {"exception":"com.ctrip.framework.apollo.common.exception.BadRequestException","message":"user(releaseBy) not exists","status":400,"timestamp":"2019-05-26T23:17:51.724"}
at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.checkHttpResponseStatus(AbstractOpenApiService.java:99) ~[apollo-openapi-1.2.0.jar:1.2.0]
at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.execute(AbstractOpenApiService.java:80) ~[apollo-openapi-1.2.0.jar:1.2.0]
at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.execute(AbstractOpenApiService.java:74) ~[apollo-openapi-1.2.0.jar:1.2.0]
at com.ctrip.framework.apollo.openapi.client.service.AbstractOpenApiService.post(AbstractOpenApiService.java:48) ~[apollo-openapi-1.2.0.jar:1.2.0]
at com.ctrip.framework.apollo.openapi.client.service.ReleaseOpenApiService.publishNamespace(ReleaseOpenApiService.java:35) ~[apollo-openapi-1.2.0.jar:1.2.0]
... 65 common frames omitted
[root@hadoop daxing]# /home/daxing/apollo-configservice-1.3.0-github/scripts/startup.sh
[root@hadoop daxing]# /home/daxing/apollo-adminservice-1.3.0-github/scripts/startup.sh
[root@hadoop daxing]# /home/daxing/apollo-portal-1.3.0-github/scripts/startup.sh
參考:
https://segmentfault.com/a/1190000019094867
https://segmentfault.com/a/1190000018867350