Logo
流量治理

流量治理 #

语法描述类型
CREATE TRAFFIC RULE sql_match_traffic (LABELS(xxx),TRAFFIC_ALGORITHM(TYPE(NAME=xxx,PROPERTIES(“key” = “value”))), LOAD_BALANCER(TYPE(NAME=xxx,PROPERTIES(“key"=“value”))))创建双路由规则RDL
ALTER TRAFFIC RULE sql_match_traffic (LABELS(xxx),TRAFFIC_ALGORITHM(TYPE(NAME=xxx,PROPERTIES(“key” = “value”))),LOAD_BALANCER(TYPE(NAME=xxx,PROPERTIES(“key”=“value”))))修改双路由规则RDL
DROP TRAFFIC RULE ruleName [, ruleName]删除双路由规则RDL
SHOW TRAFFIC RULES查询双路由规则RQL

1. 创建双路由规则 #

CREATE TRAFFIC RULE sql_match_traffic (LABELS(xxx),TRAFFIC_ALGORITHM(TYPE(NAME=xxx,PROPERTIES(key = value))), LOAD_BALANCER(TYPE(NAME=xxx,PROPERTIES(key"="value))))

参数说明

TRAFFIC_ALGORITHM 支持 SQL_MATCHSQL_HINT 两种类型 LOAD_BALANCER 支持 RANDOMROUND_ROBIN 两种类型。

示例

CREATE TRAFFIC RULE sql_match_traffic (LABELS(OLTP),TRAFFIC_ALGORITHM(TYPE(NAME=SQL_MATCH,PROPERTIES(sql = SELECT * FROM t_order WHERE order_id = ?; UPDATE t_order SET order_id = ?;"))),LOAD_BALANCER(TYPE(NAME=RANDOM)))

2. 修改双路由规则 #

ALTER TRAFFIC RULE sql_match_traffic (LABELS(xxx),TRAFFIC_ALGORITHM(TYPE(NAME=xxx,PROPERTIES(key = value))),LOAD_BALANCER(TYPE(NAME=xxx,PROPERTIES(key"="value))))

参数说明

TRAFFIC_ALGORITHM 支持 SQL_MATCHSQL_HINT 两种类型 LOAD_BALANCER 支持 RANDOMROUND_ROBIN 两种类型。

示例

ALTER TRAFFIC RULE sql_match_traffic (LABELS(OLTP),TRAFFIC_ALGORITHM(TYPE(NAME=SQL_MATCH,PROPERTIES(sql = SELECT * FROM t_order WHERE order_id = ?; UPDATE t_order SET order_id = ?;"))), LOAD_BALANCER(TYPE(NAME=RANDOM)))

3. 删除双路由规则 #

DROP TRAFFIC RULE ruleName [, ruleName]

示例

DROP TRAFFIC RULE sql_match_traffic

4. 查询双路由规则 #

SHOW TRAFFIC RULES;

示例

查询指定双路由规则或所有双路由规则

SHOW TRAFFIC RULES;