Giter VIP home page Giter VIP logo

dmds's Introduction

DMDS

DMDS(Distributed MySQL Database Service) is a MySQL sharding middleware base on MyCAT.

What is Different ?

  • Table sharding

    Support sharding database and table in the same time.

  • Simplify

    Focus on MySQL , remove some unnecessary features like zookeeper config 、 catlte .

Deploy

  • Package

    After download source code, package it with maven and JDK (verison >= 7).

    mvn clean package -DskipTests=true
  • Start

    Copy package dmds-server-xxx.tar to deploy directory. Run bin/startup.sh after unzip it.

    cp target/dmds-server-xxx.tar.gz deploy/
    cd deploy/
    tar -xf dmds-server-xxx.tar.gz
    cd dmds-server-1.0.0/
    ./bin/startup.sh
  • Stop

    Run bin/stop.sh to stop it.

Sharding Configuration Example

Configuration files are under conf directory like MyCAT. Let's see an example for 8 sharding tables in 2 databases.

  • schema.xml

    Configure hostNode、dataNode and schema. Schema name is dmds_test , data node is dn_dmds_test_00 and dn_dmds_test_01

        <schema name="dmds_test" checkSQLschema="true" sqlMaxLimit="5000" dataNode="dn_dmds_test_00">
            <table name="ts_order" primaryKey="id" dataNode="dn_dmds_test_00, dn_dmds_test_01"
                   rule="rule_dmds_test_ts_order"/>
        </schema>
        <dataNode name="dn_dmds_test_00" dataHost="dh_dmds_test_00" database="dmds_test_00"/>
        <dataNode name="dn_dmds_test_01" dataHost="dh_dmds_test_00" database="dmds_test_01"/>
        <dataHost name="dh_dmds_test_00" maxCon="100" minCon="1" balance="0" writeType="0" dbType="mysql"
                  dbDriver="native" switchType="1" slaveThreshold="100">
            <heartbeat>select 1</heartbeat>
            <writeHost host="M-dh_dmds_test_00" url="localhost:3306" user="dmds_test_user" password="pwd135"/>
        </dataHost>
  • rule.xml

    Configure tableRule and sharding function. Function class must be com.zhongan.dmds.route.function.PartitionTbByMod.

    • shardColumnType

      Data type of sharding column, 0 for numerical and 1 for string.

    <tableRule name="rule_dmds_test_ts_order">
        <rule>
            <columns>id</columns>
            <algorithm>function_dmds_test_ts_order</algorithm>
        </rule>
    </tableRule>
    <function name="function_dmds_test_ts_order"
              class="com.zhongan.dmds.route.function.PartitionTbByMod">
        <property name="dbCount">2</property>
        <property name="tbCount">4</property>
        <property name="shardColumnType">0</property>
    </function>
  • server.xml

    Configure access user. user name is dmds_test

        <user name="dmds_test">
            <property name="password">4fe313bd</property>
            <property name="schemas">dmds_test</property>
        </user>
  • Table distributed

    The physical table is distributed in order on 2 databases. Table names are automatically generated.

    select TABLE_SCHEMA, TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA like 'dmds_test_%' and TABLE_NAME like 'ts_order_%';
    +--------------+---------------+
    | TABLE_SCHEMA | TABLE_NAME    |
    +--------------+---------------+
    | dmds_test_00 | ts_order_0000 |
    | dmds_test_00 | ts_order_0001 |
    | dmds_test_00 | ts_order_0002 |
    | dmds_test_00 | ts_order_0003 |
    | dmds_test_01 | ts_order_0004 |
    | dmds_test_01 | ts_order_0005 |
    | dmds_test_01 | ts_order_0006 |
    | dmds_test_01 | ts_order_0007 |
    +--------------+---------------+

Contributing

See Contributing to DMDS for details on reporting bugs and commit pull request.

License

DMDS are licensed under GPL2.0 license

More Information

For more information, please see MyCAT documents.

dmds's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dmds's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.