Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issues #1696 添加持久化支持,可选持久化选项:nacos、apollo、zookeeper ; 修改 README.md 说明文档 #1711

Closed
wants to merge 7 commits into from

Conversation

jnan806
Copy link
Contributor

@jnan806 jnan806 commented Sep 1, 2020

Signed-off-by: jiajiangnan jiajiangnan.office@foxmail.com

Fixes Issues #1696
1、添加持久化支持,可选持久化选项:nacos、apollo、zookeeper
2、修改 README.md 和 Sentinel_Dashboard_Feature.md 说明文档

Describe what this PR does / why we need it

Extended persistence module. We can persistent the configs of rules into config-center like nacos,apollo,zookeeper. It can make sure the rule configs could make work even if we restart the sentinel-dashbord or sentinel client in applications. Now,this PR is also adapte to the web views,the views is not needed to modify at all.

Does this pull request fix one issue?

Fixes Issues #1696

Describe how you did it

1、Add config items in springboot config files such as application.properties. These config items is the settings that config-center needed. When sentinel-dashboard is starting, Spring will identify which config-center is configed, or used the memory as the default store.
2、All kinds of config-center has it's self Rules ManageClient which constructed by @configuration, but only one will be construct by sentinel-dashboard started because the @configuration has condition. The only one is that be configed in application.preperties. We can manage the rules through ManageClient.
3、There is a condition sentences to ensure that the old code still worked. If the item added in application is memory, then use the default "sentinelApiClient", else use the Client constructed by @configuration.

Describe how to verify it

Before:
1、add the following config items in application.properties:
datasource.provider=nacos
datasource.provider.nacos.server-addr=ip:port
2、run sentinel-dashboard
3、application which inclues sentinel-client ,config to the same config-center

After:
1、manage rules in sentinel-dashboard, search the configs in config-center, do some request in application which inclues sentinel-client
2、manage rules in config-center, search the rules in dashboard, do some request in application which inclues sentinel-client
3、Because of this PR has adapt the default memory store,and also adapt the web view, so we can test directly in the old web pages.

Special notes for reviews

1、this PR has adapt the default memory store,and also adapt the web view, so we can test directly in the old web pages.

@jnan806
Copy link
Contributor Author

jnan806 commented Sep 1, 2020

代码已提交,麻烦 review

@sczyh30 sczyh30 added area/dashboard Issues or PRs about Sentinel Dashboard size/XXL Indicate a PR that changes 1000+ lines. labels Sep 1, 2020
@jnan806
Copy link
Contributor Author

jnan806 commented Sep 2, 2020

different kind of config-center has it's own config items, details in the follow pic has added into “Sentinel_Dashboard_Feature.md”.
Please review code and do some test , Thanks.
68F338C8-2FBC-443D-82AF-F8BFB0F29DA7

…es.java matched to application.properties

Signed-off-by: jiajiangnan <jiajiangnan.office@foxmail.com>
@jnan806
Copy link
Contributor Author

jnan806 commented Sep 2, 2020

has commit the Properties file that was forgotten to commit, which will cause rules couldn't persist into datassource of config-center. So sorry for it.

jiajiangnan added 3 commits September 2, 2020 10:59
Signed-off-by: jiajiangnan <jiajiangnan.office@foxmail.com>
Signed-off-by: jiajiangnan <jiajiangnan.office@foxmail.com>
…okeeper.

Signed-off-by: jiajiangnan <jiajiangnan.office@foxmail.com>
@jnan806
Copy link
Contributor Author

jnan806 commented Sep 2, 2020

@sczyh30 Could you please take a time to help review the code? Thanks ~

@lly835
Copy link

lly835 commented Nov 17, 2020

没人管了?

jiajiangnan added 2 commits November 18, 2020 14:07
…atasource.Converter" bean in ZookeeperApiClient when datasource is zookeeper .

Signed-off-by: jiajiangnan <jiajiangnan.office@foxmail.com>
Signed-off-by: jiajiangnan <jiajiangnan.office@foxmail.com>
@ConnorLH
Copy link

搞不懂为什么官方不添加持久化功能的神操作啊,开源虽然是阉割版,但是dashboard应该是生产可用的啊。

@slin1972
Copy link

以jar启动 不兼容-D的配置方式? 修改代码里面的application.properties启动OK

@slin1972
Copy link

@jiajiangnan
得通过spring的参数声明方式
如下:
java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar --datasource.provider=nacos --datasource.provider.nacos.server-addr=localhost:8844 --datasource.provider.nacos.username=nacos --datasource.provider.nacos.password=nacos --datasource.provider.nacos.namespace=d296f6d7-559c-4430-9c20-b9ec9db58342

@slin1972
Copy link

目前测试 是可用的

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


jiajiangnan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@wenbochang888
Copy link

mark

@wenbochang888
Copy link

目前测试 是可用的

@slin1972 启动不知道为什么不兼容-D。

我试了试 --datasource.provider=nacos 这种方式,目前zk报错

2021-04-06 19:58:44.970  WARN 5029 --- [           main] o.a.zookeeper.client.StaticHostProvider  : No IP address found for server: localhhost:2181

java.net.UnknownHostException: localhhost: Name or service not known
	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:na]
	at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929) ~[na:na]
	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515) ~[na:na]
	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) ~[na:na]
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[na:na]
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1364) ~[na:na]
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1298) ~[na:na]

@wenbochang888
Copy link

@Configuration
@ConditionalOnProperty(prefix = DataSourceProperties.PREFIX_DATASOURCE, name = DataSourceProperties.NAME_PROVIDER, havingValue = DataSourceProperties.VALUE_PROVIDER_ZOOKEEPER, matchIfMissing = false)
public class ZookeeperConfiguration {

    @Autowired
    private ZookeeperProperties zookeeperProperties;

    @Bean
    public CuratorFramework zkClient() {
        ExponentialBackoffRetry exponentialBackoffRetry =  new ExponentialBackoffRetry(zookeeperProperties.getBaseSleepTime(), zookeeperProperties.getMaxRetries(), zookeeperProperties.getMaxSleepTime());
        CuratorFramework zkClient = CuratorFrameworkFactory.newClient("localhhost:2181", exponentialBackoffRetry);
        zkClient.start();
        return zkClient;
    }
} 

CuratorFramework zkClient = CuratorFrameworkFactory.newClient("localhhost:2181", exponentialBackoffRetry);
这一块是bug把,怪不得不能用-D

@kuangyoubo
Copy link

When will this feature be available? Too slow.

@350478992
Copy link

350478992 commented Sep 4, 2021

我以为过去一年了,应该合并到release了吧,进来一看,还是open的呀,失望。。。

@ruoshuixuelabi
Copy link

一年多了,是什么原因导致没合并到master分支呢?

@kuangyoubo
Copy link

kuangyoubo commented Sep 11, 2021 via email

@kuangyoubo
Copy link

一年多了,是什么原因导致没合并到master分支呢?

代码已提交,麻烦 review

@jiajiangnan 你那个分支是哪一个,我看看

@zznan0o0
Copy link

zznan0o0 commented Jan 6, 2022

@slin1972 你那个方式是修改源码之后的还是官方打包的jar包就已经支持了呢?

@jnan806 jnan806 closed this Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard Issues or PRs about Sentinel Dashboard size/XXL Indicate a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet