EXPORT DATABASE CONFIGURATION
描述
EXPORT DATABASE CONFIGURATION
语法用于将逻辑库中的存储单元和规则配置导出为 YAML
格式。
语法
语法 铁路图
ExportDatabaseConfiguration ::=
'EXPORT' 'DATABASE' 'CONFIGURATION' ('FROM' databaseName)? ('TO' 'FILE' filePath)?
databaseName ::=
identifier
filePath ::=
string
补充说明
- 未指定
databaseName
时,导出当前使用的逻辑库;如果也未使用逻辑库则提示No database selected
; - 未指定
filePath
时,会将导出的信息通过结果集输出; - 指定
filePath
时,会自动创建文件,若文件已存在,会被覆盖。
示例
- 导出当前逻辑库的配置信息
mysql> EXPORT DATABASE CONFIGURATION;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| result |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| databaseName: sharding_db
dataSources:
ds_1:
password: 123456
url: jdbc:mysql://127.0.0.1:3306/db0
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.01 sec)
- 导出指定逻辑库的配置信息,并输出到文件
mysql> EXPORT DATABASE CONFIGURATION FROM sharding_db TO FILE '/xxx/config_sharding_db.yaml';
+-------------------------------------------------------------------------+
| result |
+-------------------------------------------------------------------------+
| Successfully exported to: '/xxx/config_sharding_db.yaml' |
+-------------------------------------------------------------------------+
1 row in set (0.02 sec)
保留字
EXPORT
、DATABASE
、CONFIGURATION
、FROM
、TO
、FILE
相关链接
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .