EXPORT DATABASE CONFIGURATION
Description
The EXPORT DATABASE CONFIGURATION
syntax is used to export storage units and rule configurations to YAML
format.
Syntax
Grammar Railroad diagram
ExportDatabaseConfiguration ::=
'EXPORT' 'DATABASE' 'CONFIGURATION' ('FROM' databaseName)? ('TO' 'FILE' filePath)?
databaseName ::=
identifier
filePath ::=
string
Supplement
When
databaseName
is not specified, the default is the currently usedDATABASE
. IfDATABASE
is not used,No database selected
will be prompted.When
filePath
is not specified, the storage units and rule configurations will export to screen.
Example
- Export storage units and rule configurations from specified database to specified file path
EXPORT DATABASE CONFIGURATION FROM sharding_db TO FILE "/xxx/config_sharding_db.yaml";
- Export storage units and rule configurations from specified database to screen
EXPORT DATABASE CONFIGURATION FROM sharding_db;
mysql> EXPORT DATABASE CONFIGURATION FROM sharding_db;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| result |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| databaseName: sharding_db
dataSources:
ds_1:
password: 123456
url: jdbc:mysql://127.0.0.1:3306/migration_ds_0
username: root
minPoolSize: 1
connectionTimeoutMilliseconds: 30000
maxLifetimeMilliseconds: 2100000
readOnly: false
idleTimeoutMilliseconds: 60000
maxPoolSize: 50
ds_2:
password: 123456
url: jdbc:mysql://127.0.0.1:3306/db1
username: root
minPoolSize: 1
connectionTimeoutMilliseconds: 30000
maxLifetimeMilliseconds: 2100000
readOnly: false
idleTimeoutMilliseconds: 60000
maxPoolSize: 50
rules:
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
- Export storage units and rule configurations from current database to specified file path
EXPORT DATABASE CONFIGURATION TO FILE "/xxx/config_sharding_db.yaml";
- Export storage units and rule configurations from current database to screen
EXPORT DATABASE CONFIGURATION;
mysql> EXPORT DATABASE CONFIGURATION;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| result |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| databaseName: sharding_db
dataSources:
ds_1:
password: 123456
url: jdbc:mysql://127.0.0.1:3306/migration_ds_0
username: root
minPoolSize: 1
connectionTimeoutMilliseconds: 30000
maxLifetimeMilliseconds: 2100000
readOnly: false
idleTimeoutMilliseconds: 60000
maxPoolSize: 50
ds_2:
password: 123456
url: jdbc:mysql://127.0.0.1:3306/db1
username: root
minPoolSize: 1
connectionTimeoutMilliseconds: 30000
maxLifetimeMilliseconds: 2100000
readOnly: false
idleTimeoutMilliseconds: 60000
maxPoolSize: 50
rules:
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Reserved word
EXPORT
, DATABASE
, CONFIGURATION
, FROM
, TO
, FILE
Related links
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .