컴퓨터 / Computer

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

Sha_bler 0 648 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

펜텔 에너겔 슬림 단색볼펜 0.5mm 리필심 12개입
칠성상회
차량용 가방걸이 자동차 후크 홀더 2P구성
칠성상회
차량용 먼지 브러시
칠성상회
코텍 자동차 휴즈 전원 단자 차량 전기 퓨즈 세트
칠성상회