1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| # 创建规则写入,更新操作使用主节点 Admin> insert into mysql_query_rules(rule_id,active,match_digest,destination_hostgroup,apply) values(1,1,'^select.*from update$',1,1); Query OK, 1 row affected (0.00 sec)
#创建规则查询数据使用从节点 Admin> insert into mysql_query_rules(rule_id,active,match_digest,destination_hostgroup,apply) values(2,1,'^select',2,1); Query OK, 1 row affected (0.00 sec)
#创建规则查询库使用从节点 Admin> insert into mysql_query_rules(rule_id,active,match_digest,destination_hostgroup,apply) values(3,1,'^show',2,1); Query OK, 1 row affected (0.00 sec)
# 查看规则 Admin> select rule_id,active,match_digest,destination_hostgroup,apply from mysql_query_rules; + | rule_id | active | match_digest | destination_hostgroup | apply | + | 1 | 1 | ^select.*from update$ | 1 | 1 | | 2 | 1 | ^select | 2 | 1 | | 3 | 1 | ^show | 2 | 1 | + 3 rows in set (0.00 sec)
# 载入使用并持久化到磁盘 Admin> load mysql query rules to runtime; Query OK, 0 rows affected (0.00 sec)
Admin> load admin variables to runtime; Query OK, 0 rows affected (0.00 sec)
Admin> save mysql query rules to disk ; Query OK, 0 rows affected (0.02 sec)
Admin> save admin variables to disk ; Query OK, 49 rows affected (0.00 sec)
|