数据库发现

资源操作

  1. ADD RESOURCE ds_0 (
  2. HOST=127.0.0.1,
  3. PORT=3306,
  4. DB=ds_0,
  5. USER=root,
  6. PASSWORD=root
  7. ),ds_1 (
  8. HOST=127.0.0.1,
  9. PORT=3306,
  10. DB=ds_1,
  11. USER=root,
  12. PASSWORD=root
  13. ),ds_2 (
  14. HOST=127.0.0.1,
  15. PORT=3306,
  16. DB=ds_2,
  17. USER=root,
  18. PASSWORD=root
  19. );

规则操作

  • 创建数据库发现规则
  1. CREATE DB_DISCOVERY RULE ha_group_0 (
  2. RESOURCES(ds_0, ds_1),
  3. TYPE(NAME=mgr,PROPERTIES('group-name'='92504d5b-6dec')),
  4. HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
  5. );
  • 修改数据库发现规则
  1. ALTER DB_DISCOVERY RULE ha_group_0 (
  2. RESOURCES(ds_0, ds_1, ds_2),
  3. TYPE(NAME=mgr,PROPERTIES('group-name'='92504d5b-6dec')),
  4. HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
  5. );
  • 删除数据库发现规则
  1. DROP DB_DISCOVERY RULE ha_group_0;
  • 删除数据库发现类型
  1. DROP DB_DISCOVERY TYPE ha_group_0_mgr;
  • 删除数据库发现心跳
  1. DROP DB_DISCOVERY HEARTBEAT ha_group_0_heartbeat;
  • 删除数据源
  1. DROP RESOURCE ds_0,ds_1,ds_2;
  • 删除分布式数据库
  1. DROP DATABASE discovery_db;