阿里Sentinel控制台源码修改-对接Apollo规则持久化

搭建文档参考

https://segmentfault.com/a/1190000019094867

 

d741cedc9b4e1ff6763a689a85af72c7aee.jpg

api功能测试

参考文档 https://github.com/ctripcorp/apollo/wiki/Apollo%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0

 第 3.2.1 节  获取App的环境,集群信息

40c91a99abb95861fa1034aa180ebdf3854.jpg

 

下载 sentinel 1.6 源码,拷贝test 目录下的 apollo到工程的rule目录下

eea420c9ef9fc9c33c34fd1e7879b147b50.jpg

 

 

 


 

解决 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://gitee.com/jxlgzwh/sentinel-1.6.0

对接 apollo v1.3.0  测试成功

 

 

参考:

https://segmentfault.com/a/1190000019094867

https://segmentfault.com/a/1190000018867350

https://segmentfault.com/a/1190000018723850

https://segmentfault.com/a/1190000018608117

 

https://github.com/alibaba/Sentinel/wiki/%E5%9C%A8%E7%94%9F%E4%BA%A7%E7%8E%AF%E5%A2%83%E4%B8%AD%E4%BD%BF%E7%94%A8-Sentinel

动态规则扩展

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

 

转载于:https://my.oschina.net/zhongwenhao/blog/3054311

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值