分布式治理

配置项说明

治理

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://shardingsphere.apache.org/schema/shardingsphere/governance
  8. http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
  9. ">
  10. <governance:reg-center id="regCenter" type="ZooKeeper" server-lists="localhost:2181" />
  11. <governance:data-source id="shardingDatabasesTablesDataSource" data-source-names="demo_ds_0, demo_ds_1" reg-center-ref="regCenter" config-center-ref="configCenter" rule-refs="shardingRule" overwrite="true" />
  12. </beans>

命名空间: http://shardingsphere.apache.org/schema/shardingsphere/governance/governance-5.0.0.xsd

<governance:reg-center />

名称类型说明
id属性注册中心实例名称
type属性注册中心类型。如:ZooKeeper, etcd
server-lists属性注册中心服务列表。包括 IP 地址和端口号。多个地址用逗号分隔。如: host1:2181,host2:2181
props (?)属性配置本实例需要的其他参数,例如 ZooKeeper 的连接参数等