CREATE DB_DISCOVERY RULE
Description
The CREATE DB_DISCOVERY RULE
syntax is used to create a database discovery rule.
Syntax
CreateDatabaseDiscoveryRule ::=
'CREATE' 'DB_DISCOVERY' 'RULE' ( databaseDiscoveryDefinition | databaseDiscoveryConstruction ) ( ',' ( databaseDiscoveryDefinition | databaseDiscoveryConstruction ) )*
databaseDiscoveryDefinition ::=
ruleName '(' 'RESOURCES' '(' resourceName ( ',' resourceName )* ')' ',' 'TYPE' '(' 'NAME' '=' typeName ( ',' 'PROPERTIES' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* )? ',' 'HEARTBEAT' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* ')' ')'
databaseDiscoveryConstruction ::=
ruleName '(' 'RESOURCES' '(' resourceName ( ',' resourceName )* ')' ',' 'TYPE' '=' discoveryTypeName ',' 'HEARTBEAT' '=' discoveryHeartbeatName ')'
ruleName ::=
identifier
resourceName ::=
identifier
typeName ::=
identifier
discoveryHeartbeatName ::=
identifier
Supplement
discoveryType
specifies the database discovery service type,ShardingSphere
has built-in support forMySQL.MGR
;- Duplicate
ruleName
will not be created.
Example
When creating a discoveryRule
, create both discoveryType
and discoveryHeartbeat
CREATE
DB_DISCOVERY RULE db_discovery_group_0 (
RESOURCES(ds_0, ds_1, ds_2),
TYPE(NAME='MySQL.MGR',PROPERTIES('group-name'='92504d5b-6dec')),
HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
);
Use the existing discoveryType
and discoveryHeartbeat
to create a discoveryRule
CREATE
DB_DISCOVERY RULE db_discovery_group_1 (
RESOURCES(ds_0, ds_1, ds_2),
TYPE=db_discovery_group_1_mgr,
HEARTBEAT=db_discovery_group_1_heartbeat
);
Reserved word
CREATE
, DB_DISCOVERY
, RULE
, RESOURCES
, TYPE
, NAME
, PROPERTIES
, HEARTBEAT
Related links
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .