E D R , A S I H C RSS

Server Backup

2008-11-02 λΆ€ν„° μ§„ν–‰ν•˜λŠ” ZeroPage μ„œλ²„ 데이터 원격지 λ°±μ—… 슀크립트 κ΄€λ ¨ λ‚΄μš©.

Pre Process

사전 곡뢀

Process

  1. screen κ³΅μœ λΌ μœ„ν•œ μ„œλ²„ μ„ΈνŒ…
    • (./) http://www.pixelbeat.org/docs/screen/
    • (./) sudo κΆŒν•œ μ„μ •
      • /etc/group 에 admin 그룹에 μ›ν•˜λŠ” μ‚¬μš©μž μΆ”κ°€, /etc/sudoersμ—μ„œ μ‚¬μš©μž 제거


  2. μ–Έμ–΄ 선택
    • (./) Python
  3. ν•΄λ‹Ή μ–Έμ–΄λ‘œ ftp접속
    • http://docs.python.org/library/ftplib.html
    • (./) μž‘μ€ 파일 ν•˜λ‚˜λΌ zeropage@neocoin.net 으둜 μ˜¬λ¦°λ‹€.

      #!/usr/bin/env python
      
      
      def uploadFile(filename):
          import ftplib
          s = ftplib.FTP('servername')
          s.login('server',password) # Connect
          f = open(filename,'rb')                # file to send
          s.storbinary('STOR %s'%filename, f)         # Send the file
          f.close()                                # Close file and FTP
          s.quit()
      
      uploadFile('index.html')
      
      
  4. λ°±μ—… 슀크립트 μž‘μ„±
    • backup target μ„μ •
      • mysql
        /usr/bin/mysqldump -u <username> -p <password> <databasename> | gzip > /path/to/backup/db/zeropage_`date +%y_%m_%d`.gz
        
    • (./) μ••μΆ• ~ μœ„ μŠ€ν¬λ¦½νŠΈμ—μ„œ ν•œκΊΌλ²ˆμ— μˆ˜ν–‰
    • μž„μ‹œ μ €μž₯μ†Œμ— 볡사 ~
      {{{/var/backup}} 정도 μœ„μΉ˜
        * μ„œλ²„ ν‚€λΌ μ“°μ§€ μ•Šμ€ μ΅œμ†Œμ˜ μ•”ν˜Έν™”
         {{{
      gpg --passphrase #{PASSWORD} --no-use-agent -c file
      }}}
         * λ³΅ν˜Έν™” 
          {{{
      gpg file
      }}}
       1. 전솑 ν…ŒμŠ€νŠΈ
       1. λ°±μ—… μ •μ±… κ²°μ • 
        * μ£ΌκΈ°, μ‹œκ°
       1. cron test
        * http://en.wikipedia.org/wiki/Cron 예제
         {{{
      11 5 * * *   /root/backupToNeocoin.py >> /var/log/backupToNeocoin.log 2>&1
      }}}
       1. 적용
      
      === Problem ===
       * 문제 ~ DNS Server κ°€ μ£½μ—ˆμŒ (or 잘λͺ» μ„μ •λ˜μ–΄ 있음 165.194.35.222 μ„œλ²„ 확인 ν•„μš”) κ·Έλž˜μ„œ μ£Όμ†Œ 기반으둜 μ™ΈλΆ€λ‘œ ping을 λ‚ λ¦΄μˆ˜ μ—†λ‹€.
        * ν•΄κ²° ~ {{{/etc/resolv.conf}}} 에 무료 dns μ„œλ²„ 등둝 ν›„ ꡐ내 μ„œλ²„λŠ” κ°€μž₯ λ§ˆμ§€λ§‰ μˆœμœ„λ‘œ λ³€κ²½ http://theos.in/windows-xp/free-fast-public-dns-server-list/
      
       * 문제 ~  sudo κ°€ μ•ˆλ¨ 
        * ν•΄κ²° ~ admin 그룹에 μ›ν•˜λŠ” μ‚¬μš©μž μΆ”κ°€ 
      === Post Process ===
       1. λͺ¨λ‹ˆν„°λ§
      
      === μ•žμœΌλ‘œ 할일 ===
       1. 
      ----
      [λΆ„λ₯˜]
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:01
Processing time 0.0118 sec