{"id":19675310,"url":"https://github.com/zhongantech/dmds","last_synced_at":"2025-04-29T02:30:34.895Z","repository":{"id":37129599,"uuid":"252621636","full_name":"ZhongAnTech/dmds","owner":"ZhongAnTech","description":"DMDS is a highly scalable distributed MySQL sharding middleware.","archived":false,"fork":false,"pushed_at":"2022-12-14T20:27:21.000Z","size":507,"stargazers_count":15,"open_issues_count":6,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T12:42:03.466Z","etag":null,"topics":["database","java","middleware","mysql","shard"],"latest_commit_sha":null,"homepage":"https://github.com/ZhongAnTech/dmds","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZhongAnTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-03T03:15:49.000Z","updated_at":"2024-01-04T12:48:16.000Z","dependencies_parsed_at":"2023-01-29T00:46:06.004Z","dependency_job_id":null,"html_url":"https://github.com/ZhongAnTech/dmds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongAnTech%2Fdmds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongAnTech%2Fdmds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongAnTech%2Fdmds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhongAnTech%2Fdmds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZhongAnTech","download_url":"https://codeload.github.com/ZhongAnTech/dmds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251420882,"owners_count":21586696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","java","middleware","mysql","shard"],"created_at":"2024-11-11T17:23:06.727Z","updated_at":"2025-04-29T02:30:32.625Z","avatar_url":"https://github.com/ZhongAnTech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DMDS\n\n__DMDS__(Distributed MySQL Database Service) is a MySQL sharding middleware  base on [MyCAT](https://github.com/MyCATApache/Mycat-Server).\n\n## What is Different ?\n\n- __Table sharding__ \n\n  Support sharding database and table in the same time.\n\n- __Simplify__\n\n  Focus on MySQL ,  remove some unnecessary features like zookeeper config 、 catlte .\n\n## Deploy\n\n- __Package__\n\n  After download source code, package it with maven and JDK (verison \u003e= 7). \n\n  ```bash\n  mvn clean package -DskipTests=true\n  ```\n\n- __Start__\n\n  Copy package `dmds-server-xxx.tar` to deploy directory. Run `bin/startup.sh ` after unzip it.\n\n  ```bash\n  cp target/dmds-server-xxx.tar.gz deploy/\n  cd deploy/\n  tar -xf dmds-server-xxx.tar.gz\n  cd dmds-server-1.0.0/\n  ./bin/startup.sh\n  ```\n\n- __Stop__\n\n  Run `bin/stop.sh` to stop it.\n\n## Sharding Configuration Example\n\n  Configuration files are under conf directory like MyCAT. Let's see an example for 8 sharding tables in 2 databases.\n\n- __schema.xml__\n\n  Configure hostNode、dataNode and schema. Schema name is `dmds_test` , data node is `dn_dmds_test_00` and `dn_dmds_test_01`\n\n  ```xml\n      \u003cschema name=\"dmds_test\" checkSQLschema=\"true\" sqlMaxLimit=\"5000\" dataNode=\"dn_dmds_test_00\"\u003e\n          \u003ctable name=\"ts_order\" primaryKey=\"id\" dataNode=\"dn_dmds_test_00, dn_dmds_test_01\"\n                 rule=\"rule_dmds_test_ts_order\"/\u003e\n      \u003c/schema\u003e\n      \u003cdataNode name=\"dn_dmds_test_00\" dataHost=\"dh_dmds_test_00\" database=\"dmds_test_00\"/\u003e\n      \u003cdataNode name=\"dn_dmds_test_01\" dataHost=\"dh_dmds_test_00\" database=\"dmds_test_01\"/\u003e\n      \u003cdataHost name=\"dh_dmds_test_00\" maxCon=\"100\" minCon=\"1\" balance=\"0\" writeType=\"0\" dbType=\"mysql\"\n                dbDriver=\"native\" switchType=\"1\" slaveThreshold=\"100\"\u003e\n          \u003cheartbeat\u003eselect 1\u003c/heartbeat\u003e\n          \u003cwriteHost host=\"M-dh_dmds_test_00\" url=\"localhost:3306\" user=\"dmds_test_user\" password=\"pwd135\"/\u003e\n      \u003c/dataHost\u003e\n  ```\n\n- __rule.xml__\n\n  Configure tableRule and sharding function. Function class must be `com.zhongan.dmds.route.function.PartitionTbByMod`. \n\n  - shardColumnType\n\n     Data type of sharding column, `0` for numerical  and `1` for string.\n\n  ```xml\n  \u003ctableRule name=\"rule_dmds_test_ts_order\"\u003e\n      \u003crule\u003e\n          \u003ccolumns\u003eid\u003c/columns\u003e\n          \u003calgorithm\u003efunction_dmds_test_ts_order\u003c/algorithm\u003e\n      \u003c/rule\u003e\n  \u003c/tableRule\u003e\n  \u003cfunction name=\"function_dmds_test_ts_order\"\n            class=\"com.zhongan.dmds.route.function.PartitionTbByMod\"\u003e\n      \u003cproperty name=\"dbCount\"\u003e2\u003c/property\u003e\n      \u003cproperty name=\"tbCount\"\u003e4\u003c/property\u003e\n      \u003cproperty name=\"shardColumnType\"\u003e0\u003c/property\u003e\n  \u003c/function\u003e\n  ```\n\n- __server.xml__\n\n  Configure access user. user name is `dmds_test`\n\n  ```xml\n      \u003cuser name=\"dmds_test\"\u003e\n          \u003cproperty name=\"password\"\u003e4fe313bd\u003c/property\u003e\n          \u003cproperty name=\"schemas\"\u003edmds_test\u003c/property\u003e\n      \u003c/user\u003e\n  ```\n\n- __Table distributed__\n\n  The physical table is distributed in order on 2 databases. Table names are automatically generated.\n\n  ```sql\n  select TABLE_SCHEMA, TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA like 'dmds_test_%' and TABLE_NAME like 'ts_order_%';\n  +--------------+---------------+\n  | TABLE_SCHEMA | TABLE_NAME    |\n  +--------------+---------------+\n  | dmds_test_00 | ts_order_0000 |\n  | dmds_test_00 | ts_order_0001 |\n  | dmds_test_00 | ts_order_0002 |\n  | dmds_test_00 | ts_order_0003 |\n  | dmds_test_01 | ts_order_0004 |\n  | dmds_test_01 | ts_order_0005 |\n  | dmds_test_01 | ts_order_0006 |\n  | dmds_test_01 | ts_order_0007 |\n  +--------------+---------------+\n  ```\n\n## Contributing \n\n  See [Contributing to DMDS](CONTRIBUTING.md) for details on reporting bugs and commit pull request.\n\n## License\n\n  DMDS are licensed under [GPL2.0 license](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)\n\n## More Information\n  For more information, please see [MyCAT documents](https://github.com/MyCATApache/Mycat-doc/tree/master/en).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhongantech%2Fdmds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhongantech%2Fdmds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhongantech%2Fdmds/lists"}