Logo
Traffic

Traffic #

SyntaxDescriptionType
CREATE TRAFFIC RULE sql_match_traffic (LABELS(xxx),TRAFFIC_ALGORITHM(TYPE(NAME=xxx,PROPERTIES(“key” = “value”))), LOAD_BALANCER(TYPE(NAME=xxx,PROPERTIES(“key"=“value”))))Create traffic ruleRDL
ALTER TRAFFIC RULE sql_match_traffic (LABELS(xxx),TRAFFIC_ALGORITHM(TYPE(NAME=xxx,PROPERTIES(“key” = “value”))),LOAD_BALANCER(TYPE(NAME=xxx,PROPERTIES(“key”=“value”))))Modify traffic ruleRDL
DROP TRAFFIC RULE ruleName [, ruleName]Delete traffic ruleRDL
SHOW TRAFFIC RULESQuery traffic ruleRQL

1. Create Traffic Rule #

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

Parameter Explanation

TRAFFIC_ALGORITHM support SQL_MATCH and SQL_HINT types; LOAD_BALANCER support RANDOM and ROUND_ROBIN types.

Example

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. Modify Traffic Rule #

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

Parameter Explanation

TRAFFIC_ALGORITHM support SQL_MATCH and SQL_HINT types; LOAD_BALANCER support RANDOM and ROUND_ROBIN types.

Example

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. Delete Traffic Rule #

DROP TRAFFIC RULE ruleName [, ruleName]

Example

DROP TRAFFIC RULE sql_match_traffic

4. Query Traffic Rules #

SHOW TRAFFIC RULES;

Example

Query specified or all traffic rules

SHOW TRAFFIC RULES;