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

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

  • 相关阅读:
    将指定文件夹下所有图片转换成base64并返回数组
    SQL技巧
    yii 进行事务操作是不可以在一条sql里边放多条sql
    yii 直接执行sql
    按照特定方法排序
    表名为变量时的语法
    如何添加 actions
    触发器原理
    codeCeption 调试方法
    最长不下降子序列(LIS)
  • 原文地址:https://www.cnblogs.com/kelelipeng/p/12573969.html
Copyright © 2011-2022 走看看