You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/12 08:53:42 UTC

[GitHub] [shardingsphere] zt9788 opened a new issue, #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

zt9788 opened a new issue, #22790:
URL: https://github.com/apache/shardingsphere/issues/22790

   ## Question
   ShardingShpere-JDBC 5.3.0
   
   the url: jdbc:shardingsphere:classpath:db.yml
   file:
   ```
   ....
   rules:
     - !READWRITE_SPLITTING 
     ....
   ```
   How can. i use the Nacos import the db.yml
   ```
   spring:
      config:
         import:
           - nacos:db.yml # it is will be error about (can not read...   - !READWRITE_SPLITTING ...)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346042280

   @sandynz  Thanks ,if you have time, hope you follow this issue again(about SpringCloud)
   Hi, @Zhai6319 If you have no other question about this, I will close this Issue 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345827026

   @zt9788 
   
   > But once Spring Cloud (config) is used, when the DataSource attribute is dynamically configured
   > 
   > The current way is too difficult
   > 
   > If we can provide CreateDataSource(bean), we can manually create it after loading yaml ourselves
   
   Seems Spring support creating bean by method, could we just use `new ShardingSphereDataSource` to support `CreateDataSource(bean)`?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346103097

   I asked the author of Nacos repository impl to check it too, https://github.com/apache/shardingsphere/pull/20984#issuecomment-1346095510


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346070357

   > @sandynz Thanks ,if you have time, hope you follow this issue again(about SpringCloud) Hi, @Zhai6319 If you have no other question about this, I will close this Issue
   
   
   I don't understand what these two documents improve
   What does module dependency mean?
   The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   In addition, when the project is started, the registration of metadata is slow and often times out
   I tried to switch to the zookeeper registry. The project started directly and reported an error, prompting that the druid data source was closed
   
   
   The following questions are raised by me #22802


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346116587

   > @Zhai6319
   > 
   > > The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   > 
   > Looks there's newline in content. I didn't try Nacos before, it works in ZooKeeper, and ShardingSphere just persist key-value to registry center via SPI, it should work on Nacos too.
   > 
   > Could you debug `NacosRepository.put/update` to check whether the value contains correct newline (one char `\n`, but not two chars `\` and `n`)?
   
   
   > @Zhai6319
   > 
   > > The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   > 
   > Looks there's newline in content. I didn't try Nacos before, it works in ZooKeeper, and ShardingSphere just persist key-value to registry center via SPI, it should work on Nacos too.
   > 
   > Could you debug `NacosRepository.put/update` to check whether the value contains correct newline (one char `\n`, but not two chars `\` and `n`)?
   
   
   Can this metadata be registered through the configuration center of nacos?
   
   What is the purpose of registering as a service?
   
   Do these all need to be connected in the form of IP+ports and each metadata instance of nacos


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in Springboot

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345495927

   Hi @zt9788
   
   1, Does import db.yml to spring configuration work? (You  could try to embed it manually to test)
   
   2, Maybe you  could check spring or Nacos documentation to find out how to import another configuration file. (I don't know what the second configuration type is)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346217916

   > > @Zhai6319
   > > +1
   > > > > @Zhai6319
   > > > > > The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   > > > > 
   > > > > 
   > > > > Looks there's newline in content. I didn't try Nacos before, it works in ZooKeeper, and ShardingSphere just persist key-value to registry center via SPI, it should work on Nacos too.
   > > > > Could you debug `NacosRepository.put/update` to check whether the value contains correct newline (one char `\n`, but not two chars `\` and `n`)?
   > > > 
   > > > 
   > > > Can this metadata be registered through the configuration center of nacos?
   > > > What is the purpose of registering as a service?
   > > > Do these all need to be connected in the form of IP+ports and each metadata instance of nacos
   > > 
   > > 
   > > +1 I think ShardingShpere-JDBC depends more on user configuration Sharding-Porxy to use cluster by it self
   > 
   > @sandynz About this question
   > 
   > I think the article can be driven by jdbc Provide org.apache.shardingsphere.driver SPI of ShardingSphereDriver 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}:{ip}:{port}:{username}:{password}:{namespace}:xxx.yaml Then drive plug-ins to obtain different configurations
   
   @sandynz 
   
   I mean, the JDBC url: part gives users more choices
   JDBC and SpringCloud cannot be used together in a lightweight way, while using Cluster increases maintenance costs
   
   > Cluster mode is optional for Proxy and JDBC
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in Springboot

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345745310

   @sandynz 
   
   OK, I still suggest increasing support for Spring , 
   
   If the configuration center is used, the current way is too complicated.
   
   Especially when upgrading from a lower version, the overall configuration needs to be rewritten
   
   hope the community can consider it!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345790925

   @Zhai6319 
   Yes, I think it is OK,
   Use the Api to create DataSource can be create mutli datasources, or dynamically DataSrouce 
   You can use the Map to manager your dataSrouces 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345927557

   @zt9788 , I didn't use Spring Cloud before.
   
   You could try to configure Cluster mode in ShardingSphere yaml, Nacos is supportted, refer to [Metadata Repository]( https://shardingsphere.apache.org/document/5.3.0/cn/user-manual/common-config/builtin-algorithm/metadata-repository/ ) for more details.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346153675

   > @Zhai6319
   > 
   > +1
   > 
   > > > @Zhai6319
   > > > > The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   > > > 
   > > > 
   > > > Looks there's newline in content. I didn't try Nacos before, it works in ZooKeeper, and ShardingSphere just persist key-value to registry center via SPI, it should work on Nacos too.
   > > > Could you debug `NacosRepository.put/update` to check whether the value contains correct newline (one char `\n`, but not two chars `\` and `n`)?
   > > 
   > > 
   > > Can this metadata be registered through the configuration center of nacos?
   > > What is the purpose of registering as a service?
   > > Do these all need to be connected in the form of IP+ports and each metadata instance of nacos
   > 
   > +1 I think ShardingShpere-JDBC depends more on user configuration Sharding-Porxy to use cluster by it self
   
   @sandynz 
   About this question
   
   I think the article can be driven by jdbc
   Provide org.apache.shardingsphere.driver SPI of ShardingSphereDriver
   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}:{ip}:{port}:{username}:{password}:{namespace}:xxx.yaml
   Then drive plug-ins to obtain different configurations


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in Springboot

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345750358

   > @sandynz
   > 
   > OK, I still suggest increasing support for Spring ,
   > 
   > If the configuration center is used, the current way is too complicated.
   > 
   > Especially when upgrading from a lower version, the overall configuration needs to be rewritten
   > 
   > hope the community can consider it!
   
   
   
   I agree. I hope the community will consider


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in Springboot

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345778586

   @zt9788 , @Zhai6319 , thanks for your feedback.
   You could have a look at #22469 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345968570

   > @zt9788 , I didn't use Spring Cloud before.
   > 
   > You could try to configure Cluster mode in ShardingSphere yaml, Nacos is supportted, refer to [Metadata Repository](https://shardingsphere.apache.org/document/5.3.0/cn/user-manual/common-config/builtin-algorithm/metadata-repository/) for more details.
   
   The metadata stored in nacos is really hard to read
   It's hard to find anything you want to change
   
   ![image](https://user-images.githubusercontent.com/29478697/206977131-a0cd8798-c67a-4903-b827-474f36a92b94.png)
   
   ![image](https://user-images.githubusercontent.com/29478697/206976988-361ac525-6fbf-4815-87d1-5b9e62b607e0.png)
   ![image](https://user-images.githubusercontent.com/29478697/206977047-ee33908b-4673-4752-911f-203765a00486.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345960994

   @sandynz 
   I had try it 
   
   ```
   mode:
     type: Cluster
     repository:
       type: nacos
       props:
         namespace: xxxxx
         server-lists: xxxx:8848 
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
   ```
   There is Error for (Nacos,nacos)
   ```
    c.z.h.p.HikariPool.throwPoolInitializationException(594): - master - Exception during pool initialization.
   org.apache.shardingsphere.infra.util.spi.exception.ServiceProviderNotFoundServerException: SPI-00001: No implementation class load from SPI `org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository` with type `nacos`.
   	at org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.getRegisteredService(TypedSPIRegistry.java:117) ~[shardingsphere-infra-util-5.3.0.jar:5.3.0]
      .....
   ```
   
   I try to find SPI for nacos implements ,but i am not find that (jar) ,Is that need to implement by myself?
   
   it's too hard :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345786445

   @sandynz 
   
   I don't think it conflicts
   
   The 5.3.0 configuration mode of the separate SpringBoot has great advantages
   
   But once `Spring Cloud (config)` is used, when the DataSource attribute is dynamically configured
   
   The current way is too difficult
   
   If we can provide `CreateDataSource(bean)`, we can manually create it after loading yaml ourselves
   
   Or use the yaml format that can be parsed by Spring


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345844987

   @sandynz 
   
   Well, maybe I'm not say it very clear
   I want to express that it will be more troublesome to use this way
   
   Because the yaml of ShardingSpere cannot be recognized by Spring now, the bean cannot be directly imported, and the classpath method must be used
   
   If the configuration center is used, Spring Cloud usually imports the config bean in the configuration center directly
   
   In this case,I can only re create a yaml file that can read by spring, and then import them into the bean(this bean to split databaseName, modeConfig, dataSourceMap, ruleConfigs, props) , submit them to Sharding's [create](https://shardingsphere.apache.org/document/5.3.0/cn/user-manual/shardingsphere-jdbc/java-api/) method(**like i create a spring-boot-starter by myself**)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345975070

   😱😱😱😱 😂 😂 😂 😂


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346193524

   @Zhai6319 , you could start another issue to discuss it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346031294

   @zt9788, @Zhai6319 , thanks for your feedback.
   
   I've created 2 related issues to improve module dependency and document. #22819 , #22821
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 closed issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 closed issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud
URL: https://github.com/apache/shardingsphere/issues/22790


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in Springboot

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345579483

   @zt9788 
   
   5.3.0 has removed spring api, there're 2 ways to create ShardingSphereDataSource:
   - By [YAML Configuration]( https://shardingsphere.apache.org/document/5.3.0/cn/user-manual/shardingsphere-jdbc/yaml-config/mode/ ). If it could not be loaded by ShardingSphereDriverURL for now, then try the second way.
   - By [Java API]( https://shardingsphere.apache.org/document/5.3.0/cn/user-manual/shardingsphere-jdbc/java-api/mode/ ).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345993830

   @zt9788 , have you imported `shardingsphere-cluster-mode-repository-nacos` dependency?
   
   The implementation class is `NacosRepository`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346066960

   > The metadata stored in nacos is really hard to read
   > It's hard to find anything you want to change
   
   I don't understand what these two documents improve
   What does module dependency mean?
   The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   In addition, when the project is started, the registration of metadata is slow and often times out
   I tried to switch to the zookeeper registry. The project started directly and reported an error, prompting that the druid data source was closed
   
   The following questions are raised by me
   #22802 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346099351

   @zt9788
   Otherwise, don't close it. Maybe other people have the same question. Please refer to


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346125795

   @Zhai6319 
   
   +1
   
   > > @Zhai6319
   > > > The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   > > 
   > > 
   > > Looks there's newline in content. I didn't try Nacos before, it works in ZooKeeper, and ShardingSphere just persist key-value to registry center via SPI, it should work on Nacos too.
   > > Could you debug `NacosRepository.put/update` to check whether the value contains correct newline (one char `\n`, but not two chars `\` and `n`)?
   > 
   > Can this metadata be registered through the configuration center of nacos?
   > 
   > What is the purpose of registering as a service?
   > 
   > Do these all need to be connected in the form of IP+ports and each metadata instance of nacos
   
   +1 
   I think ShardingShpere-JDBC  depends more on user configuration 
   Sharding-Porxy to use cluster by it self
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in Springboot

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345560346

   > Hi @zt9788
   > 
   > 1, Does import db.yml to spring configuration work? (You could try to embed it manually to test)
   
   @sandynz 
   
   Well, SpringBoot can not read `- !`... like `!READWRITE_SPLITTING `
   even if Springboot read the yaml ,that alwasy a bean , and can not to set the Url( I saw the Sharding use the `getResoueAsStream` or `FileInputStream` in `ShardingSphereDriverURL`
   
   > 2, Maybe you could check spring or Nacos documentation to find out how to import another configuration file. (I don't know what the second configuration type is)
   
   yes, i can create datasouce use the createDataSouce Api
   like :
   use nacos-client(other config  center) read yml and when the program start to use the shardingShpere  `createDataSouce` 
   but I think the way is complex ,(if the api changed , I need upgrade configuration everytime)
   
   so, I want to know ,will the shardingshpere support another way to config the DataSource ,like url: beanName?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Zhai6319 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
Zhai6319 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1345788781

   > @sandynz
   > 
   > I don't think it conflicts
   > 
   > The 5.3.0 configuration mode of the separate SpringBoot has great advantages
   > 
   > But once `Spring Cloud (config)` is used, when the DataSource attribute is dynamically configured
   > 
   > The current way is too difficult
   > 
   > If we can provide `CreateDataSource(bean)`, we can manually create it after loading yaml ourselves
   > 
   > Or use the yaml format that can be parsed by Spring
   
   
   
   Does this mean that in addition to the data source configured in yaml,
   
   At the same time, can I add new data sources in the running process?
   
   For example, for multi tenant, can the program create a new database instance for the tenant when creating the tenant, and dynamically add the data source of the new instance in the program?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346028416

   @sandynz 
   OK,I will try it.
   but i saw the code ,it did not looks like what i want. 😭 Let me think about other ways to support SpringCloud
   Thank you for your reply
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 closed issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 closed issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud
URL: https://github.com/apache/shardingsphere/issues/22790


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346098502

   @Zhai6319 
   > The main problem for me is that the metadata registered in nacos has no format at all. It is difficult to change the metadata parameters
   
   Looks there's newline in content. I didn't try Nacos before, it works in ZooKeeper, and ShardingSphere just persist key-value to registry center via SPI, it should work on Nacos too.
   
   Could you debug `NacosRepository.put/update` to check whether the value contains correct newline (one char `\n`, but not two chars `\` and `n`)?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zt9788 commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
zt9788 commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346110043

   > @zt9788 Otherwise, don't close it. Maybe other people have the same question. Please refer to
   Sorry ,I reopen it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22790: 5.3.0 How to import config file by Nacos(config) in SpringCloud

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22790:
URL: https://github.com/apache/shardingsphere/issues/22790#issuecomment-1346199296

   @zt9788 
   > I think ShardingShpere-JDBC depends more on user configuration
   > Sharding-Porxy to use cluster by it self
   
   Cluster mode is optional for Proxy and JDBC
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org