Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

ServerBackup: Difference between revisions

From ZeroWiki
imported>neocoin
No edit summary
imported>neocoin
No edit summary
Line 11: Line 11:
** http://docs.python.org/library/ftplib.html
** http://docs.python.org/library/ftplib.html
** (./) 작은 파일 하나를 zeropage@neocoin.net 으로 올린다.  
** (./) 작은 파일 하나를 zeropage@neocoin.net 으로 올린다.  
#!/usr/bin/python
def uploadFile(filename):
    import ftplib
    s = ftplib.FTP('neocoin.net')
    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')
# 백업 스크립트 작성
# 백업 스크립트 작성
** backup target 설정
** backup target 설정

Revision as of 06:28, 3 November 2008

Pre Process

사전 공부

Process

  1. screen 공유를 위한 서버 세팅
  1. 언어 선택
    • (./) Python
  1. 해당 언어로 ftp접속
#!/usr/bin/python


def uploadFile(filename):
    import ftplib
    s = ftplib.FTP('neocoin.net')
    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')
  1. 백업 스크립트 작성
    • backup target 설정
    • mysql
/usr/bin/mysqldump -u <username> -p <password> <databasename> | gzip > /path/to/backup/db/zeropage_`date +%y_%m_%d`.gz
    • 복사
    • 압축
    • 암호화
  1. 전송 테스트
  2. 백업 정책 결정
    • 주기, 시각
  1. cron test
11 5 * * *   /root/backupToNeocoin.py >> /var/log/backupToNeocoin.log 2>&1
  1. 적용


Post Process

  1. 모니터링

앞으로 할일


분류