DB 파일 백업에 관한 질문입니다.

Booraltak   
   조회 4048   추천 0    

메인 서버가 뻗을 상황을 대비해 백업 서버를 구성을 해두려 합니다. 메인 서버가 부하가 좀 있는 편이고 잘 뻗을 일은 없기에 레플리케이션까지는 고려 안하고 있습니다. 

우선 A서버가 메인이고 B가 백업용입니다. 그리고 A서버와 B서버는 rsync로 15분마다 동기화 되고 매일 밤마다 백업은 따로 실시합니다. (여기선 mysqldump를 씁니다.)

 

작동 중인 A서버에서 mysql DB파일을 그대로 rsync로 B 서버에 덮어쓰면 문제가 생기려나요? 하드웨어는 다르지만 mysql버전과 사용자 id, 비번은 같습니다. 

짧은글 일수록 신중하게.
박문형 2015-12
메인서버가 뻗으면 백업서버가 돌아가나요??

강제적으로 메인서버를 죽이고 백업서버를 돌렸을때 잘 돌아간다면 문제 없지만

백업서버가 재대로 안돌아간다면 백업을 한 의미는 화일카피밖에 안될 것입니다.
오프라인 2015-12
Making Backups by Copying Table Files

For storage engines that represent each table using its own files, tables can be backed up by copying those files.
For example, MyISAM tables are stored as files, so it is easy to do a backup by copying files (*.frm, *.MYD, and *.MYI files).
To get a consistent backup, stop the server or lock and flush the relevant tables:

FLUSH TABLES tbl_list WITH READ LOCK;

You need only a read lock; this enables other clients to continue to query the tables while you are making a copy of the files
in the database directory. The flush is needed to ensure that the all active index pages are written to disk before you start the backup.
See Section 13.3.5, “LOCK TABLES and UNLOCK TABLES Syntax”, and Section 13.7.6.3, “FLUSH Syntax”.

You can also create a binary backup simply by copying all table files, as long as the server isn't updating anything.
(But note that table file copying methods do not work if your database contains InnoDB tables.
Also, even if the server is not actively updating data, InnoDB may still have modified data cached in memory and not flushed to disk.)

요약해보면 DB파일을 복사하려면 서버가 업데이트되지 않아야 하고, InnoDB는 그러한 경우에도 flush가 안되서 동작을 하지 않는다... 죠
회원K 2015-12
안됩니다. 그렇게 하려면 rsync를 하면 안되고 percona 와 같은 툴을 써야 합니다.
그래나다 2015-12
아.... InnoDB쓰는데 레플리케이션도 심각하게 고려를 해 보아야 할 거 같습니다....


QnA
제목Page 1665/5709
2014-05   5147537   정은준1
2015-12   1682144   백메가
2018-02   4023   책갈량
2016-02   4023   디비디
2020-07   4023   tpp52
2018-01   4023   강민준1
2015-09   4023   푸하히
2017-10   4024   로맨리카
2018-05   4024   Won낙연
2015-06   4024   박종대
2022-08   4024   리카라바
2017-04   4024   초코송이
2019-02   4024   머리감자
2018-04   4024   김주현
2017-04   4024   무아
2016-10   4024   가람이당1
2015-09   4024   무아
2014-04   4024   Carolus
2017-06   4024   Super64
2015-06   4024   김효수
2017-07   4024   으라차차차
2015-02   4024   명성호