数据库发现

定义

  1. CREATE DB_DISCOVERY RULE databaseDiscoveryRuleDefinition [, databaseDiscoveryRuleDefinition] ...
  2. ALTER DB_DISCOVERY RULE databaseDiscoveryRuleDefinition [, databaseDiscoveryRuleDefinition] ...
  3. DROP DB_DISCOVERY RULE ruleName [, ruleName] ...
  4. databaseDiscoveryRuleDefinition:
  5. ruleName(resources, discoveryTypeDefinition)
  6. resources:
  7. RESOURCES(resourceName [, resourceName] ...)
  8. discoveryTypeDefinition:
  9. TYPE(NAME=discoveryType [, PROPERTIES([algorithmProperties] )] )
  10. algorithmProperties:
  11. algorithmProperty [, algorithmProperty] ...
  12. algorithmProperty:
  13. key=value
  • discoveryType 指定数据库发现服务类型,ShardingSphere 内置支持 MGR
  • 重复的 ruleName 将无法被创建

示例

  1. CREATE DB_DISCOVERY RULE ha_group_0 (
  2. RESOURCES(resource_0,resource_1),
  3. TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec',keepAliveCron=''))
  4. );
  5. ALTER DB_DISCOVERY RULE ha_group_0 (
  6. RESOURCES(resource_0,resource_1,resource_2),
  7. TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec' ,keepAliveCron=''))
  8. );
  9. DROP DB_DISCOVERY RULE ha_group_0;