1,在mysql 命令行中安装Archive引擎
1, 查找mysql plugins lib目录,看目录中是否存在Archive的so;
mysql > show variables like ‘plugin_dir’;
2, 查看现有的引擎;
mysql > show engines;
3,安装Archive引擎
Mysql> install plugin archive soname ‘ha_archive.so’;
4,查看安装结果
Mysql> show engines;
2,更新表引擎
mysql > alter table t_collection engine=archive;
mysql > alter table coocaaDaoHang engine=archive;
3, 新建表逻辑分区;
archive引擎有限制,主键不能超过8byte,分区有限制必须用主键来分区,所以要保留id字段的话,只能用id来分区
CREATE TABLE `t_collection` (
`ID` BIGINT (20) NOT NULL AUTO_INCREMENT COMMENT ‘主键‘,
`Path` TEXT COMMENT ‘访问路径‘,
`Content` TEXT COMMENT ‘数据包内容‘,
`CreateTime` DATETIME NOT NULL COMMENT ‘收集时间‘,
PRIMARY KEY (`ID`)
) ENGINE= ARCHIVE DEFAULT CHARSET=utf8
PARTITION BY RANGE (ID) (
PARTITION p0 VALUES LESS THAN (1000000000),
PARTITION p1 VALUES LESS THAN (2000000000),
PARTITION p2 VALUES LESS THAN (3000000000),
PARTITION p3 VALUES LESS THAN (4000000000),
PARTITION p4 VALUES LESS THAN (5000000000),
PARTITION p5 VALUES LESS THAN (6000000000),
PARTITION p6 VALUES LESS THAN (7000000000),
PARTITION p7 VALUES LESS THAN (8000000000),
PARTITION p8 VALUES LESS THAN (9000000000),
PARTITION p9 VALUES LESS THAN MAXVALUE
);
)