ITeye博客

基于iBatis的开源分布式数据访问层

fujohnwang · 2011-03-28 11:46 · Tech · 企业架构 · Markdown

http://code.alibabatech.com/wiki/display/cobarclient/Home

这个东西其实已经出来很长时间了,思路和成型也比其它相似的东西要早一些,公司近期才准备开源,所以就放出来了, 当然,不一定完美,东西比较简单, 所以开源出来希望能集思广益, 欢迎使用,拍砖,提意见

主要features: 1- data access support with horizontal or vertical partitions. 2- support 2-master active HA deployment infrustructure, of course, the applications still can choose other 3- HA solutions, like the ones specific to destination databases(e.g. RAC of Oracle). 4- Data aggregation support, currently only simple data merge functionality is available. 5- Local database transaction support(Currently, such requirement is fulfilled by using “Best Efforts 1PC Pattern” ). 6- SQL auditing, analysis, etc.

公司要求文档和网站一概英文,所以看英文费力的,可以check out代码出来, 然后通过maven编译,之后可以在target/docs目录下找到一份中文的完整文档(实际上中文和英文各准备了一份)

GL&HF

评论(28)

  1. #28 楼 · fujohnwang · 2011-04-29 13:32
  2. #27 楼 · gzenzen · 2011-04-28 23:10
  3. #26 楼 · fujohnwang · 2011-04-27 08:39

    bornwan writes:

    我就很想知道分布式数据源,水平切分之后排序、分页的解决方案!

    虽然不是完整的支持,但排序是指定支持的, 至于分页,我们没有需求,所以没有投入精力去支持。 我们希望的是,大家的融入社区并做贡献, 谢谢

  4. #25 楼 · fujohnwang · 2011-04-27 08:37

    gzenzen writes:

    什么时候支持mybatis3、spring3

    对于大多数网络应用, 以及不需要事务的应用, 现在的版本应该是可以平滑过度到3的, 但现在没有资源测试这方面的版本兼容性, 如果有心,你不妨可以测试一下然后反馈给社区啊

  5. #24 楼 · bornwan · 2011-04-26 11:12

    我就很想知道分布式数据源,水平切分之后排序、分页的解决方案!

  6. #23 楼 · gzenzen · 2011-04-25 21:09

    什么时候支持mybatis3、spring3

  7. #22 楼 · fujohnwang · 2011-04-06 10:34

    rendong writes:

    升级到 ibatis3 和spring3 ,改动大么

    Spring3的API有变动, 之前测试过,现在的处理会有问题,比如事务管理的concern。

  8. #21 楼 · rendong · 2011-04-03 11:33

    升级到 ibatis3 和spring3 ,改动大么

  9. #20 楼 · fujohnwang · 2011-03-31 16:50

    zhxing writes:

    [quote=liuyes]不错,编译成功,不知道有没有关于hibernate的,呵呵[/quote]

    hibernate 之前有个hibernate-share 的项目的。。现在不知道怎样了。。虽然没用过ibaits ,但大概了解比hibernate 简单很多,hiernate 感觉太过于复杂,封装了好多。。不容易扩展。。 :wink:

    是hibernate-shards吧?呵呵,其实要在这些ORM上面做扩展, 许多时候CUD不是大问题, R可能才是比较棘手的 :-)

  10. #19 楼 · fujohnwang · 2011-03-31 16:47

    tutu1982 writes:

    LZ,对于多应用服务器+分布式数据源中的事务管理目前这个方案能胜任么?

    你好, 事务管理有几个层级,比如2PC, 1PC…, BestEffort 1PC, etc., CobarClient采用的是Best Effort 1PC模式的事务管理, 简单来讲就是可以保证一个数据操作过程中多个数据源各自的本地事务, 但不保证全局的分布式事务(因为这样的性能对大部分应用来说不可容忍)。

    不过,CobarClient依赖的是DataSource粒度的资源管理,所以, 如果你的Middleware可以提供支持XA的DS, 那也是可以的。

    CobarClient定位的是中小型应用, 如果非要在大规模集群使用,那建议引入某些中间件产品来统一资源的throttle等关注点。 另外, CobarClient因为是更高层次的封装(相对于protocol,driver等级别), 所以,用户可以根据自己的需要, 很容易的进行扩展。(CobarClient在设计的时候尽量在保证兼容性的前提下提高扩展性的考虑)

    希望以上能够解答你的疑惑, 建议你check out代码读一下,代码不多,应该不难理解,也希望你能够提供建议和patch等 :-)

  11. #18 楼 · hk8082 · 2011-03-31 15:11

    研究研究,正好要做分布式这块

  12. #17 楼 · tutu1982 · 2011-03-31 11:01

    LZ,对于多应用服务器+分布式数据源中的事务管理目前这个方案能胜任么?

  13. #16 楼 · www.oladdy.com · 2011-03-30 14:24

    很好,有时间可以研究研究

  14. #15 楼 · fujohnwang · 2011-03-30 09:01

    hypgr writes:

    还是有错,本地的一些依赖没有修改完成,下面是日志

    [info] Failed to resolve artifact.

    Missing:

    1. com.h2database:h2:jar:1.2.130

    Try downloading the file manually from the project website.

    Then, install it using the command: mvn install:install-file -DgroupId=com.h2database -DartifactId=h2 -Dversion=1.2.130 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=com.h2database -DartifactId=h2 -Dversion=1.2.130 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) com.h2database:h2:jar:1.2.130

    1. mysql:mysql-connector-java:jar:5.1.12

    Try downloading the file manually from the project website.

    Then, install it using the command: mvn install:install-file -DgroupId=mysql -DartifactId=mysql-connector-java -Dversion=5.1.12 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=mysql -DartifactId=mysql-connector-java -Dversion=5.1.12 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) mysql:mysql-connector-java:jar:5.1.12

    1. org.testng:testng:jar:jdk15:5.11

    Try downloading the file manually from the project website.

    Then, install it using the command: mvn install:install-file -DgroupId=org.testng -DartifactId=testng -Dversion=5.11 -Dclassifier=jdk15 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.testng -DartifactId=testng -Dversion=5.11 -Dclassifier=jdk15 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) org.testng:testng:jar:jdk15:5.11


    3 required artifacts are missing.

    for artifact: com.alibaba.cobar:cobar-client:jar:1.0.3

    这些你可以修改你的settings去抓有这些库的repo, 或者你直接install到本地repo也可以, maven就是这样。

  15. #14 楼 · Sink_deep · 2011-03-29 22:59

    hypgr writes:

    Missing:

    1. javax.jms:jms:jar:1.1

    Try downloading the file manually from: http://java.sun.com/products/jms/docs.html

    Then, install it using the command: mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) log4j:log4j:jar:1.2.15 3) javax.jms:jms:jar:1.1


    1 required artifact is missing.

    for artifact: com.alibaba.cobar:cobar-client:jar:1.0.3

    这个问题是sun将这些jar包笼罩在license管理的淫威下,如果是单纯的记录日志,可以使用log4j1.2.14

  16. #13 楼 · 泛舟天下 · 2011-03-29 20:46

    fujohnwang writes:

    [quote=泛舟天下]楼主以前在英极?[/quote] はい

    原来真是! :D

  17. #12 楼 · SeanHe · 2011-03-29 18:32

    mark 准备下载学习

  18. #11 楼 · zhxing · 2011-03-29 15:36

    liuyes writes:

    不错,编译成功,不知道有没有关于hibernate的,呵呵

    hibernate 之前有个hibernate-share 的项目的。。现在不知道怎样了。。虽然没用过ibaits ,但大概了解比hibernate 简单很多,hiernate 感觉太过于复杂,封装了好多。。不容易扩展。。 :wink:

  19. #10 楼 · liuyes · 2011-03-29 15:29

    不错,编译成功,不知道有没有关于hibernate的,呵呵

  20. #9 楼 · hypgr · 2011-03-29 13:11

    还是有错,本地的一些依赖没有修改完成,下面是日志

    Failed to resolve artifact.

    Missing:

    1. com.h2database:h2:jar:1.2.130

    Try downloading the file manually from the project website.

    Then, install it using the command: mvn install:install-file -DgroupId=com.h2database -DartifactId=h2 -Dversion=1.2.130 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=com.h2database -DartifactId=h2 -Dversion=1.2.130 -Dpackaging=jar -Dfile=/path/to/file -Durl=< -DrepositoryId=

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) com.h2database:h2:jar:1.2.130

    1. mysql:mysql-connector-java:jar:5.1.12

    Try downloading the file manually from the project website.

    Then, install it using the command: mvn install:install-file -DgroupId=mysql -DartifactId=mysql-connector-java -Dversion=5.1.12 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=mysql -DartifactId=mysql-connector-java -Dversion=5.1.12 -Dpackaging=jar -Dfile=/path/to/file -Durl=< -DrepositoryId=

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) mysql:mysql-connector-java:jar:5.1.12

    1. org.testng:testng:jar:jdk15:5.11

    Try downloading the file manually from the project website.

    Then, install it using the command: mvn install:install-file -DgroupId=org.testng -DartifactId=testng -Dversion=5.11 -Dclassifier=jdk15 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.testng -DartifactId=testng -Dversion=5.11 -Dclassifier=jdk15 -Dpackaging=jar -Dfile=/path/to/file -Durl=< -DrepositoryId=

    Path to dependency: 1) com.alibaba.cobar:cobar-client:jar:1.0.3 2) org.testng:testng:jar:jdk15:5.11


    3 required artifacts are missing.

    for artifact: com.alibaba.cobar:cobar-client:jar:1.0.3

评论功能维护中,当前仅展示历史评论。