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 2020/01/13 03:25:47 UTC

[GitHub] [incubator-shardingsphere] longzhihun opened a new issue #3948: How to config the customize rule in sharding-proxy

longzhihun opened a new issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948
 
 
   1. I have customized the sharding rule with java code.
   
   > public class DbShardingAlgorithm implements PreciseShardingAlgorithm {
   
       private static Logger logger = LoggerFactory.getLogger(DbShardingAlgorithm.class);
   
       Map<String, String> dealerDSMap = ImmutableMap.of("d16df3743a", "ds0",
               "bc0ce9b058", "ds1",
               "85abb5f5d2", "ds2",
               "b563165232", "ds3",
               "f0f198b56d", "ds4");
   
   
       @Override
       public String doSharding(Collection collection, PreciseShardingValue preciseShardingValue) {
   
           if ("dealer_id".equals(preciseShardingValue.getColumnName())) {
               String dealerId = (String) preciseShardingValue.getValue();
               return dealerDSMap.get(dealerId);
           }
           return "ds0";
       }
   }
   
   when i set the class file to the proxy home dir. got a error message:
   
   > java.lang.ClassNotFoundException: io.shardingsphere.api.algorithm.sharding.standard.PreciseShardingAlgorithm
   
   I dont know how to handle it. please help me.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573530442
 
 
   @dongzl Yes, 4.0.0-RC3, but we can only find the "sharding-core:3.1.0" on maven central.  so which version sharding core should we depend on in my pom.xml,  we are trying to customize sharding with java code, please help me.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573533668
 
 
   will try it ASAP. @dongzl 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573539045
 
 
   @dongzl it works now, from my side, i think we'd better to add the information to our guildline, i have search many sites, got no useful message.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] dongzl commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
dongzl commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573503410
 
 
   @longzhihun what's your porxy version? package a jar file to lib directory, try 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] dongzl commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
dongzl commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573521689
 
 
   the latest version?which?4.0.0-RC3?
   
   the latest version‘s package is `org.apache.shardingsphere.xxx.xxx`, but your exception is `io.shardingsphere`, this is a very old version.
   
   Please make sure your version firstly.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] dongzl commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
dongzl commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573531980
 
 
   <groupId>org.apache.shardingsphere</groupId>
   <artifactId>sharding-jdbc-core</artifactId>
   <version>4.0.0-RC3</version>
   
   Does it work well?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] longzhihun closed issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
longzhihun closed issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] dongzl edited a comment on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
dongzl edited a comment on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573531980
 
 
   ```
   <groupId>org.apache.shardingsphere</groupId>
   <artifactId>sharding-jdbc-core</artifactId>
   <version>4.0.0-RC3</version>
   ```
   Does it work well?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573495819
 
 
   ![image](https://user-images.githubusercontent.com/17509151/72231687-d3831980-35f7-11ea-8ab1-b96bb9a632a9.png)  add class path.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy

Posted by GitBox <gi...@apache.org>.
longzhihun commented on issue #3948: How to config the customize rule in sharding-proxy
URL: https://github.com/apache/incubator-shardingsphere/issues/3948#issuecomment-573520355
 
 
   @dongzl the latest version! OK, I will try it, then feedback to you

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services