티스토리 뷰
Master server
$ mysql -uroot -p
mysql> GRANT REPLICATION SLAVE ON *.* to 'repl'@'172.%' IDENTIFIED BY 'repl-password-here';
mysql> flush tables with read lock;
mysql> reset master;
# Make note of the file name and file position
mysql> show master status;
$ /etc/init.d/mysql stop
$ xfs_freeze -f /mnt/mysql
# Take AWS EC2 EBS snapshot and when it begins do next step
$ xfs_freeze -u /mnt/mysql
$ /etc/init.d/mysql start
$ mysql -uroot -p
mysql> unlock tables;
Wait for WAS to finish writing the EBS snapshot before proceeding.
Slave server
- EBS snapshot is complete
- create a new volume from snapshot
- umount old volume
- umount /data
- Detach "/data" volume
- Attach new "/data" volume
- mount /data
- lsblk
- sudo dd if=/dev/xvdX of=/dev/null bs=1M
- syncing to the master
$ /etc/init.d/mysql start
$ mysql -uroot -p
mysql> CHANGE MASTER TO
MASTER_HOST='172.x.x.x',
MASTER_USER='repl',
MASTER_PASSWORD='repl-password-here',
MASTER_LOG_FILE = 'mysql-bin.000001',
MASTER_LOG_POS = 107;
mysql> start slave;
mysql> show slave status \G
Reference
- https://jrklein.com/2017/03/22/mysql-master-slave-replication-on-aws-ec2-ebs/
- https://www.tecmint.com/mariadb-master-slave-replication-on-centos-rhel-debian/
'SQL > MySql' 카테고리의 다른 글
mysql dump 백업 파일 한글 깨짐 대응 (4) | 2018.09.02 |
---|---|
Mysql CPU 100 상회시 분석 (0) | 2016.07.03 |
mysql federated engine 사용 테이블 select 쿼리 out of memory 발생 이슈 (0) | 2016.05.12 |
Mysql 스키마 보기 쿼리 (0) | 2008.12.22 |
- Total
- Today
- Yesterday
- nginx
- Prototype
- classic asp
- centos
- Linux
- IOS
- Mac
- Android
- Wordpress
- 한글
- IE
- iphone
- laravel
- javascript
- sencha touch
- iis
- git
- 안드로이드
- API
- PHP
- mssql
- Debug
- nodejs
- CSS
- JQuery
- Docker
- macos
- 워드프레스
- ASP
- JSON
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |