影子库压测

存储单元操作

  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 SHADOW RULE group_0(
  2. SOURCE=ds_0,
  3. SHADOW=ds_1,
  4. t_order(TYPE(NAME="SQL_HINT"),TYPE(NAME="REGEX_MATCH", PROPERTIES("operation"="insert","column"="user_id", "regex"='[1]'))),
  5. t_order_item(TYPE(NAME="SQL_HINT")));
  • 修改影子库压测规则
  1. ALTER SHADOW RULE group_0(
  2. SOURCE=ds_0,
  3. SHADOW=ds_2,
  4. t_order_item(TYPE(NAME="SQL_HINT")));
  • 删除影子库压测规则
  1. DROP SHADOW RULE group_0;
  • 移除数据源
  1. UNREGISTER STORAGE UNIT ds_0,ds_1,ds_2;
  1. 删除分布式数据库
  1. DROP DATABASE foo_db;