数据库发现

存储单元操作

  1. REGISTER STORAGE UNIT 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 db_discovery_group_0 (
  2. STORAGE_UNITS(ds_0, ds_1),
  3. TYPE(NAME='MySQL.MGR',PROPERTIES('group-name'='92504d5b-6dec')),
  4. HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
  5. );
  • 修改数据库发现规则
  1. ALTER DB_DISCOVERY RULE db_discovery_group_0 (
  2. STORAGE_UNITS(ds_0, ds_1, ds_2),
  3. TYPE(NAME='MySQL.MGR',PROPERTIES('group-name'='92504d5b-6dec')),
  4. HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
  5. );
  • 删除数据库发现规则
  1. DROP DB_DISCOVERY RULE db_discovery_group_0;
  • 删除数据库发现类型
  1. DROP DB_DISCOVERY TYPE db_discovery_group_0_mgr;
  • 删除数据库发现心跳
  1. DROP DB_DISCOVERY HEARTBEAT db_discovery_group_0_heartbeat;
  • 移除数据源
  1. UNREGISTER STORAGE UNIT ds_0,ds_1,ds_2;
  • 删除分布式数据库
  1. DROP DATABASE discovery_db;