Difference between revisions of "ProxMox: Backup - Restore - Live Migration"

From OnnoWiki
Jump to navigation Jump to search
Line 12: Line 12:
  
 
VZDump menyimpan backup di disk dalam satu file. File ini yang selanjutnya masuk ke backup tape untuk di arsipkan.
 
VZDump menyimpan backup di disk dalam satu file. File ini yang selanjutnya masuk ke backup tape untuk di arsipkan.
 
Detail tentang OpenVZ commandline dapat dilihat di [http://wiki.openvz.org/Backup_of_a_running_container_with_vzdump Backup of a running container with vzdump]
 
  
 
Ada baiknya membaca halaman manual:
 
Ada baiknya membaca halaman manual:
 
<pre>man vzdump</pre>
 
<pre>man vzdump</pre>
 +
 +
<pre>
 +
vzdump OPTIONS [--all | <VMID>]
 +
      --exclude VMID          exclude VMID (assumes --all)
 +
      --exclude-path REGEX    exclude certain files/directories. You
 +
                              can use this option more than once to specify
 +
                              multiple exclude paths
 +
      --stdexcludes          exclude temporary files and logs
 +
      --compress              compress dump file (gzip)
 +
      --storage STORAGE_ID    store resulting files to STORAGE_ID (PVE only)
 +
      --script                execute hook script
 +
      --dumpdir DIR          store resulting files in DIR
 +
      --maxfiles N            maximal number of backup files per VM.
 +
      --tmpdir DIR            store temporary files in DIR. --suspend and --stop
 +
                              are using this directory to store a copy of the VM.
 +
      --mailto EMAIL          send notification mail to EMAIL. You can use
 +
                              this option more than once to specify multiple
 +
                              receivers
 +
      --stop                  stop/start VM if running
 +
      --suspend              suspend/resume VM when running
 +
      --snapshot              use LVM snapshot when running
 +
      --size MB              LVM snapshot size (default 1024)
 +
      --bwlimit KBPS          limit I/O bandwidth; KBytes per second
 +
      --lockwait MINUTES      maximal time to wait for the global
 +
                              lock. vzdump uses a global lock file to make
 +
                              sure that only one instance is running
 +
                              (running several instance puts too much load
 +
                              on a server). Default is 180 (3 hours).
 +
      --stopwait MINUTES      maximal time to wait until a VM is stopped.
 +
</pre>
 +
 +
== Contoh ==
 +
 +
=== Backup ===
 +
 +
Simply dump CT 777 — no snapshot, just archive the container private area and configuration files to the default dump directory (usually <code>/vz/dump/</code>).
 +
 +
vzdump 777
 +
 +
Use rsync and suspend/resume to create a snapshot (minimal downtime).
 +
 +
vzdump --suspend 777
 +
 +
Backup all containers and send notification mails to root.
 +
 +
vzdump --suspend --all --mailto root
 +
 +
Use LVM2 to create snapshots (no downtime).
 +
 +
vzdump --dumpdir /space/backup --snapshot 777
 +
 +
Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as described  [http://weblogs.amtex.nl/index.php?blog=2&title=using_vzdump_snapshot_to_backup_without_downtime&more=1&c=1&tb=1&pb=1 here].
 +
 +
=== Restore ===
 +
 +
Restore the above backup to CT 600:
 +
 +
vzrestore /space/backup/vzdump-777.tar 600
 +
 +
OR
 +
 +
vzdump --restore /space/backup/vzdump-777.tar 600
 +
 +
Note : vzdump --restore is not present in version 1.2-7, use vzrestore instead.
  
 
=Interface Web=
 
=Interface Web=

Revision as of 10:24, 2 July 2011

Backup adalah salah satu fitur yang penting yang ada di Proxmox VE.

Backup menggunakan VZDump

VZDump adalah tool yang dapat digunakan untuk membuat snapshot dari Virtual Machine (OpenVZ dan KVM) yang sedang berjalan. VZDump pada dasarnya membuat arsip tar dari folder private di Virtual Machine, yang tentunya termasuk file konfigurasi.

Ada beberapa cara untuk memperoleh konsistensi backup:

  • stop: Stop VE saat backup (downtime yang sangat lama)
  • suspend: Menggunakan suspend/resume (minimal downtime dengan OpenVZ, downtime lama dengan KVM VM)
  • snapshot: Menggunakan LVM2 (tidak ada downtime, online)

VZDump menyimpan backup di disk dalam satu file. File ini yang selanjutnya masuk ke backup tape untuk di arsipkan.

Ada baiknya membaca halaman manual:

man vzdump
vzdump OPTIONS [--all | <VMID>]
       --exclude VMID          exclude VMID (assumes --all)
       --exclude-path REGEX    exclude certain files/directories. You
                               can use this option more than once to specify
                               multiple exclude paths
       --stdexcludes           exclude temporary files and logs
       --compress              compress dump file (gzip)
       --storage STORAGE_ID    store resulting files to STORAGE_ID (PVE only)
       --script                execute hook script
       --dumpdir DIR           store resulting files in DIR
       --maxfiles N            maximal number of backup files per VM.
       --tmpdir DIR            store temporary files in DIR. --suspend and --stop
                               are using this directory to store a copy of the VM.
       --mailto EMAIL          send notification mail to EMAIL. You can use
                               this option more than once to specify multiple
                               receivers
       --stop                  stop/start VM if running
       --suspend               suspend/resume VM when running
       --snapshot              use LVM snapshot when running
       --size MB               LVM snapshot size (default 1024)
       --bwlimit KBPS          limit I/O bandwidth; KBytes per second
       --lockwait MINUTES      maximal time to wait for the global
                               lock. vzdump uses a global lock file to make
                               sure that only one instance is running
                               (running several instance puts too much load
                               on a server). Default is 180 (3 hours).
       --stopwait MINUTES      maximal time to wait until a VM is stopped.

Contoh

Backup

Simply dump CT 777 — no snapshot, just archive the container private area and configuration files to the default dump directory (usually /vz/dump/).

vzdump 777

Use rsync and suspend/resume to create a snapshot (minimal downtime).

vzdump --suspend 777

Backup all containers and send notification mails to root.

vzdump --suspend --all --mailto root

Use LVM2 to create snapshots (no downtime).

vzdump --dumpdir /space/backup --snapshot 777

Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as described here.

Restore

Restore the above backup to CT 600:

vzrestore /space/backup/vzdump-777.tar 600

OR

vzdump --restore /space/backup/vzdump-777.tar 600

Note : vzdump --restore is not present in version 1.2-7, use vzrestore instead.

Interface Web

Proxmox VE menyediakan interface web untuk mendefinisikan backup job. Langkah pertama adalah men-definiskan backup storage. Kebanyakan kita menggunakan NFS share di NAS/SAN. Pilih 'VZDump Backups' konfigurasi storage. Lihat juga Storage Model

Define a backup storage

Selanjutnya, kita dapat mendefinisikan backup job menggunakan storage tersebut.

Define new backup job

Konfigurasi yang di hasilkan di simpan sebagai cron job di '/etc/cron.d/vzdump'. File ini di sinkronkan ke semua node cluster.


Restore menggunakan vzrestore dan qmrestore

Untuk me-restore Virtual Machine, copy file tar ke host yang akan di restore. Tergantung pada tipe virtual machine, menggunakan 'vzrestore' untuk merestore OpenVZ container, atau 'qmrestore' untuk restore mesin KVM.


Contoh 1: Restore backup KVM VM 555 (backup file: vzdump-qemu-555.tar) ke CT 500

qmrestore vzdump-qemu-555.tar 500


Contoh 2: Restore backup OpenVZ container CT 777 (backup file: vzdump-openvz-777.tar) ke CT 600

vzrestore vzdump-openvz-777.tar 600


Contoh 3: Restore backup KVM VM 555 (backup file: vzdump-qemu-555.tgz) ke CT 500 di storage dengan nama raid1data

qmrestore --storage raid1data vzdump-qemu-555.tgz 500


Live Migration

Proxmox VE mendukung live migration dari Virtual Machine melalui interface web. Untuk memigrasi satu mesin fisik ke mesin yang lain, kita minimal membutuhkan dua Proxmox VE server, lihat Proxmox_VE_Cluster.

Referensi

Pranala Menarik