YAML configuration

5.0.0-alpha

Data Sharding

Configuration Item Explanation

  1. dataSources: # Omit the data source configuration, please refer to the usage
  2. rules:
  3. - !SHARDING
  4. tables: # Sharding table configuration
  5. <logic-table-name> (+): # Logic table name
  6. actualDataNodes (?): # Describe data source names and actual tables (refer to Inline syntax rules)
  7. databaseStrategy (?): # Databases sharding strategy, use default databases sharding strategy if absent. sharding strategy below can choose only one.
  8. standard: # For single sharding column scenario
  9. shardingColumn: # Sharding column name
  10. shardingAlgorithmName: # Sharding algorithm name
  11. complex: # For multiple sharding columns scenario
  12. shardingColumns: # Sharding column names, multiple columns separated with comma
  13. shardingAlgorithmName: # Sharding algorithm name
  14. hint: # Sharding by hint
  15. shardingAlgorithmName: # Sharding algorithm name
  16. none: # Do not sharding
  17. tableStrategy: # Tables sharding strategy, same as database sharding strategy
  18. keyGenerateStrategy: # Key generator strategy
  19. column: # Column name of key generator
  20. keyGeneratorName: # Key generator name
  21. autoTables: # Auto Sharding table configuration
  22. t_order_auto: # Logic table name
  23. actualDataSources (?): # Data source names
  24. shardingStrategy: # Sharding strategy
  25. standard: # For single sharding column scenario
  26. shardingColumn: # Sharding column name
  27. shardingAlgorithmName: # Auto sharding algorithm name
  28. bindingTables (+): # Binding tables
  29. - <logic_table_name_1, logic_table_name_2, ...>
  30. - <logic_table_name_1, logic_table_name_2, ...>
  31. broadcastTables (+): # Broadcast tables
  32. - <table-name>
  33. - <table-name>
  34. defaultDatabaseStrategy: # Default strategy for database sharding
  35. defaultTableStrategy: # Default strategy for table sharding
  36. defaultKeyGenerateStrategy: # Default Key generator strategy
  37. # Sharding algorithm configuration
  38. shardingAlgorithms:
  39. <sharding-algorithm-name> (+): # Sharding algorithm name
  40. type: # Sharding algorithm type
  41. props: # Sharding algorithm properties
  42. # ...
  43. # Key generate algorithm configuration
  44. keyGenerators:
  45. <key-generate-algorithm-name> (+): # Key generate algorithm name
  46. type: # Key generate algorithm type
  47. props: # Key generate algorithm properties
  48. # ...
  49. props:
  50. # ...

Replica Query

Configuration Item Explanation

  1. dataSources: # Omit the data source configuration, please refer to the usage
  2. rules:
  3. - !REPLICA_QUERY
  4. dataSources:
  5. <data-source-name> (+): # Logic data source name of replica query
  6. primaryDataSourceName: # Primary data source name
  7. replicaDataSourceNames:
  8. - <replica-data_source-name> (+) # Replica data source name
  9. loadBalancerName: # Load balance algorithm name
  10. # Load balance algorithm configuration
  11. loadBalancers:
  12. <load-balancer-name> (+): # Load balance algorithm name
  13. type: # Load balance algorithm type
  14. props: # Load balance algorithm properties
  15. # ...
  16. props:
  17. # ...

Please refer to Built-in Load Balance Algorithm List for more details about type of algorithm.

Encryption

Configuration Item Explanation

  1. dataSource: # Omit the data source configuration, please refer to the usage
  2. rules:
  3. - !ENCRYPT
  4. tables:
  5. <table-name> (+): # Encrypt table name
  6. columns:
  7. <column-name> (+): # Encrypt logic column name
  8. cipherColumn: # Cipher column name
  9. assistedQueryColumn (?): # Assisted query column name
  10. plainColumn (?): # Plain column name
  11. encryptorName: # Encrypt algorithm name
  12. # Encrypt algorithm configuration
  13. encryptors:
  14. <encrypt-algorithm-name> (+): # Encrypt algorithm name
  15. type: # Encrypt algorithm type
  16. props: # Encrypt algorithm properties
  17. # ...
  18. queryWithCipherColumn: # Whether query with cipher column for data encrypt. User you can use plaintext to query if have

Please refer to Built-in Encrypt Algorithm List for more details about type of algorithm.

Shadow DB

Configuration Item Explanation

  1. dataSources: # Omit the data source configuration, please refer to the usage
  2. rules:
  3. - !SHADOW
  4. column: # Shadow column name
  5. sourceDataSourceNames: # Source Data Source names
  6. # ...
  7. shadowDataSourceNames: # Shadow Data Source names
  8. # ...
  9. props:
  10. # ...

Governance

Configuration Item Explanation

  1. governance:
  2. name: # Governance name
  3. registryCenter: # Registry center
  4. type: # Governance instance type. Example:Zookeeper, etcd
  5. serverLists: # The list of servers that connect to governance instance, including IP and port number; use commas to separate
  6. overwrite: # Whether to overwrite local configurations with config center configurations; if it can, each initialization should refer to local configurations

ShardingSphere-4.x

Data Sharding

Configuration Item Explanation

  1. dataSources: # Data sources configuration, multiple `data_source_name` available
  2. <data_source_name>: # <!!Data source pool implementation class> `!!` means class instantiation
  3. driverClassName: # Class name of database driver
  4. url: # Database URL
  5. username: # Database username
  6. password: # Database password
  7. # ... Other properties for data source pool
  8. shardingRule:
  9. tables: # Sharding rule configuration, multiple `logic_table_name` available
  10. <logic_table_name>: # Name of logic table
  11. actualDataNodes: # Describe data source names and actual tables, delimiter as point, multiple data nodes separated with comma, support inline expression. Absent means sharding databases only. Example: ds${0..7}.tbl${0..7}
  12. databaseStrategy: # Databases sharding strategy, use default databases sharding strategy if absent. sharding strategy below can choose only one
  13. standard: # Standard sharding scenario for single sharding column
  14. shardingColumn: # Name of sharding column
  15. preciseAlgorithmClassName: # Precise algorithm class name used for `=` and `IN`. This class need to implements PreciseShardingAlgorithm, and require a no argument constructor
  16. rangeAlgorithmClassName: # Range algorithm class name used for `BETWEEN`. This class need to implements RangeShardingAlgorithm, and require a no argument constructor
  17. complex: # Complex sharding scenario for multiple sharding columns
  18. shardingColumns: # Names of sharding columns. Multiple columns separated with comma
  19. algorithmClassName: # Complex sharding algorithm class name. This class need to implements ComplexKeysShardingAlgorithm, and require a no argument constructor
  20. inline: # Inline expression sharding scenario for single sharding column
  21. shardingColumn: # Name of sharding column
  22. algorithmInlineExpression: # Inline expression for sharding algorithm
  23. hint: # Hint sharding strategy
  24. algorithmClassName: # Hint sharding algorithm class name. This class need to implements HintShardingAlgorithm, and require a no argument constructor
  25. none: # Do not sharding
  26. tableStrategy: # Tables sharding strategy, Same as databases sharding strategy
  27. keyGenerator:
  28. column: # Column name of key generator
  29. type: # Type of key generator, use default key generator if absent, and there are three types to choose, that is, SNOWFLAKE/UUID
  30. props: # Properties, Notice: when use SNOWFLAKE, `worker.id` and `max.tolerate.time.difference.milliseconds` for `SNOWFLAKE` need to be set. To use the generated value of this algorithm as sharding value, it is recommended to configure `max.vibration.offset`
  31. bindingTables: # Binding table rule configurations
  32. - <logic_table_name1, logic_table_name2, ...>
  33. - <logic_table_name3, logic_table_name4, ...>
  34. - <logic_table_name_x, logic_table_name_y, ...>
  35. broadcastTables: # Broadcast table rule configurations
  36. - table_name1
  37. - table_name2
  38. - table_name_x
  39. defaultDataSourceName: # If table not configure at table rule, will route to defaultDataSourceName
  40. defaultDatabaseStrategy: # Default strategy for sharding databases, same as databases sharding strategy
  41. defaultTableStrategy: # Default strategy for sharding tables, same as tables sharding strategy
  42. defaultKeyGenerator:
  43. type: # Type of default key generator, use user-defined ones or built-in ones, e.g. SNOWFLAKE, UUID. Default key generator is `org.apache.shardingsphere.core.keygen.generator.impl.SnowflakeKeyGenerator`
  44. column: # Column name of default key generator
  45. props: # Properties of default key generator, e.g. `worker.id` and `max.tolerate.time.difference.milliseconds` for `SNOWFLAKE`
  46. masterSlaveRules: # Read-write splitting rule configuration, more details can reference Read-write splitting part
  47. <data_source_name>: # Data sources configuration, need consist with data source map, multiple `data_source_name` available
  48. masterDataSourceName: # more details can reference Read-write splitting part
  49. slaveDataSourceNames: # more details can reference Read-write splitting part
  50. loadBalanceAlgorithmType: # more details can reference Read-write splitting part
  51. props: # Properties configuration of load balance algorithm
  52. <property-name>: # property key value pair
  53. props: # Properties
  54. sql.show: # To show SQLS or not, default value: false
  55. executor.size: # The number of working threads, default value: CPU count
  56. check.table.metadata.enabled: # To check the metadata consistency of all the tables or not, default value : false
  57. max.connections.size.per.query: # The maximum connection number allocated by each query of each physical database. default value: 1

Read-Write Split

Configuration Item Explanation

  1. dataSources: # Omit data source configurations; keep it consistent with data sharding
  2. masterSlaveRule:
  3. name: # Read-write split data source name
  4. masterDataSourceName: # Master data source name
  5. slaveDataSourceNames: # Slave data source name
  6. - <data_source_name1>
  7. - <data_source_name2>
  8. - <data_source_name_x>
  9. loadBalanceAlgorithmType: # Slave database load balance algorithm type; optional value, ROUND_ROBIN and RANDOM, can be omitted if `loadBalanceAlgorithmClassName` exists
  10. props: # Properties configuration of load balance algorithm
  11. <property-name>: # property key value pair
  12. props: # Property configuration
  13. sql.show: # Show SQL or not; default value: false
  14. executor.size: # Executing thread number; default value: CPU core number
  15. check.table.metadata.enabled: # Whether to check table metadata consistency when it initializes; default value: false
  16. max.connections.size.per.query: # The maximum connection number allocated by each query of each physical database. default value: 1

Create a DataSource through the YamlMasterSlaveDataSourceFactory factory class:

  1. DataSource dataSource = YamlMasterSlaveDataSourceFactory.createDataSource(yamlFile);

Data Masking

Configuration Item Explanation

  1. dataSource: # Ignore data sources configuration
  2. encryptRule:
  3. encryptors:
  4. <encryptor-name>:
  5. type: # Encryptor type
  6. props: # Properties, e.g. `aes.key.value` for AES encryptor
  7. aes.key.value:
  8. tables:
  9. <table-name>:
  10. columns:
  11. <logic-column-name>:
  12. plainColumn: # Plaintext column name
  13. cipherColumn: # Ciphertext column name
  14. assistedQueryColumn: # AssistedColumns for query,when use ShardingQueryAssistedEncryptor, it can help query encrypted data
  15. encryptor: # Encrypt name

Orchestration

Configuration Item Explanation

  1. dataSources: # Omit data source configurations
  2. shardingRule: # Omit sharding rule configurations
  3. masterSlaveRule: # Omit read-write split rule configurations
  4. encryptRule: # Omit encrypt rule configurations
  5. orchestration:
  6. name: # Orchestration instance name
  7. overwrite: # Whether to overwrite local configurations with registry center configurations; if it can, each initialization should refer to local configurations
  8. registry: # Registry center configuration
  9. type: # Registry center type. Example:zookeeper
  10. serverLists: # The list of servers that connect to registry center, including IP and port number; use commas to seperate addresses, such as: host1:2181,host2:2181
  11. namespace: # Registry center namespace
  12. digest: # The token that connects to the registry center; default means there is no need for authentication
  13. operationTimeoutMilliseconds: # Default value: 500 milliseconds
  14. maxRetries: # Maximum retry time after failing; default value: 3 times
  15. retryIntervalMilliseconds: # Interval time to retry; default value: 500 milliseconds
  16. timeToLiveSeconds: # Living time of temporary nodes; default value: 60 seconds

ShardingSphere-3.x

Data Sharding

Configuration Item Explanation

  1. dataSources: # Data sources configuration, multiple `data_source_name` available
  2. <data_source_name>: # <!!Data source pool implementation class> `!!` means class instantiation
  3. driverClassName: # Class name of database driver
  4. url: # Database URL
  5. username: # Database username
  6. password: # Database password
  7. # ... Other properties for data source pool
  8. shardingRule:
  9. tables: # Sharding rule configuration, multiple `logic_table_name` available
  10. <logic_table_name>: # Name of logic table
  11. actualDataNodes: # Describe data source names and actual tables, delimiter as point, multiple data nodes separated with comma, support inline expression. Absent means sharding databases only. Example: ds${0..7}.tbl${0..7}
  12. databaseStrategy: # Databases sharding strategy, use default databases sharding strategy if absent. sharding strategy below can choose only one
  13. standard: # Standard sharding scenario for single sharding column
  14. shardingColumn: # Name of sharding column
  15. preciseAlgorithmClassName: # Precise algorithm class name used for `=` and `IN`. This class need to implements PreciseShardingAlgorithm, and require a no argument constructor
  16. rangeAlgorithmClassName: # Range algorithm class name used for `BETWEEN`. This class need to implements RangeShardingAlgorithm, and require a no argument constructor
  17. complex: # Complex sharding scenario for multiple sharding columns
  18. shardingColumns: # Names of sharding columns. Multiple columns separated with comma
  19. algorithmClassName: # Complex sharding algorithm class name. This class need to implements ComplexKeysShardingAlgorithm, and require a no argument constructor
  20. inline: # Inline expression sharding scenario for single sharding column
  21. shardingColumn: # Name of sharding column
  22. algorithmInlineExpression: # Inline expression for sharding algorithm
  23. hint: # Hint sharding strategy
  24. algorithmClassName: # Hint sharding algorithm class name. This class need to implements HintShardingAlgorithm, and require a no argument constructor
  25. none: # Do not sharding
  26. tableStrategy: # Tables sharding strategy, Same as databases sharding strategy
  27. keyGeneratorColumnName: # Column name of key generator, do not use Key generator if absent
  28. keyGeneratorClassName: # Key generator, use default key generator if absent. This class need to implements KeyGenerator, and require a no argument constructor
  29. logicIndex: # Name if logic index. If use `DROP INDEX XXX` SQL in Oracle/PostgreSQL, This property needs to be set for finding the actual tables
  30. bindingTables: # Binding table rule configurations
  31. - <logic_table_name1, logic_table_name2, ...>
  32. - <logic_table_name3, logic_table_name4, ...>
  33. - <logic_table_name_x, logic_table_name_y, ...>
  34. bindingTables: # Broadcast table rule configurations
  35. - table_name1
  36. - table_name2
  37. - table_name_x
  38. defaultDataSourceName: # If table not configure at table rule, will route to defaultDataSourceName
  39. defaultDatabaseStrategy: # Default strategy for sharding databases, same as databases sharding strategy
  40. defaultTableStrategy: # Default strategy for sharding tables, same as tables sharding strategy
  41. defaultKeyGeneratorClassName: # Default key generator class name, default value is `io.shardingsphere.core.keygen.DefaultKeyGenerator`. This class need to implements KeyGenerator, and require a no argument constructor
  42. masterSlaveRules: # Read-write splitting rule configuration, more details can reference Read-write splitting part
  43. <data_source_name>: # Data sources configuration, need consist with data source map, multiple `data_source_name` available
  44. masterDataSourceName: # more details can reference Read-write splitting part
  45. slaveDataSourceNames: # more details can reference Read-write splitting part
  46. loadBalanceAlgorithmType: # more details can reference Read-write splitting part
  47. loadBalanceAlgorithmClassName: # more details can reference Read-write splitting part
  48. configMap: # User-defined arguments
  49. key1: value1
  50. key2: value2
  51. keyx: valuex
  52. props: # Properties
  53. sql.show: # To show SQLS or not, default value: false
  54. executor.size: # The number of working threads, default value: CPU count
  55. check.table.metadata.enabled: #T o check the metadata consistency of all the tables or not, default value : false
  56. configMap: # User-defined arguments
  57. key1: value1
  58. key2: value2
  59. keyx: valuex

Read-Write Split

Configuration Item Explanation

  1. dataSources: # Ignore data sources configuration, same as sharding
  2. masterSlaveRule:
  3. name: # Name of master slave data source
  4. masterDataSourceName: # Name of master data source
  5. slaveDataSourceNames: # Names of Slave data sources
  6. - <data_source_name1>
  7. - <data_source_name2>
  8. - <data_source_name_x>
  9. loadBalanceAlgorithmClassName: # Load balance algorithm class name. This class need to implements MasterSlaveLoadBalanceAlgorithm, and require a no argument constructor
  10. loadBalanceAlgorithmType: # Load balance algorithm type, values should be: `ROUND_ROBIN` or `RANDOM`. Ignore if `loadBalanceAlgorithmClassName` is present
  11. props: # Properties
  12. sql.show: # To show SQLS or not, default value: false
  13. executor.size: # The number of working threads, default value: CPU count
  14. check.table.metadata.enabled: # To check the metadata consistency of all the tables or not, default value : false
  15. configMap: # User-defined arguments
  16. key1: value1
  17. key2: value2
  18. keyx: valuex

Create a DataSource through the YamlMasterSlaveDataSourceFactory factory class:

  1. DataSource dataSource = MasterSlaveDataSourceFactory.createDataSource(yamlFile);

Orchestration

Configuration Item Explanation

  1. dataSources: # Ignore data sources configuration
  2. shardingRule: # Ignore sharding rule configuration
  3. masterSlaveRule: # Ignore master slave rule configuration
  4. orchestration:
  5. name: # Name of orchestration instance
  6. overwrite: # Use local configuration to overwrite registry center or not
  7. registry: # Registry configuration
  8. serverLists: # Registry servers list, multiple split as comma. Example: host1:2181,host2:2181
  9. namespace: # Namespace of registry
  10. digest: # Digest for registry. Default is not need digest.
  11. operationTimeoutMilliseconds: # Operation timeout time in milliseconds, default value is 500 milliseconds
  12. maxRetries: # Max number of times to retry, default value is 3
  13. retryIntervalMilliseconds: # Time interval in milliseconds on each retry, default value is 500 milliseconds
  14. timeToLiveSeconds: # Time to live in seconds of ephemeral keys, default value is 60 seconds

ShardingSphere-2.x

Data Sharding

Configuration Item Explanation

  1. dataSources:
  2. db0: !!org.apache.commons.dbcp.BasicDataSource
  3. driverClassName: org.h2.Driver
  4. url: jdbc:h2:mem:db0;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
  5. username: sa
  6. password:
  7. maxActive: 100
  8. db1: !!org.apache.commons.dbcp.BasicDataSource
  9. driverClassName: org.h2.Driver
  10. url: jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
  11. username: sa
  12. password:
  13. maxActive: 100
  14. shardingRule:
  15. tables:
  16. config:
  17. actualDataNodes: db${0..1}.t_config
  18. t_order:
  19. actualDataNodes: db${0..1}.t_order_${0..1}
  20. databaseStrategy:
  21. standard:
  22. shardingColumn: user_id
  23. preciseAlgorithmClassName: io.shardingjdbc.core.yaml.fixture.SingleAlgorithm
  24. tableStrategy:
  25. inline:
  26. shardingColumn: order_id
  27. algorithmInlineExpression: t_order_${order_id % 2}
  28. keyGeneratorColumnName: order_id
  29. keyGeneratorClass: io.shardingjdbc.core.yaml.fixture.IncrementKeyGenerator
  30. t_order_item:
  31. actualDataNodes: db${0..1}.t_order_item_${0..1}
  32. # The strategy of binding the rest of the tables in the table is the same as the strategy of the first table
  33. databaseStrategy:
  34. standard:
  35. shardingColumn: user_id
  36. preciseAlgorithmClassName: io.shardingjdbc.core.yaml.fixture.SingleAlgorithm
  37. tableStrategy:
  38. inline:
  39. shardingColumn: order_id
  40. algorithmInlineExpression: t_order_item_${order_id % 2}
  41. bindingTables:
  42. - t_order,t_order_item
  43. # Default database sharding strategy
  44. defaultDatabaseStrategy:
  45. none:
  46. defaultTableStrategy:
  47. complex:
  48. shardingColumns: id, order_id
  49. algorithmClassName: io.shardingjdbc.core.yaml.fixture.MultiAlgorithm
  50. props:
  51. sql.show: true

Read-Write Split

concept

In order to relieve the pressure on the database, the write and read operations are separated into different data sources. The write library is called the master library, and the read library is called the slave library. One master library can be configured with multiple slave libraries.

Supported

  1. Provides a read-write separation configuration with one master and multiple slaves, which can be used independently or with sub-databases and sub-meters.
  2. Independent use of read-write separation to support SQL transparent transmission.
  3. In the same thread and the same database connection, if there is a write operation, subsequent read operations will be read from the main library to ensure data consistency.
  4. Spring namespace.
  5. Hint-based mandatory main library routing.

Unsupported

  1. Data synchronization between the master library and the slave library.
  2. Data inconsistency caused by the data synchronization delay of the master library and the slave library.
  3. Double writing or multiple writing in the main library.

rule configuration

  1. dataSources:
  2. db_master: !!org.apache.commons.dbcp.BasicDataSource
  3. driverClassName: org.h2.Driver
  4. url: jdbc:h2:mem:db_master;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
  5. username: sa
  6. password:
  7. maxActive: 100
  8. db_slave_0: !!org.apache.commons.dbcp.BasicDataSource
  9. driverClassName: org.h2.Driver
  10. url: jdbc:h2:mem:db_slave_0;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
  11. username: sa
  12. password:
  13. maxActive: 100
  14. db_slave_1: !!org.apache.commons.dbcp.BasicDataSource
  15. driverClassName: org.h2.Driver
  16. url: jdbc:h2:mem:db_slave_1;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
  17. username: sa
  18. password:
  19. maxActive: 100
  20. masterSlaveRule:
  21. name: db_ms
  22. masterDataSourceName: db_master
  23. slaveDataSourceNames: [db_slave_0, db_slave_1]
  24. configMap:
  25. key1: value1

Create a DataSource through the MasterSlaveDataSourceFactory factory class:

  1. DataSource dataSource = MasterSlaveDataSourceFactory.createDataSource(yamlFile);

Orchestration

Configuration Item Explanation

Zookeeper sharding table and database Orchestration Configuration Item Explanation

  1. dataSources: Data sources configuration
  2. shardingRule: Sharding rule configuration
  3. orchestration: Zookeeper Orchestration Configuration
  4. name: Orchestration name
  5. overwrite: Whether to overwrite local configurations with config center configurations; if it can, each initialization should refer to local configurations
  6. zookeeper: Registry center Configuration
  7. namespace: Registry center namespace
  8. serverLists: The list of servers that connect to governance instance, including IP and port number, use commas to separate, such as: host1:2181,host2:2181
  9. baseSleepTimeMilliseconds: The initial millisecond value of the interval to wait for retry
  10. maxSleepTimeMilliseconds: The maximum millisecond value of the interval to wait for retry
  11. maxRetries: The maximum retry count
  12. sessionTimeoutMilliseconds: The session timeout milliseconds
  13. connectionTimeoutMilliseconds: The connecton timeout milliseconds
  14. digest: Permission token to connect to Zookeeper. default no authorization is required

Etcd sharding table and database Orchestration Configuration Item Explanation

  1. dataSources: Data sources configuration
  2. shardingRule: Sharding rule configuration
  3. orchestration: Etcd Orchestration Configuration
  4. name: Orchestration name
  5. overwrite: Whether to overwrite local configurations with config center configurations; if it can, each initialization should refer to local configurations
  6. etcd: Registry center Configuration
  7. serverLists: The list of servers that connect to governance instance, including IP and port number, use commas to separate, such as: http://host1:2379,http://host2:2379
  8. timeToLiveSeconds: Time to live seconds for ephemeral nodes
  9. timeoutMilliseconds: The request timeout milliseconds
  10. maxRetries: The maximum retry count
  11. retryIntervalMilliseconds: The retry interval milliseconds

Sharding table and database Data source construction method

  1. DataSource dataSource = OrchestrationShardingDataSourceFactory.createDataSource(yamlFile);

Read-Write split Data source construction method

  1. DataSource dataSource = OrchestrationMasterSlaveDataSourceFactory.createDataSource(yamlFile);