This chapter will introduce how to use DistSQL to manage resources and rules in a distributed database.
Pre-work
Use MySQL as example, can replace to other databases.
- Start the MySQL service;
- Create to be registered MySQL databases;
- Create role and user in MySQL with creation permission for ShardingSphere-Proxy;
- Start Zookeeper service;
- Add
mode
andauthentication
configurations toglobal.yaml
; - Start ShardingSphere-Proxy;
- Use SDK or terminal connect to ShardingSphere-Proxy.
Create Logic Database
- Create logic database
CREATE DATABASE foo_db;
- Use newly created logic database
USE foo_db;
Resource Operation
More details please see concentrate rule examples.
Rule Operation
More details please see concentrate rule examples.
Notice
- Currently,
DROP DATABASE
will only remove thelogical distributed database
, not the user’s actual database; DROP TABLE
will delete all logical fragmented tables and actual tables in the database;CREATE DATABASE
will only create alogical distributed database
, so users need to create actual databases in advance.
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .