DB Discovery

Storage unit Operation

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

Rule Operation

  • Create DB discovery rule
  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. );
  • Alter DB discovery rule
  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. );
  • 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;
  • Unregister storage unit
  1. UNREGISTER STORAGE UNIT ds_0,ds_1,ds_2;
  • Drop distributed database
  1. DROP DATABASE discovery_db;