Git Product home page Git Product logo

ha-db's Introduction

SaaS

说明:

多租户模式也就是实现单应用的数据库动态切换.根据前端用户带有的数据库标识访问对应的数据库.

整体实现依赖 Mycat的注解方式 /#mycat:schema=schema_name/ sql

1.schema_name 通过dubbo的RpcContext进行传递至DAO层. @see com.hitler.common.dubbo.filter.AuthenticationFilter

2.在DAO 层通过Hibernate jpa 拦截器在所有的 HQL/SQL 执行之前加入MyCat定义的注解. @see com.hitler.common.aop.CheageSchemaInterceptor

3.SQL的路由工作交给Mycat完成.

环境说明: 1.项目由maven构建.于pom内修改私服地址,当然不修改也没关系.默认会索引中心库.打包运行脚本已实现,可一键运行maven命令 :clean install

2.项目 框架组成: mysql、mycat、spring、jpa (hibernate jpa)、dubbo.
3.项目内有JPA与spring结合的基础应用环境.需要对JPA与spring 有一定了解.
4.dubbo,http://dubbo.io ,此项目用的注册中心是zookeeper.所以最少需要安装一个节点的zookeeper.

5.当然最重要的点是mycat,需要安装mycat并配置出多个schema出来. 可自行查找文档配置. 

ha-db's People

Contributors

onsoul 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.