schemaName: readwrite_splitting_db # dataSources: write_ds: url: jdbc:mysql://124.70.70.7:5132/mydbtest?serverTimezone=UTC&useSSL=false username: root password: MyNewPass513122! connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 read_ds_0: url: jdbc:mysql://124.70.70.7:5232/mydbtest?serverTimezone=UTC&useSSL=false username: root password: MyNewPass513122! connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 # read_ds_1: # url: jdbc:mysql://127.0.0.1:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false # username: root # password: # connectionTimeoutMilliseconds: 30000 # idleTimeoutMilliseconds: 60000 # maxLifetimeMilliseconds: 1800000 # maxPoolSize: 50 # minPoolSize: 1 # rules: - !READWRITE_SPLITTING dataSources: pr_ds: writeDataSourceName: write_ds readDataSourceNames: - read_ds_0
时间: 2024-04-25 07:26:33 浏览: 184
pgsql_shadow_tables:PostgreSQL影子表管理
这个 Yaml 配置文件是一个 ShardingSphere-Proxy 的配置文件,它定义了一个名为 readwrite_splitting_db 的数据库,其中包含一个写数据源 write_ds 和一个只读数据源 read_ds_0。同时,它定义了一个读写分离规则,将写请求路由到写数据源 write_ds,将读请求随机路由到只读数据源 read_ds_0。需要注意的是,这个 Yaml 配置只是一个示例,实际使用时需要根据情况进行修改。
阅读全文