컴퓨터 / Computer

한 서버에서 다른 서버로 서비스 옮기기

Sha_bler 0 644 2025.08.05 15:21

0_fivEmSUN_cafc0046fceae53820e6e11ed19a3a0d3034ec3c.jpg 



서비스를 운영하다보면 짧은 시간에 이쪽에서 저쪽으로 옮겨야 할 때가 있다. 그럴 경우 도움이 되라고 아래와 같이 경험을 적어 본다.


일단 옮기기 전에 계획은 아래와 같다.


이전 대상 서버를 "이쪽"이라고 하고 새 서버를 "저쪽"이라고 하자. 


 

1) 1차 rsync 로 이쪽에서 저쪽으로 자료 이전

2) httpd.conf / varnish.conf / letsencrypt 설정 자료 이전

3) 2차 rsync 로 동기화

  (예상) rsync -avz --progress --delete /home/mysql/data/mysql/ 아이디@저쪽:/home/checkbox/mysql/$week

-> (실제) rsync -avz --progress --delete /home/폴더/ 아이디@저쪽:/home/폴더

4) DNS 설정 변경

5) httpd.conf 

- 이쪽 : disable

- 저쪽 : enable




아래는 실제 이전 과정이다.





 

  - 저쪽  

1. httpd conf 수정 : # 해제 

2. apachectl configtest 로 결과 확인 ( 이때 SSLCertificateFile이 없다고 나옴. letsencrypt에서 추후 수정하면 됨)

3. varnish default.vcl 수정:  아래 추가

4. letsencrypt conf 파일을 renewal 폴더에 복사 

5. /etc/letsencrypt/live 및 archive 복사 

7. db에서 해당 ip 접근 권한 부여 : 

create user 아이디@'저쪽서버' identified by '비밀번호';

grant all on DB.* to 아이디@'저쪽서버' with grant option;

flush privileges;

8. dns 설정 변경

9. httpd varnish  재실행 systemctl restart httpd.service && systemctl restart varnish.service && top

10. letsencrypt renewal test : certbot renew -q --post-hook 'systemctl reload httpd'

  - 이쪽 서버 

      6. rsync -avz --progress --delete /home/폴더/ 아이디@저쪽서버:/home/폴더/

      11. varnish defaul.vcl 수정

12. letsencrypt conf 파일 리뉴얼 

          httpd.conf 수정

          httpd varnish  재실행 systemctl restart httpd.service && systemctl restart varnish.service && top


Comments

A4클립보드 흑색 기본형 카파맥스
바이플러스
WL 핑구스티커 펭귄 핑구 핑가 다꾸 스티커 다이어리 노트북 핸드폰 꾸미기 스티커 다꾸 용품
칠성상회
스테들러 피그먼트라이너 흑색 수성펜 6본세트
칠성상회
WL 계기판 차량용 거치대 B형 스마트폰 차량 스파크
칠성상회