zoukankan      html  css  js  c++  java
  • 分库分表利器——sharding-sphere


    1 分库分表利器——sharding-sphere
    https://www.jianshu.com/p/952108f777a3


    2 Sharding-Sphere:Sharding-Proxy分库分表
    https://blog.csdn.net/zhuyu19911016520/article/details/90051340

    3 Sharding-Proxy的使用
    https://www.cnblogs.com/yeyongjian/p/10107078.html


    4 利用ShardingSphere(sharding-proxy)实现分库分表,通过整合ZooKeeper,进行简单配置文件修改轻松实现跨库跨表相关操作,轻量级零侵入整合项目开发
    https://blog.csdn.net/u014374009/article/details/102418034

    * ShardingSphere-用户手册

    https://shardingsphere.apache.org/document/current/cn/overview/


    https://shardingsphere.apache.org/document/current/cn/manual/sharding-jdbc/configuration/config-spring-namespace/

    https://shardingsphere.apache.org/document/current/cn/manual/sharding-jdbc/usage/sharding/

    ######################################################################################################

    #

    # Here you can configure the rules for the proxy.

    # This example is configuration of master-slave rule.

    #  

    # If you want to use master-slave, please refer to this file;

    # if you want to use sharding, please refer to the config-sharding.yaml.

    #

    ######################################################################################################

    #分库分表好用

    schemaName: master_slave_db

    dataSources:

    ds_0:

       url: jdbc:mysql://10.102.16.36:3306/demo_ds_0?serverTimezone=UTC&useSSL=false

       username: root

       password: root

       autoCommit: true

       connectionTimeout: 30000

       idleTimeout: 60000

       maxLifetime: 1800000

       maximumPoolSize: 50

    ds_1:

       url: jdbc:mysql://10.102.16.36:3306/demo_ds_1?serverTimezone=UTC&useSSL=false

       username: root

       password: root

       autoCommit: true

       connectionTimeout: 30000

       idleTimeout: 60000

       maxLifetime: 1800000

       maximumPoolSize: 50  

     ds0_slave:

       url: jdbc:mysql://10.102.16.64:3306/demo_slave_0?serverTimezone=UTC&useSSL=false

       username: sa

       password: abcd1234

       autoCommit: true

       connectionTimeout: 30000

       idleTimeout: 60000

       maxLifetime: 1800000

       maximumPoolSize: 50  

     ds1_slave:

       url: jdbc:mysql://10.102.16.64:3306/demo_slave_1?serverTimezone=UTC&useSSL=false

       username: sa

       password: abcd1234

       autoCommit: true

       connectionTimeout: 30000

       idleTimeout: 60000

       maxLifetime: 1800000

       maximumPoolSize: 50  

    shardingRule:

    tables:

       t_order:

         actualDataNodes: ds_${0..1}.t_order_${0..1}

         tableStrategy:

           inline:

             shardingColumn: order_id

             algorithmExpression: t_order_${order_id % 2}

         keyGeneratorColumnName: order_id

       t_order_item:

         actualDataNodes: ds_${0..1}.t_order_item_${0..1}

         tableStrategy:

           inline:

             shardingColumn: order_item_id

             algorithmExpression: t_order_item_${order_item_id % 2}

         keyGeneratorColumnName: order_item_id

    bindingTables:

       - t_order,t_order_item

    defaultDatabaseStrategy:

       inline:

         shardingColumn: user_id

         algorithmExpression: ds_${user_id % 2}

    defaultTableStrategy:

       none:

    defaultKeyGeneratorClassName: io.shardingsphere.core.keygen.DefaultKeyGenerator

    #---------------------------读写分离不好用

    masterSlaveRule:

      name: ds_0

      masterDataSourceName: ds_0

      slaveDataSourceNames:

        - ds0_slave

      name: ds_1

      masterDataSourceName: ds_1

      slaveDataSourceNames:

        - ds1_slave

    #---------------------------读写分离不好用

  • 相关阅读:
    最大子段和问题
    moore voting algorithm for majority element in vector
    linux命令 wget
    一道简单的局部链表反转的问题,具体解决时的麻烦的分类
    20145215《网络对抗》Exp2 后门原理与实践
    20145215《网络对抗》shellcode注入&Return-to-libc攻击深入
    20145215卢肖明《网络对抗》逆向及Bof基础
    20145215《信息安全系统设计基础》课程总结
    20145215&20145307《信息安全系统设计基础》实验五 网络通信
    20145215《信息安全系统设计基础》第十四周学习总结
  • 原文地址:https://www.cnblogs.com/kelelipeng/p/12573969.html
Copyright © 2011-2022 走看看