关于MySQL分区表的数据和索引文分分开放置不同路径的技术,特做一个实验用于验证与试用。
实验环境:
redhat Linux as 5
MySQL5.5(存储引擎:MyISAM,字符集:utf8)
建表语句:
CREATE TABLE `portal_data_channel_3` (
`id` bigint(20) NOT NULL,
`name` varchar(150) DEFAULT NULL,
`program_name` varchar(150) DEFAULT NULL,
`channel_id` varchar(50) DEFAULT NULL,
`card_id` varchar(50) DEFAULT NULL,
`create_time` datetime NOT NULL,
`start_time` datetime DEFAULT NULL,
`end_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`,`create_time`)
) ENGINE=MyISAM
PARTITION BY RANGE (year(create_time))
(
PARTITION portal_data_channel_3_2011 VALUES LESS THAN (2011) index directory='/data/testpath/path0/idx' data directory='/data/testpath/path0/data',
PARTITION portal_data_channel_3_2012 VALUES LESS THAN (2012) index directory='/data/testpath/path1/idx' data directory='/data/testpath/path1/data',
PARTITION portal_data_channel_3_2013 VALUES LESS THAN (2013) index directory='/data/testpath/path2/idx' data directory='/data/testpath/path2/data',
PARTITION portal_data_channel_3_maxvalue VALUES LESS THAN MAXVALUE
);
结果报错:
ERROR 1 : Can't create/write to file '/data/testpath/path0/idx/portal_data_channel_3#P#portal_data_channel_3_2011.MYI' (Errcode: 17)
分析:
1、/data/testpath下有相应权限,权限均有rwx。
2、手工在/data/testpath下建立对应的path0/idx和path0/data目录均同样存储问题。
3、/tmp空间足够,各路径的空间也相当足够。
4、 数据库为新建数库,且是一个空数据库。
实验环境:
redhat Linux as 5
MySQL5.5(存储引擎:MyISAM,字符集:utf8)
建表语句:
CREATE TABLE `portal_data_channel_3` (
`id` bigint(20) NOT NULL,
`name` varchar(150) DEFAULT NULL,
`program_name` varchar(150) DEFAULT NULL,
`channel_id` varchar(50) DEFAULT NULL,
`card_id` varchar(50) DEFAULT NULL,
`create_time` datetime NOT NULL,
`start_time` datetime DEFAULT NULL,
`end_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`,`create_time`)
) ENGINE=MyISAM
PARTITION BY RANGE (year(create_time))
(
PARTITION portal_data_channel_3_2011 VALUES LESS THAN (2011) index directory='/data/testpath/path0/idx' data directory='/data/testpath/path0/data',
PARTITION portal_data_channel_3_2012 VALUES LESS THAN (2012) index directory='/data/testpath/path1/idx' data directory='/data/testpath/path1/data',
PARTITION portal_data_channel_3_2013 VALUES LESS THAN (2013) index directory='/data/testpath/path2/idx' data directory='/data/testpath/path2/data',
PARTITION portal_data_channel_3_maxvalue VALUES LESS THAN MAXVALUE
);
结果报错:
ERROR 1 : Can't create/write to file '/data/testpath/path0/idx/portal_data_channel_3#P#portal_data_channel_3_2011.MYI' (Errcode: 17)
分析:
1、/data/testpath下有相应权限,权限均有rwx。
2、手工在/data/testpath下建立对应的path0/idx和path0/data目录均同样存储问题。
3、/tmp空间足够,各路径的空间也相当足够。
4、 数据库为新建数库,且是一个空数据库。