复古 护眼 海天 深邃 暗黑 默认

CREATE TRAFFIC RULE

描述

CREATE TRAFFIC RULE 语法用于创建双路由规则

语法定义

CreateTrafficRule ::=
  'CREATE' 'TRAFFIC' 'RULE'  '(' 'LABELS' '(' lableName ')' ',' trafficAlgorithmDefination ',' loadBalancerDefination ')'

lableName ::=
  identifier

trafficAlgorithmDefination ::=
  'TRAFFIC_ALGORITHM' '(' 'TYPE' '(' 'NAME' = trafficAlgorithmTypeName (',' 'PROPERTIES' '(' key '=' value (',' key '=' value)* ')')? ')' ')'

loadBalancerDefination ::=
  'LOAD_BALANCER' '(' 'TYPE' '(' 'NAME' = loadBalancerName (',' 'PROPERTIES' '(' key '=' value (',' key '=' value)* ')')? ')' ')'

trafficAlgorithmTypeName ::=
  string

loadBalancerTypeName ::=
  string

key ::= 
  string

value ::=
  string

补充说明

  • 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 = 1; UPDATE t_order SET order_id = 5;"))),
  LOAD_BALANCER(TYPE(NAME="RANDOM")));

保留字

CREATETRAFFICRULELABELSTYPENAMEPROPERTIESTRAFFIC_ALGORITHMLOAD_BALANCER

相关链接