복구를 못한는걸 용서할수 있어도
백업이 되어 있지 않는건 절대로 용서할수 없다.
백업을 하는 방법과 복구를 하는 방법을 알아보자
요새는 MySQL에서 제공하는 백업툴이 있기 때문에
굉장히 백업을 하는데 용이하다
ㅁ mysqldump 를 이용한 백업 및 복구 방법
1. full dump 백업 [master]
<session 1>
mysql> flush tables with read lock;
mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000009
Position: 99
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
<session 2>
shell> mysqldump -uroot -p --all-databases > all_db_master.sql
<session 1>
mysql> unlock tables;
2. file 전송 [master]
scp -P all_db_master.sql 192.168.1.99:/DBDATA/
3. dump 파일을 이용한 복구 [standby]
mysql> stop slave;
mysql> reset slave;
root> mysql -uroot -p < all_db_master.sql
4. replication 연결 [standby]
mysql> change master to
master_host='192.168.1.99',
master_user='repl',
master_password='test00',
master_port=3307,
master_log_file='mysql-bin.000009',
master_log_pos=9;
mysql> start slave;
복mysql> show slave staus\G