spring:
  profiles:
    active: dev
  application:
    name: sharging-jdbc-demo
  shardingsphere:
    datasource:
      names: master,slave1
      master:
        type: com.zaxxer.hikari.HikariDataSource # 数据源类型
        url: jdbc:mysql://localhost:3306/course_master_db # 数据库连接地址
        username: root # 用户名
        password: 123456 # 密码
        driver-class-name: com.mysql.jdbc.Driver # 数据库驱动
      slave1:
        type: com.zaxxer.hikari.HikariDataSource # 数据源类型
        url: jdbc:mysql://localhost:3306/course_db # 数据库连接地址
        username: root # 用户名
        password: 123456 # 密码
        driver-class-name: com.mysql.jdbc.Driver # 数据库驱动
    rules:
      readwrite-splitting:
        data-sources:
          mds:   #名字自定义
            type: static #类型 静态获取
            props:
              auto-aware-data-source-name: master
              write-data-source-name: master
              read-data-source-names: slave1
            load-balancer-name: read-random  #读写分离规则自定义命名
        load-balancers:
          read-random:
            type: ROUND_ROBIN # 轮询负载均衡
    props:
      sql-show: true # 是否打印sql
      sql-simple: true # 打印简单的sql
