mysql 多个磁盘_跨多个磁盘传播mysql数据

bd96500e110b49cbb3cd949968f18be7.png

I have a large mysql database and two small disks on centos, how do I make the it utilize both disks?

解决方案

You can partition a table over multiple drives. Have a look at the official manual, which covers this subject in depth.

Here's an example to partition an existing table over multiple drives:

ALTER TABLE mytable

PARTITION BY RANGE (mycolumn)(

PARTITION p01 VALUES Less Than (10000)

DATA DIRECTORY = "/mnt/disk1"

INDEX DIRECTORY = "/mnt/disk1",

PARTITION p02 VALUES Less Than (20000)

DATA DIRECTORY = "/mnt/disk2"

INDEX DIRECTORY = "/mnt/disk2",

PARTITION p03 VALUES Less Than MAXVALUE

DATA DIRECTORY = "/mnt/disk3"

INDEX DIRECTORY = "/mnt/disk3"

);

Mind that this needs NO_DIR_IN_CREATE to be off. It doesn't seem to work in windows, and it doesn't seem to work with InnoDB.

If you run out of diskspace on your last partition, you can split it with following statement:

ALTER TABLE mytable REORGANIZE PARTITION p03 INTO

(

PARTITION p03 VALUES Less Than (30000)

DATA DIRECTORY = "/mnt/disk3"

INDEX DIRECTORY = "/mnt/disk3",

PARTITION p04 VALUES Less Than MAXVALUE

DATA DIRECTORY = "/mnt/disk4"

INDEX DIRECTORY = "/mnt/disk4"

);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值