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

Booraltak   
   조회 4125   추천 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 2594/5724
2014-05   5238711   정은준1
2015-12   1764151   백메가
2015-12   3966   아이트리
2015-12   3699   초보IT
2015-12   4561   푸하히
2015-12   5844   태지여
2015-12   5694   미수맨
2015-12   4409   바부팅이
2015-12   5031   푸하히
2015-12   4077   바부팅이
2015-12   3440   김건우
2015-12   7741   검은블랙
2015-12   4592   카프카
2015-12   13629   이병한
2015-12   4124   박상범
2015-12   6567   방o효o문
2015-12   3862   Jjam
2015-12   3807   너의남자
2015-12   3926   나우마크
2015-12   3978   esca
2015-12   4121   monan
2015-12   5280   최원시익