In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how to achieve MyISAM partition table migration and merging. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
Dyn_change_yyyymm is a myisam partitioned by date (field time_d), and only insert,select operates.
The structure from March 2016 is as follows:
CREATE TABLE `dyn_change_ 201603` (
`time_ d`int (8) NOT NULL COMMENT 'account period'
`id`char (32) NOT NULL COMMENT 'Business ID'
`content`text COMMENT 'content'
`create_ time`int (11) NOT NULL COMMENT 'time'
KEY `idx_ id` (`id`)
KEY `idx_create_ time` (`create_ time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=' dynamic data record table'
/ * 50100 PARTITION BY RANGE (time_d)
(PARTITION dypt_20160301 VALUES LESS THAN (20160302) ENGINE = MyISAM
PARTITION dypt_20160302 VALUES LESS THAN (20160303) ENGINE = MyISAM
PARTITION dypt_20160303 VALUES LESS THAN (20160304) ENGINE = MyISAM
PARTITION dypt_20160304 VALUES LESS THAN (20160305) ENGINE = MyISAM
PARTITION dypt_20160305 VALUES LESS THAN (20160306) ENGINE = MyISAM
PARTITION dypt_20160306 VALUES LESS THAN (20160307) ENGINE = MyISAM
PARTITION dypt_20160307 VALUES LESS THAN (20160308) ENGINE = MyISAM
PARTITION dypt_20160308 VALUES LESS THAN (20160309) ENGINE = MyISAM
PARTITION dypt_20160309 VALUES LESS THAN (20160310) ENGINE = MyISAM
PARTITION dypt_20160310 VALUES LESS THAN (20160311) ENGINE = MyISAM
PARTITION dypt_20160311 VALUES LESS THAN (20160312) ENGINE = MyISAM
PARTITION dypt_20160312 VALUES LESS THAN (20160313) ENGINE = MyISAM
PARTITION dypt_20160313 VALUES LESS THAN (20160314) ENGINE = MyISAM
PARTITION dypt_20160314 VALUES LESS THAN (20160315) ENGINE = MyISAM
PARTITION dypt_20160315 VALUES LESS THAN (20160316) ENGINE = MyISAM
PARTITION dypt_20160316 VALUES LESS THAN (20160317) ENGINE = MyISAM
PARTITION dypt_20160317 VALUES LESS THAN (20160318) ENGINE = MyISAM
PARTITION dypt_20160318 VALUES LESS THAN (20160319) ENGINE = MyISAM
PARTITION dypt_20160319 VALUES LESS THAN (20160320) ENGINE = MyISAM
PARTITION dypt_20160320 VALUES LESS THAN (20160321) ENGINE = MyISAM
PARTITION dypt_20160321 VALUES LESS THAN (20160322) ENGINE = MyISAM
PARTITION dypt_20160322 VALUES LESS THAN (20160323) ENGINE = MyISAM
PARTITION dypt_20160323 VALUES LESS THAN (20160324) ENGINE = MyISAM
PARTITION dypt_20160324 VALUES LESS THAN (20160325) ENGINE = MyISAM
PARTITION dypt_20160325 VALUES LESS THAN (20160326) ENGINE = MyISAM
PARTITION dypt_20160326 VALUES LESS THAN (20160327) ENGINE = MyISAM
PARTITION dypt_20160327 VALUES LESS THAN (20160328) ENGINE = MyISAM
PARTITION dypt_20160328 VALUES LESS THAN (20160329) ENGINE = MyISAM
PARTITION dypt_20160329 VALUES LESS THAN (20160330) ENGINE = MyISAM
PARTITION dypt_20160330 VALUES LESS THAN (20160331) ENGINE = MyISAM
PARTITION dypt_20160331 VALUES LESS THAN (20160401) ENGINE = MyISAM) * /
Dyn_change_201603 needs to be migrated to the new environment without affecting insert.
The steps are as follows:
1) assume that the current date is: March 30th, 2016, corresponding to the partition dypt_20160330, the new environment creates dyn_change_ 201603 table (non-partition table). Insert operations can be moved to the new environment
2) rename the table dyn _ change_201603 in the old environment to: dyn_change_201603_old
3) under the data directory of mysql, scp the data file & index file of dyn_change_201603_old to the corresponding path of the new environment. [note: the corresponding data of dyn_change_201603_old at this time & & index file is different from dyn_change_201603 's data & & index file]
4) then exchange the dyn_change_201603,dyn_change_201603_old table name. After exchange, more than 90% of the data is in the dyn_change_201603 table, while a small part of the data is in dyn_change_201603_old (only in partition dypt_20160330)
Dyn_change_201603 accepts the current insert operation
5) then export the data of the dypt_20160330 partition of dyn_change_201603_old (only a small amount of data), and you can export the dyn_change_201603_30.csv file
6) then import the data from dyn_change_201603_30.csv into dyn_change_201603
7) alter table dyn_change_201603 analyze partition dypt_20160330.
[note: or can pause insert operation when there are few insert operations].
The migration merge is complete.
The above is the editor for you to share how to achieve MyISAM partition table migration and merge, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.