企业实战_12_MyCat水平扩展_分库分表
接上一篇:企業(yè)實戰(zhàn)_11_MyCat垂直拆分相關(guān)配置
https://gblfy.blog.csdn.net/article/details/100055838
文章目錄
- 一、概念理論理解
- 1. 垂直拆分理解
- 2. 水平擴展理解
- 3. 水平擴展案例
- 4. 水平擴展場景
- 5. 水平拆分原則
- 6. 水平擴展架構(gòu)圖
- 二、關(guān)鍵問題+解決方案
- 2.1. 分片后如何查詢
- 2.2. 分片規(guī)則
- 2.3. 數(shù)據(jù)分片步驟
- 2.4. 如何選擇分片鍵
- 2.5. 分析業(yè)務(wù)模型選擇分片及算法
- 三、使用Mycat部署分片集群
- 3.1. 使用schema.xml配置邏輯庫及邏輯表
- 3.2. 使用rule.xml配置分片表的分片規(guī)則
- 3.3. 使用server.xml配置訪問用戶及權(quán)限
- 四、環(huán)境節(jié)點配置分布
- 五、創(chuàng)建4個分片數(shù)據(jù)庫節(jié)點
- 5.1. 導(dǎo)出和同步
- 5.2. 創(chuàng)建4個數(shù)據(jù)庫
- 5.3. 導(dǎo)入表結(jié)構(gòu)
- 5.4. node2驗證
- 5.5. node3驗證
- 六、實戰(zhàn)mycat
- 6.1. 添加數(shù)據(jù)節(jié)點
- 6.2. 添加數(shù)據(jù)節(jié)點
- 6.3. 數(shù)據(jù)分片名稱
- 6.4. 編輯rule.xml添加規(guī)則算法
- 七、數(shù)據(jù)測試驗證
- 7.1. 實現(xiàn)思路
- 7.2. 重新啟動mycat
- 7.3. 登錄mycat
- 7.4. 批量插入數(shù)據(jù)
- 7.5. 邏輯庫查詢
- 八、 數(shù)據(jù)分片驗證
- 8.1. node2節(jié)點order_db01驗證
- 8.2. node2節(jié)點order_db02驗證
- 8.3. node3節(jié)點order_db03驗證
- 8.4. node3節(jié)點order_db04驗證
- 8.5. 數(shù)據(jù)分片結(jié)論
一、概念理論理解
1. 垂直拆分理解
把表按照業(yè)務(wù)模塊分離到不同的mysql數(shù)據(jù)庫中,這樣就可以緩解請求壓力。
例如:訂單模塊的表在order_db數(shù)據(jù)庫中,產(chǎn)品模塊的表在product_db數(shù)據(jù)庫中,客戶模塊的表在customer_db數(shù)據(jù)庫中。
2. 水平擴展理解
- 水平擴展是在垂直拆分的基礎(chǔ)上進(jìn)行的
- 水平擴展是將單張表拆分成了多張表,分別放到不同的庫中,或者一個庫中的不同表中。
3. 水平擴展案例
- 案例簡介1:
電商平臺:訂單會比較多,一般先會對數(shù)據(jù)按照業(yè)務(wù)模塊進(jìn)行垂直拆分,在此基礎(chǔ)上,然后,針對大流量的數(shù)據(jù)庫表,例如訂單表,進(jìn)行水平擴展也叫作分庫分表也減輕數(shù)據(jù)庫壓力。 - 案例簡介2:
保險行業(yè)場景同上
實際案例實戰(zhàn):
order_master:訂單主表
- ①可以創(chuàng)建分別創(chuàng)建order_db01、order_db02、order_db03、order_db04四個數(shù)據(jù)庫。
- ②在以上4個數(shù)據(jù)庫中分別創(chuàng)建將order_master這張表。
- ③ 將order_master這張表的數(shù)據(jù)按照數(shù)據(jù)分片規(guī)則,分別插入到order_db01、order_db02、order_db03、order_db04四個數(shù)據(jù)庫中。
4. 水平擴展場景
把數(shù)據(jù)按照模塊劃分成了多個單獨的模塊,當(dāng)大流量和并發(fā)請求一起沖擊某個模塊達(dá)到一定量級時,垂直拆分不能解決這種現(xiàn)象。因此,需要針對數(shù)據(jù)量很大的表進(jìn)行水平拆分。
5. 水平拆分原則
1.水平拆分只是把某張數(shù)據(jù)量很大的表 水平拆分成幾片,術(shù)詞叫做數(shù)據(jù)庫分片
2. 這幾片數(shù)據(jù)庫表結(jié)構(gòu)都一樣
3. 按照一定的規(guī)則算法,對數(shù)據(jù)進(jìn)行分流*
6. 水平擴展架構(gòu)圖
如下圖說是:把訂單表進(jìn)行了水平擴展,分庫分表處理
二、關(guān)鍵問題+解決方案
2.1. 分片后如何查詢
2.2. 分片規(guī)則
2.3. 數(shù)據(jù)分片步驟
一、水平分片的步驟:
| 第二步 | 根據(jù)業(yè)務(wù)模型選擇分片鍵及分片算法 |
| 第三步 | 使用Mycat部署分片集群 |
| 第四步 | 測試分片幾群 |
| 第五步 | 業(yè)務(wù)數(shù)據(jù)遷移 |
2.4. 如何選擇分片鍵
如何選擇分片鍵
2.5. 分析業(yè)務(wù)模型選擇分片及算法
- 對訂單相關(guān)表進(jìn)行水平拆分
- 以訂單號作為分片鍵
- 采用簡單取模分片算法
注:分片鍵非常重要,這里以訂單號作為演示,最合理應(yīng)該以客戶id作為分片鍵
三、使用Mycat部署分片集群
3.1. 使用schema.xml配置邏輯庫及邏輯表
3.2. 使用rule.xml配置分片表的分片規(guī)則
3.3. 使用server.xml配置訪問用戶及權(quán)限
四、環(huán)境節(jié)點配置分布
以前
| node1 | 192.168.92.101 | MYSQL、mycat | imooc_db(主機物理) |
| node2 | 192.168.92.102 | MYSQL | order_db(從機物理) |
| node3 | 192.168.92.103 | MYSQL | product_db(主機物理) |
| node4 | 192.168.92.104 | MYSQL | customer_db(從機物理) |
現(xiàn)在
| node1 | 192.168.92.101 | MYCAT 、MYSQL | imooc_db(邏輯庫) |
| node2 | 192.168.92.102 | MYSQL | order_db(從機物理),order_db01和order_db01 |
| node3 | 192.168.92.103 | MYSQL | product_db(主機物理),order_db03和order_db04 |
| node4 | 192.168.92.104 | MYSQL | customer_db |
五、創(chuàng)建4個分片數(shù)據(jù)庫節(jié)點
5.1. 導(dǎo)出和同步
導(dǎo)出order_master表結(jié)構(gòu)
# 登錄node2節(jié)點,將order_db 數(shù)據(jù)庫中的order_master表結(jié)構(gòu)導(dǎo)出為order_master.sql mysqldump -uroot -p order_db order_master> order_master.sql# 將order_master.sql同步node03 scp order_master.sql root@192.168.92.103:/root5.2. 創(chuàng)建4個數(shù)據(jù)庫
# 登錄node2創(chuàng)建數(shù)據(jù)庫分片節(jié)點 # 分片數(shù)據(jù)庫名:order_db01/order_db02 mysql -uroot -p -e"create database order_db01" mysql -uroot -p -e"create database order_db02"# 登錄node3創(chuàng)建數(shù)據(jù)庫分片節(jié)點 # 分片數(shù)據(jù)庫名:order_db03/order_db04 mysql -uroot -p -e"create database order_db03" mysql -uroot -p -e"create database order_db04"5.3. 導(dǎo)入表結(jié)構(gòu)
# 登錄node2,將order_master.sql分別導(dǎo)入orderdb_01、order_db02 mysql -uroot -p order_db01 < order_master.sql mysql -uroot -p order_db02 < order_master.sql # 登錄node3,將order_master.sql分別導(dǎo)入order_db03、order_db04 mysql -uroot -p order_db03 < order_master.sql mysql -uroot -p order_db04 < order_master.sql5.4. node2驗證
# 登錄node2,登錄mysql物理庫mysql -uroot -p# 查詢數(shù)據(jù)庫列表 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | order_db | | order_db01 | | order_db02 | | performance_schema | | sys | +--------------------+ mysql> use order_db01; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> show tables; +----------------------+ | Tables_in_order_db01 | +----------------------+ | order_master | +----------------------+ mysql> use order_db02; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> show tables; +----------------------+ | Tables_in_order_db02 | +----------------------+ | order_master | +----------------------+5.5. node3驗證
# 登錄node3,登錄mysql物理庫mysql -uroot -p# 查詢數(shù)據(jù)庫列表 mysql> show databases;mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | order_db03 | | order_db04 | | performance_schema | | product_db | | sys | +--------------------+ mysql> use order_db03; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> show tables; +----------------------+ | Tables_in_order_db03 | +----------------------+ | order_master | +----------------------+ mysql> use order_db04; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> show tables; +----------------------+ | Tables_in_order_db04 | +----------------------+ | order_master | +----------------------+六、實戰(zhàn)mycat
6.1. 添加數(shù)據(jù)節(jié)點
編輯schema.xml,添加數(shù)據(jù)節(jié)點dataNode
# 登錄mycat服務(wù)器# 進(jìn)入到mycat配置目錄 cd /app/mycat/conf# 編輯schema.xml vim schema.xml# 添加4個數(shù)據(jù)節(jié)點dataNode <dataNode name="ordb01" dataHost="mysql92102" database="order_db01" /><dataNode name="ordb02" dataHost="mysql92102" database="order_db02" /><dataNode name="ordb03" dataHost="mysql92103" database="order_db03" /><dataNode name="ordb04" dataHost="mysql92103" database="order_db04" />6.2. 添加數(shù)據(jù)節(jié)點
由于我們對訂單表進(jìn)行了數(shù)據(jù)分片,因此,需要修改schema標(biāo)簽,添加數(shù)據(jù)節(jié)點ordb01,ordb02,ordb03,ordb04
# 編輯schema.xml,修改數(shù)據(jù)節(jié)點dataNode 將<table name="order_master" primaryKey="order_id" dataNode="ordb" /> 調(diào)整為 <table name="order_master" primaryKey="order_id" dataNode="ordb01,ordb02,ordb03,ordb04" />6.3. 數(shù)據(jù)分片名稱
將<table name="order_key" primaryKey="id" dataNode="ordb01,ordb02,ordb03,ordb04" />
調(diào)整為
<table name="order_master" primaryKey="order_id" dataNode="ordb01,ordb02,ordb03,ordb04" rule="order_master"/>
6.4. 編輯rule.xml添加規(guī)則算法
既然使用了數(shù)據(jù)分片,因此需要配置分片算法
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mycat:rule SYSTEM "rule.dtd"> <mycat:rule xmlns:mycat="http://io.mycat/"><tableRule name="order_master"><rule><columns>customer_id</columns><algorithm>mod-long</algorithm></rule></tableRule><function name="mod-long" class="io.mycat.route.function.PartitionByMod" ><property name="count">4</property></function> </mycat:rule>七、數(shù)據(jù)測試驗證
登錄mycat 批量插入數(shù)據(jù)測試驗證
7.1. 實現(xiàn)思路
1 新建一個order_master表 2. 把order_master表分別同步到order_db01、order_db02、order_db03、order_db04 3. 準(zhǔn)備一個批量插入的腳本例如:insert into10條數(shù)據(jù)進(jìn)行測試 4. 分別登錄order_db01、order_db02、order_db03、order_db04查看,數(shù)據(jù)的分布情況 5. 對數(shù)據(jù)的分片鍵進(jìn)行取模驗證 6. 判斷插入的數(shù)據(jù)是否按照取模的算法正確插入到數(shù)據(jù)庫中需要思考的問題:
這對電商項目應(yīng)該拿訂單號來作為分片主鍵還是下訂單的order_id 來作為分片主鍵?
如果拿訂單號來作為分片主鍵的話,數(shù)據(jù)會分布均勻
如果拿客戶號customer_id 來作為分片主鍵的話,數(shù)據(jù)會分布不均勻
想想哪個更合理?
7.2. 重新啟動mycat
由于剛才修改了mycat的配置文件,重新啟動mycat才會生效。
# 停止mycat服務(wù) mycat stop# 啟動mycat服務(wù) mycat start# 查看mycat啟動日志 tail -f /app/mycat/logs/wrapper.logMyCAT Server startup successfully. see logs in logs/mycat.log7.3. 登錄mycat
# 使用mysql客戶端連接mycat,并登錄mycat mysql -uapp_imooc -p123456 -h192.168.92.101 -P8066 # 使用imooc_db數(shù)據(jù)庫 use imooc_db;7.4. 批量插入數(shù)據(jù)
到order_master表中
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 1, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (2, 2, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 3, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 4, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 5, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 6, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 7, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 8, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES (1, 9, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25'); INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time) VALUES ( 1,10, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');7.5. 邏輯庫查詢
mysql> SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master; +-------------+----------+----------+---------------------+ | customer_id | order_sn | order_id | mod(customer_id, 4) | +-------------+----------+----------+---------------------+ | 2 | 2 | 1 | 2 | | 6 | 1 | 2 | 2 | | 10 | 1 | 3 | 2 | | 4 | 1 | 1 | 0 | | 8 | 1 | 2 | 0 | | 3 | 1 | 1 | 3 | | 7 | 1 | 2 | 3 | | 1 | 1 | 1 | 1 | | 5 | 1 | 2 | 1 | | 9 | 1 | 3 | 1 | +-------------+----------+----------+---------------------+ 10 rows in set (0.00 sec)八、 數(shù)據(jù)分片驗證
8.1. node2節(jié)點order_db01驗證
# 連接node2服務(wù)器,登錄物理mysql mysql -uroot -p123456order_db01數(shù)據(jù)庫
# 使用指定數(shù)據(jù)庫 use order_db01;# 查詢order_master表中取模數(shù)據(jù) SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master;mysql> use order_db01; Database changed mysql> SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master; +-------------+----------+----------+--------------------+ | customer_id | order_sn | order_id | mod(customer_id,4) | +-------------+----------+----------+--------------------+ | 4 | 1 | 1 | 0 | | 8 | 1 | 2 | 0 | +-------------+----------+----------+--------------------+ 2 rows in set (0.00 sec)order_db01分片數(shù)據(jù)庫節(jié)點插入數(shù)據(jù)2條
8.2. node2節(jié)點order_db02驗證
order_db02數(shù)據(jù)庫
# 使用指定數(shù)據(jù)庫 use order_db02;# 查詢order_master表中取模數(shù)據(jù) SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master;mysql> use order_db02; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master; +-------------+----------+----------+--------------------+ | customer_id | order_sn | order_id | mod(customer_id,4) | +-------------+----------+----------+--------------------+ | 1 | 1 | 1 | 1 | | 5 | 1 | 2 | 1 | | 9 | 1 | 3 | 1 | +-------------+----------+----------+--------------------+ 3 rows in set (0.00 sec)order_db02分片數(shù)據(jù)庫節(jié)點插入數(shù)據(jù)3條
8.3. node3節(jié)點order_db03驗證
# 連接node3服務(wù)器,登錄物理mysql mysql -uroot -p123456 mysql> use order_db03; Database changed mysql> SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master; +-------------+----------+----------+--------------------+ | customer_id | order_sn | order_id | mod(customer_id,4) | +-------------+----------+----------+--------------------+ | 2 | 2 | 1 | 2 | | 6 | 1 | 2 | 2 | | 10 | 1 | 3 | 2 | +-------------+----------+----------+--------------------+ 3 rows in set (0.00 sec)order_db03分片數(shù)據(jù)庫節(jié)點插入數(shù)據(jù)3條
8.4. node3節(jié)點order_db04驗證
mysql> use order_db04; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master; +-------------+----------+----------+--------------------+ | customer_id | order_sn | order_id | mod(customer_id,4) | +-------------+----------+----------+--------------------+ | 3 | 1 | 1 | 3 | | 7 | 1 | 2 | 3 | +-------------+----------+----------+--------------------+ 2 rows in set (0.00 sec)order_db04分片數(shù)據(jù)庫節(jié)點插入數(shù)據(jù)2條
8.5. 數(shù)據(jù)分片結(jié)論
mysql> SELECT customer_id,order_sn,order_id,mod(customer_id,4) FROM order_master; +-------------+----------+----------+---------------------+ | customer_id | order_sn | order_id | mod(customer_id, 4) | +-------------+----------+----------+---------------------+ | 2 | 2 | 1 | 2 | | 6 | 1 | 2 | 2 | | 10 | 1 | 3 | 2 | | 4 | 1 | 1 | 0 | | 8 | 1 | 2 | 0 | | 3 | 1 | 1 | 3 | | 7 | 1 | 2 | 3 | | 1 | 1 | 1 | 1 | | 5 | 1 | 2 | 1 | | 9 | 1 | 3 | 1 | +-------------+----------+----------+---------------------+ 10 rows in set (0.00 sec)從上面數(shù)據(jù)分片的數(shù)據(jù)來看:
1.10條數(shù)據(jù)按照數(shù)據(jù)分片規(guī)則簡單取模,分別插入到了4個數(shù)據(jù)庫中。
2.order_master表中的主鍵是order_id,主鍵有自增約束。雖然主鍵是唯一的不可重復(fù)的,但是,是相對于一個表而言的。
3.這些重復(fù)的order_id的數(shù)據(jù)插入到了不同的數(shù)據(jù)庫中。
以上會造成一個現(xiàn)象就是,在imooc_db邏輯庫中的order_master表獲取order_id為1的場景,會出現(xiàn)什么問題呢?
order_id數(shù)據(jù)為1的有3條數(shù)據(jù),那最后回去哪一條呢?
答案是:不能取任何一條。
那應(yīng)該如何解決上述問題呢?請大家繼續(xù)閱讀下一章全局自增ID。
下一篇:企業(yè)實戰(zhàn)_13_MyCat清除冗余數(shù)據(jù)
https://gblfy.blog.csdn.net/article/details/100057317
總結(jié)
以上是生活随笔為你收集整理的企业实战_12_MyCat水平扩展_分库分表的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么去除idea中代码的波浪线(黄色警告
- 下一篇: atom插件安装方法