亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 1012 | 回復(fù): 0
打印 上一主題 下一主題

mysqlhotcopy 熱備工具體驗(yàn)與總結(jié) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2011-12-19 13:55 |只看該作者 |倒序?yàn)g覽
今天有空嘗試了一下MYSQLHOTCOPY這個(gè)快速熱備MYISAM引擎的工具。
(本文是針對(duì)單個(gè)服務(wù)器的情況,以后將會(huì)加入多服務(wù)器相關(guān)操作)
他和MYSQLDUMP的比較:
1、前者是一個(gè)快速文件意義上的COPY,后者是一個(gè)數(shù)據(jù)庫(kù)端的SQL語(yǔ)句集合。
2、前者只能運(yùn)行在數(shù)據(jù)庫(kù)目錄所在的機(jī)器上,后者可以用在遠(yuǎn)程客戶端。
3、相同的地方都是在線執(zhí)行LOCK TABLES 以及 UNLOCK TABLES
4、前者恢復(fù)只需要COPY備份文件到源目錄覆蓋即可,后者需要倒入SQL文件到原來(lái)庫(kù)中。(source 或者\(yùn).或者 mysql < 備份文件)
用MYSQLHOTCOPY備份的步驟:
1、有沒(méi)有PERL-DBD模塊安裝
我的機(jī)器上:
[root@localhost data]# rpm -qa |grep perl-DBD | grep MySQL

perl-DBD-MySQL-3.0007-1.fc6
2、在數(shù)據(jù)庫(kù)段分配一個(gè)專門用于備份的用戶
mysql> grant select,reload,lock tables on *.* to 'hotcopyer'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

3、在/etc/my.cnf或者登陸用戶的個(gè)人主文件.my.cnf里面添加
[mysqlhotcopy]
interactive-timeout
user=hotcopyer
password=123456
port=3306
4、開(kāi)始備份。
[root@localhost ~]# mysqlhotcopy t_girl t_girl_new

Locked 4 tables in 0 seconds.
Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`id`, `t_girl`.`parent`) in 0 seconds.
Copying 22 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 4 tables (22 files) in 5 seconds (5 seconds overall).

備份后的目錄:
[root@localhost data]# du -h | grep t_girl

213M ./t_girl
213M ./t_girl_copy
[root@localhost ~]

5、MYSQLHOTCOPY用法詳解。
1)、mysqlhotcopy 原數(shù)據(jù)庫(kù)名,新數(shù)據(jù)庫(kù)名
[root@localhost ~]# mysqlhotcopy t_girl t_girl_new

Locked 4 tables in 0 seconds.
Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`id`, `t_girl`.`parent`) in 0 seconds.
Copying 22 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 4 tables (22 files) in 5 seconds (5 seconds overall).
2)、mysqlhotcopy 原數(shù)據(jù)庫(kù)名,備份的目錄
[root@localhost ~]# mysqlhotcopy t_girl /tmp/

Locked 4 tables in 0 seconds.
Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`id`, `t_girl`.`parent`) in 0 seconds.
Copying 22 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 4 tables (22 files) in 6 seconds (6 seconds overall).
3)、對(duì)單個(gè)表支持正則表達(dá)式
(除了id 表外)
[root@localhost data]# mysqlhotcopy t_girl./~id/ 

Using copy suffix '_copy'
Locked 3 tables in 0 seconds.
Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`parent`) in 0 seconds.
Copying 19 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 3 tables (19 files) in 6 seconds (6 seconds overall).
[root@localhost data]


4)、可以把記錄寫(xiě)到專門的表中。具體察看幫助。
perldoc mysqlhostcopy

mysql> create database hotcopy;
Query OK, 1 row affected (0.03 sec)
mysql> use hotcopy
Database changed
mysql> create table checkpoint(time_stamp timestamp not null,src varchar(32),dest varchar(60), msg varchar(255));
Query OK, 0 rows affected (0.01 sec)
同時(shí)記得給hotcopyer用戶權(quán)限。
mysql> grant insert on hotcopy.checkpoint to hotcopyer@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye
重復(fù)第三步的操作

[root@localhost ~]# mysqlhotcopy t_girl./~id/ --allowold --checkpoint hotcopy.checkpoint

Using copy suffix '_copy'
Existing hotcopy directory renamed to '/usr/local/mysql/data/t_girl_copy_old'
Locked 3 tables in 0 seconds.
Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`parent`) in 0 seconds.
Copying 19 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 3 tables (19 files) in 12 seconds (13 seconds overall).


默認(rèn)保存在數(shù)據(jù)目錄下/t_girl_copy/
看看記錄表。
mysql> use hotcopy; 
Database changed
mysql> select * from checkpoint;
+---------------------+--------+-----------------------------------+-----------+
| time_stamp | src | dest | msg |
+---------------------+--------+-----------------------------------+-----------+
| 2008-03-11 14:44:58 | t_girl | /usr/local/mysql/data/t_girl_copy | Succeeded | 
+---------------------+--------+-----------------------------------+-----------+
1 row in set (0.00 sec)

5)、支持增量備份。
[root@localhost ~]# mysqlhotcopy t_girl./~id/ --allowold --checkpoint hotcopy.checkpoint --addtodest t_girl_new

Locked 3 tables in 0 seconds.
Flushed tables (`t_girl`.`category`, `t_girl`.`category_part`, `t_girl`.`parent`) in 0 seconds.
Copying 19 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 3 tables (19 files) in 7 seconds (7 seconds overall).
6)、其它的等待測(cè)試過(guò)了再發(fā)布。。。

原文地址:
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP