apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.79k stars 6.7k forks source link

Whether SPI can be added for shardingjdbc driver to enable the community to expand more url support #22834

Open Zhai6319 opened 1 year ago

Zhai6319 commented 1 year ago

Feature Request

Whether SPI can be added for shardingjdbc driver to enable the community to expand more url support

Hopes to provide SPI for org.apache.shardingsphere.driver

The community can expand relevant plug-ins For example: spring.datasource.url=jdbc:shardingsphere:classpath:xxx.yaml The classpath in this configuration can be configured as nacos, spring cloud config or other configuration centers jdbc:shardingsphere:{nacos/spring-cloud-config/classpath}:{ip}:{port}:{username}:{password}:{namespace}:xxx.yaml Then drive plug-ins to obtain different configurations

zhaojinchao95 commented 1 year ago

Sounds good, need more feedback and discuss.

RaigorJiang commented 1 year ago

Is the effect similar to configuring these information in cluster mode of YAML ?

zt9788 commented 1 year ago

@zhaojinchao95 @RaigorJiang relevance issue https://github.com/apache/shardingsphere/issues/22790

Zhai6319 commented 1 year ago

Sounds good, need more feedback and discuss.

What information does metadata store? Why do I use cluster mode After starting the service once Change the configuration again and restart. The changed configuration does not take effect Whether this part of configuration data should not be registered as metadata Should metadata be changed according to the latest configuration data

I always find cluster mode awkward to use Nobody feels the same as me?

Zhai6319 commented 1 year ago

Regression

The client sdk provided by nacos provides relevant interfaces The nacos configuration center also provides relevant http interfaces I think you can get the relevant yaml configuration from the configuration center by changing the url format After you get the yaml configuration, the following processing is the same I believe that other configuration centers besides nacos also provide relevant interfaces

The url format can be consistent with other data source formats jdbc:shardingsphere:nacos://127.0.0.1:8848/{namespace}?username={xxx}&password={xxx}&group={xxx}&dataId={xxx.yaml}

zt9788 commented 1 year ago

Sounds good, need more feedback and discuss.

What information does metadata store? Why do I use cluster mode After starting the service once Change the configuration again and restart. The changed configuration does not take effect Whether this part of configuration data should not be registered as metadata Should metadata be changed according to the latest configuration data

I always find cluster mode awkward to use Nobody feels the same as me?

If the service is deployed in containers, it is more difficult to configure

wanghongbin73 commented 1 year ago

ShardingSphere-jdbc 5.3之后的配置方式,对于目前spring cloud方式太不友好,我们使用的是config配置中心,生产环境和测试环境使用的同一个镜像容器,各环境yml都是拉取的配置中心信息,但是按照5.3配置sharding.yaml需要打包到jar包中,对于目前的项目无法升级,新项目也无法采用新版本

RaigorJiang commented 1 year ago

Hi @wanghongbin73 Only English is accepted here, thank you!

wanghongbin73 commented 1 year ago

The configuration method after ShardingSphere-jdbc 5.3 is too unfriendly for the current spring cloud method. We use the config configuration center. The production environment and the test environment use the same image container. The yml of each environment is the pulled configuration center information. However, according to the 5.3 configuration, sharding.yaml needs to be packaged into the jar package. The current project cannot be upgraded and the new project cannot adopt the new version

RaigorJiang commented 1 year ago

@wanghongbin73 Thanks for the feedback, this question really needs to be considered. There is also a reason for ShardingSphere to remove the previous Spring configuration, because the configuration method of SpringBoot has changed again, and adapting it will bring a lot of extra work to the ShardingSphere community.

wanghongbin73 commented 1 year ago

@RaigorJiang Thank the ShardingSphere community for its hard work