Coder Social home page Coder Social logo

sharding-jdbc's Introduction

License

Maven Status GitHub release Download

Build Status Coverage Status Gitter OpenTracing-1.0 Badge Skywalking Tracing

Overview

Sharding-JDBC is a distributed database middleware, focus on data sharding, read-write splitting, BASE transaction and database orchestration. It provides maximum compatibilities for applications by JDBC driver or database protocols proxy.

Document

EN doc Roadmap

CN doc

Features

1. Data sharding

  • Both databases and tables sharding supported.
  • Standard aggregation functions, GROUP BY, ORDER BY, LIMIT and JOIN DQL supported.
  • Standard DML, DDL, TCL and database administrator command supported.
  • Sharding operator =, BETWEEN and IN supported.
  • Sharding algorithm customization and inline expression supported.
  • Route by hint supported.
  • Distributed sequence supported.

2. Read-write splitting

  • Multiple slaves replica supported.
  • Data consistency guarantee in same thread supported.
  • Mix read-write splitting and data sharding supported.
  • Route by hint supported.

3. BASE Transaction

  • Best efforts delivery transaction supported.
  • Try confirm cancel transaction (TBD).

4. Orchestration

  • Configuration center supported, can refresh dynamically.
  • Circuit breaker supported.
  • Open tracing supported.

Architecture

Sharding-JDBC

Use JDBC connect databases without redirect cost for java application, best performance for production.

  • ORM compatible. JPA, Hibernate, Mybatis, Spring JDBC Template or JDBC supported.
  • Connection-pool compatible. DBCP, BoneCP, Druid supported.
  • Multi SQL-based databases compatible. Any Database supported theoretically. Support MySQL, Oracle, SQLServer and PostgreSQL right now.

Sharding-JDBC Architecture

Sharding-Proxy

Database router. Deploy as a stateless server, support MySQL protocol for now.

  • Use standard MySQL protocol, application do not care about whether proxy or real MySQL.
  • Any MySQL command line and UI workbench supported in theoretically. MySQL Workbench are fully compatible right now.

Sharding-Proxy Architecture

Sharding-Sidecar(TBD)

Use sidecar to connect databases, best for Kubernetes or Mesos together.

Sharding-Sidecar Architecture

Quick Start

Sharding-JDBC

Add maven dependency

<!-- import sharding-jdbc core -->
<dependency>
    <groupId>io.shardingjdbc</groupId>
    <artifactId>sharding-jdbc-core</artifactId>
    <version>${latest.release.version}</version>
</dependency>

Configure sharding rule

Sharding-JDBC support 4 types for sharding rule configuration, they are Java, YAML, Spring namespace and Spring boot starter. Developers can choose any one for best suitable situation.

Create DataSource

Use ShardingDataSourceFactory to create ShardingDataSource, which is a standard JDBC DataSource. Then developers can use it for raw JDBC, JPA, MyBatis or Other JDBC based ORM frameworks.

DataSource dataSource = ShardingDataSourceFactory.createDataSource(dataSourceMap, shardingRuleConfig);

Sharding-Proxy

Configure sharding rule

Edit ${sharding-proxy}\conf\sharding-config.yaml. Same format with Sharding-JDBC-Driver's YAML configuration.

Start server

${sharding-proxy}\bin\start.sh ${port}

sharding-jdbc's People

Contributors

terrymanu avatar haocao avatar tuohai666 avatar hanahmily avatar tristazero avatar maxiaoguang64 avatar guangyun1013 avatar oracle219 avatar saaavsaaa avatar chidaodezhongsheng avatar yue530tom avatar wu-sheng avatar xydonne avatar ericj100 avatar mty2015 avatar yangfuhai avatar timvdlippe avatar yunaiv avatar dogfc avatar jinfei21 avatar junxiong avatar bohrqiu avatar

Watchers

James Cloos avatar  avatar

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.