Replies: 5 comments
-
Hi @tts2, From the provided configuration, you don’t understand the meaning of each item, please read the configuration manual and examples first to help you complete the task. |
Beta Was this translation helpful? Give feedback.
-
For example: In SaaS mode, each user (id=SC_202307311826340001) has their own database, and the data needs to be isolated. I want to know if Sharding Proxy can achieve this? |
Beta Was this translation helpful? Give feedback.
-
Yes this is common usage, you can use |
Beta Was this translation helpful? Give feedback.
-
Can you achieve storing the database data into your own database based on the tenant ID? |
Beta Was this translation helpful? Give feedback.
-
Who should we contact for business consultation? We might need custom development. |
Beta Was this translation helpful? Give feedback.
-
Question
For English only, other languages will not accept.
Before asking a question, make sure you have:
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.
Table Name:
orderinfo
config-sharding.yaml
databaseName: restaurant_db
dataSources:
common_db:
url: jdbc:mysql://localhost:3306/restaurant?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
pm_sc_2017112116450001_db:
url: jdbc:mysql://localhost:3306/pm_sc_2017112116450001_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
pm_sc_2017112116450002_db:
url: jdbc:mysql://localhost:3306/pm_sc_2017112116450002_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
pm_sc_2017112116460003_db:
url: jdbc:mysql://localhost:3306/pm_sc_2017112116460003_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
!SHARDING
tables:
orderinfo:
actualDataNodes: $->{order_type=='sc_2017112116450002'?'pm_sc_2017112116450002_db':'common_db'}.orderinfo
tableStrategy:
none:
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
Error:
Exception in thread "main" groovy.lang.MissingPropertyException: No such property: order_type for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:67) at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.unwrap(IndyGuardsFiltersAndSignatures.java:161)
Beta Was this translation helpful? Give feedback.
All reactions