mysql 第二十七篇文章~相關分區功能的測試七

來源:互聯網
上載者:User

標籤:插入   size   images   name   bsp   prim   null   ble   相關   

一 簡介:今天咱們來進行測試

二分區規則 auto-sharding-rang-mod

  1 table 相關配置
  <tableRule name="auto-sharding-rang-mod">
  <rule>
  <columns>id</columns>
  <algorithm>rang-mod</algorithm>
  </rule>
  </tableRule>-
 2 function 相關配置
 <function name="rang-mod" class="io.mycat.route.function.PartitionByRangeMod">
 <property name="mapFile">partition-range-mod.txt</property>
 </function>
 3 屬性解析
 mapfile partition-range-mod.txt
 配置
 # range start-end ,data node group size
 0-200M=5
 200M1-400M=1
 400M1-600M=4
 600M1-800M=4
 800M1-1000M=6
 =號後面的數字代表該分區組所擁有的分區的數量。

 4 個人理解

 此分區節點和前面的不太一樣,代表的是分區節點的數量.在節點群組內部,經過我的測試,這兩個節點的資料分部是迴圈依次的,分配很平均,要確保你最後配置的邏輯節點等於這裡面配置的節點總和
 5 測試

   1 配置相關測試表

   <table name="user" primaryKey="id" dataNode="db1,db2" rule="sharding-by-murmur" />

   2 建立相關表

   3 relod @@config;

  4 進行測試
      1 建立相關表

      CREATE TABLE ddd(
     `id` int(11) NOT NULL,
    `create_time` datetime DEFAULT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    2 進行schema配置
     <table name="ddd" primaryKey="id" dataNode="db1,db2" rule="auto-sharding-rang-mod" />
   3 修改配置
   # range start-end ,data node group size
   0-200M=2 200W的資料平均分配在前2個節點

   reload @@conifg

   4 進行插入測試即可

   

mysql 第二十七篇文章~相關分區功能的測試七

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.