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 2021/01/30 09:39:17 UTC

[GitHub] [shardingsphere] AI1186780944 opened a new issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

AI1186780944 opened a new issue #9228:
URL: https://github.com/apache/shardingsphere/issues/9228


   ## Question
   How can shardingsphere use read-write separation and data desensitization at the same time?
   
   the version:sharding-jdbc:4.1.1
   
   In actual use, I found that if the configuration of read-write separation and data desensitization is added at the same time, the bean of "platformtransactionmanager" class cannot be found. The reason is that "encrypydatasource" and "masterslavedatasource" are generated, which will cause an exception that cannot normally inject transactionmanager into bean, resulting in service startup failure.
   
   At the same time, based on this exception, I have tried to specify the data source manually. But it also involves the injection of entity manager factory. Usually, the entity manager factory is closely related to the session factory. The session factory of each data source is a different object.
   
   After carefully reading the documents you provided, I found that you only gave the examples of data fragmentation and read-write separation, and data fragmentation and data desensitization, but not the examples of read-write separation and data desensitization. Is it not supported to use these two functions at the same time?
   
   My configuration is as follows:
   
   spring.shardingsphere.sharding.default-data-source-name=master
   
   spring.shardingsphere.datasource.master.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.master.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.master.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/order?useUnicode=true&characterEncoding=utf-8&#useSSL=false&serverTimezone=GMT%2B8
   spring.shardingsphere.datasource.master.username=test_rw
   spring.shardingsphere.datasource.master.password=Kyig&pnlGnaHaJ
   
   spring.shardingsphere.datasource.slave.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.slave.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.slave.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/order?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
   spring.shardingsphere.datasource.slave.username=test_rw
   spring.shardingsphere.datasource.slave.password=Kyig&pnlGnaHaJ
   
   spring.shardingsphere.masterslave.name=testMaster1Slave1
   spring.shardingsphere.masterslave.master-data-source-name=master
   spring.shardingsphere.masterslave.slave-data-source-names=slave
   spring.shardingsphere.props.sql.show=true
   
   spring.shardingsphere.sharding.default-database-strategy.hint.algorithm-class-name=xxx
   
   spring.shardingsphere.encrypt.encryptors.encryptor_aes.type=aes
   spring.shardingsphere.encrypt.encryptors.encryptor_aes.props.aes.key.value=xxxxxxxx
   spring.shardingsphere.props.query.with.cipher.column=fasle
   spring.shardingsphere.encrypt.tables.order_item_guardian.columns.id_no.plainColumn=id_no
   spring.shardingsphere.encrypt.tables.order_item_guardian.columns.id_no.cipherColumn=id_no_encrypt
   spring.shardingsphere.encrypt.tables.order_item_guardian.columns.id_no.encryptor=encryptor_aes


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu closed issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9228:
URL: https://github.com/apache/shardingsphere/issues/9228


   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] lmhmhl commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   > @AI1186780944 ,
   > 
   > Yep, Ver 5.0.0-alpha supports creating a logic `Datasource` to leverage `sharding`, `encryption`, and `replicaQuery` together. We will provide some of the mixed configuration examples in the document. By now, I suggest you look at #9249 (from @lmhmhl) to get some hints.
   > 
   > @lmhmhl Would you like to add such mixed configuration examples in our documents referring to your PR [HERE](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/configuration/yaml/)(A new child-section)?
   @tristaZero 
   Sure, It's my honor.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu edited a comment on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

Posted by GitBox <gi...@apache.org>.
terrymanu edited a comment on issue #9228:
URL: https://github.com/apache/shardingsphere/issues/9228#issuecomment-771501818


   I create the empty files for mix rules configuration on issue: #9268
   
   Please fill the configuration description here.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] tristaZero commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   Hi @AI1186780944 ,
   
   Thanks for your feedback. The doc needs to provide mixed configuration examples for users. You're right; it is possible to do Encryption and MasterSlave together.
   I just wonder whether your configuration works 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



[GitHub] [shardingsphere] tristaZero commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   @AI1186780944 ,
   
   Yep, Ver 5.0.0-alpha supports creating a logic `Datasource` to leverage `sharding`, `encryption`, and `replicaQuery` together. We will provide some of the mixed configuration examples in the document. By now, I suggest you look at #9249 (from @lmhmhl) to get some hints.
   
   @lmhmhl Would you like to add such mixed configuration examples in our documents referring to your PR [HERE](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/configuration/yaml/)(A new child-section)?


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   I create the empty files for mix rules configuration on issue:
   https://github.com/apache/shardingsphere/pull/9268
   
   Please fill the configuration description here.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu edited a comment on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

Posted by GitBox <gi...@apache.org>.
terrymanu edited a comment on issue #9228:
URL: https://github.com/apache/shardingsphere/issues/9228#issuecomment-771501818


   I create the empty files for mix rules configuration on issue: #9268
   
   Please fill the configuration description here.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] lmhmhl commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   > @AI1186780944 ,
   > 
   > Yep, Ver 5.0.0-alpha supports creating a logic `Datasource` to leverage `sharding`, `encryption`, and `replicaQuery` together. We will provide some of the mixed configuration examples in the document. By now, I suggest you look at #9249 (from @lmhmhl) to get some hints.
   > 
   > @lmhmhl Would you like to add such mixed configuration examples in our documents referring to your PR [HERE](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/configuration/yaml/)(A new child-section)?
   @tristaZero 
   Sure, It's my honor.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] AI1186780944 commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   Hi @tristaZero 
   Thanks for your feedback. The configuration doesn't work.Your code implementation logic doesn't support this kind of collocation.The reason is that there are two data sources:"encrypydatasource" and "masterslavedatasource".They are created by two DataSourceFactory.Because there are two DataSourceFactory, two transaction managers are generated. This will make the spring container not know which TransactionManager to register, resulting in an error.Moreover, EncrypyDatasourceFactoryand MasterSlavedDatasourceFactory do not provide an interface that allows users to specify transaction managers freely.
   Your version of 5.0.0-alpha is supported.Because the data source type accepted by this data source factory is map type.I can create my various configuration rules and data sources in the same factory. Only one transaction manager is generated.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   Issue #9286 for the document.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] terrymanu commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   I create the empty files for mix rules configuration on issue:
   https://github.com/apache/shardingsphere/pull/9268
   
   Please fill the configuration description here.


----------------------------------------------------------------
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



[GitHub] [shardingsphere] tristaZero commented on issue #9228: How can shardingsphere use read-write separation and data desensitization at the same time?

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


   @AI1186780944 ,
   
   Yep, Ver 5.0.0-alpha supports creating a logic `Datasource` to leverage `sharding`, `encryption`, and `replicaQuery` together. We will provide some of the mixed configuration examples in the document. By now, I suggest you look at #9249 (from @lmhmhl) to get some hints.
   
   @lmhmhl Would you like to add such mixed configuration examples in our documents referring to your PR [HERE](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/configuration/yaml/)(A new child-section)?


----------------------------------------------------------------
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