Logo
Read/write splitting

Read/write splitting #

Description of configuration items #

Static read/write splitting #

rules:
- !READWRITE_SPLITTING
  dataSources:
    <data-source-name> (+): # Readwrite splitting logic data source name
       static-strategy: # Readwrite splitting type
         write-data-source-name: # Write data source name
         read-data-source-names: # Read data source name, multiple data source split with comma
       loadBalancerName: # Load balancer algorithm name
  
  # Load balancer algorithm configuration
  loadBalancers:
    <load-balancer-name> (+): # Load balancer algorithm name
      type: # Load balancer algorithm type
      props: # Load balancer algorithm properties
        # ...

Dynamic read/write splitting #

rules:
- !READWRITE_SPLITTING
  dataSources:
    <data-source-name> (+): # Readwrite splitting logic data source name
       dynamic-strategy: # Readwrite splitting type
         auto-aware-data-source-name: # Database discovery data source name
         write-data-source-query-enabled: # All slave databases are offline, whether the master database bears the read traffic
       loadBalancerName: # Load balancer algorithm name
  
  # Load balancer algorithm configuration
  loadBalancers:
    <load-balancer-name> (+): # Load balancer algorithm name
      type: # Load balancer algorithm type
      props: # Load balancer algorithm properties configuration
        # ...

For details of the algorithm types, see the list of built-in load balancing algorithms. For details of query consistency routing, please see the usage specification.