RAL

Definition

RAL (Resource & Rule Administration Language) responsible for the added-on feature of hint, transaction type switch, scaling, sharding execute planning and so on.

Usage

Hint

StatementFunctionExample
set readwrite_splitting hint source = [auto / write]For current connection, set readwrite splitting routing strategy (automatic or forced to write data source)set readwrite_splitting hint source = write
set sharding hint database_value = yyFor current connection, set sharding value for database sharding only, yy: sharding valueset sharding hint database_value = 100
add sharding hint database_value xx= yyFor current connection, add sharding value for table, xx: logic table, yy: database sharding valueadd sharding hint database_value t_order= 100
add sharding hint table_value xx = yyFor current connection, add sharding value for table, xx: logic table, yy: table sharding valueadd sharding hint table_value t_order = 100
clear hintFor current connection, clear all hint settingsclear hint
clear [sharding hint / readwrite_splitting hint]For current connection, clear hint settings of sharding or readwrite splittingclear readwrite_splitting hint
show [sharding / readwrite_splitting] hint statusFor current connection, query hint settings of sharding or readwrite splittingshow readwrite_splitting hint status

Scaling

StatementFunctionExample
show scaling listQuery running listshow scaling list
show scaling status xxQuery scaling status, xx:jobIdshow scaling status 1234
start scaling xxStart scaling, xx:jobIdstart scaling 1234
stop scaling xxStop scaling, xx:jobIdstop scaling 1234
drop scaling xxDrop scaling, xx:jobIddrop scaling 1234
reset scaling xxreset progress, xx:jobIdreset scaling 1234
check scaling xxData consistency check with algorithm in server.yaml, xx: jobIdcheck scaling 1234
show scaling check algorithmsShow available consistency check algorithmsshow scaling check algorithms
check scaling {jobId} by type(name={algorithmType})Data consistency check with defined algorithmcheck scaling 1234 by type(name=DEFAULT)
stop scaling source writing xxThe source ShardingSphere data source is discontinued, xx:jobIdstop scaling source writing 1234
checkout scaling xxSwitch to target ShardingSphere data source, xx:jobIdcheckout scaling 1234

Circuit Breaker

StatementFunctionExample
[enable / disable] readwrite_splitting read xxx [from schema]Enable or disable read data sourceenable readwrite_splitting read resource_0
[enable / disable] instance IP=xxx, PORT=xxxEnable or disable proxy instancedisable instance IP=127.0.0.1, PORT=3307
show instance listQuery proxy instance informationshow instance list
show readwrite_splitting read resources [from schema]Query all read resources statusshow readwrite_splitting read resources

Other

StatementFunctionExample
set variable proxy_property_name = xxproxy_property_name is one of properties configuration of proxy,name is split by underscoreset variable sql_show = true
set variable transaction_type = xxModify transaction_type of the current connection, supports LOCAL, XA, BASEset variable transaction_type = XA
set variable agent_plugins_enabled = [true / false]Set whether the agent plugins are enabled, the default value is falseset variable agent_plugins_enabled = true
show all variablesQuery proxy all properties configurationshow all variable
show variable proxy_property_nameQuery proxy properties configuration, name is split by underscoreshow variable sql_show
show variable transaction_typeQuery the transaction type of the current connectionshow variable transaction_type
show variable cached_connectionsQuery the number of cached physical database connections in the current connectionshow variable cached_connections
show variable agent_plugins_enabledQuery whether the agent plugin are enabledshow variable agent_plugins_enabled
preview SQLPreview the actual SQLspreview select * from t_order

Notice

ShardingSphere-Proxy does not support hint by default, to support it, set proxy-hint-enabled to true in conf/server.yaml.