DB Discovery

Resource Operation

  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. );

Rule Operation

  • Create DB discovery rule
  1. CREATE DB_DISCOVERY RULE db_discovery_group_0 (
  2. RESOURCES(ds_0, ds_1),
  3. TYPE(NAME='MySQL.MGR',PROPERTIES('group-name'='92504d5b-6dec')),
  4. HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
  5. );
  • Alter DB discovery rule
  1. ALTER DB_DISCOVERY RULE db_discovery_group_0 (
  2. RESOURCES(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. );
  • Drop db_discovery rule
  1. DROP DB_DISCOVERY RULE db_discovery_group_0;
  • Drop db_discovery type
  1. DROP DB_DISCOVERY TYPE db_discovery_group_0_mgr;
  • Drop db_discovery heartbeat
  1. DROP DB_DISCOVERY HEARTBEAT db_discovery_group_0_heartbeat;
  • Drop resource
  1. DROP RESOURCE ds_0,ds_1,ds_2;
  • Drop distributed database
  1. DROP DATABASE discovery_db;