Difference between revisions of "ProxMox: Backup - Restore - Live Migration"
Onnowpurbo (talk | contribs) (New page: =Introduction= Backup is one of the most important integrated features of Proxmox VE. =Backup with VZDump= VZDump is an utility to make consistent snapshots of running Virtual Machines (Op...) |
Onnowpurbo (talk | contribs) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | Backup adalah salah satu fitur yang penting yang ada di Proxmox VE. | |
− | Backup | ||
− | |||
− | |||
− | + | =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: | ||
<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 === | ||
+ | |||
+ | Dump sederhana CT 777 — tidak ada snapshot, hanya arsip wilayah private & file konfigurasi container ke default dump directory (biasanya <code>/vz/dump/</code>). | ||
+ | |||
+ | vzdump 777 | ||
+ | |||
+ | Gunakan rsync dan suspend/resume untuk membuat snapshot (minimal downtime). | ||
+ | |||
+ | vzdump --suspend 777 | ||
+ | |||
+ | Backup semua container dan kirim notifikasi mail ke root. | ||
+ | |||
+ | vzdump --suspend --all --mailto root | ||
+ | |||
+ | Gunakan LVM2 untuk membuat snapshots (tidak ada downtime). | ||
+ | |||
+ | vzdump --dumpdir /space/backup --snapshot 777 | ||
+ | |||
+ | Perhatikan bahwa menggunakan LVM2 dan vzdump untuk membuat snapshot membutuhkan 512Mb free space di VG seperti di jelaskan [http://weblogs.amtex.nl/index.php?blog=2&title=using_vzdump_snapshot_to_backup_without_downtime&more=1&c=1&tb=1&pb=1 sini]. | ||
+ | |||
+ | === Restore === | ||
+ | |||
+ | Restore backup di atas ke CT 600: | ||
+ | |||
+ | vzrestore /space/backup/vzdump-777.tar 600 | ||
+ | |||
+ | atau | ||
− | Proxmox VE | + | vzdump --restore /space/backup/vzdump-777.tar 600 |
+ | |||
+ | =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]] | ||
[[Image:Screen-define-backup-storage.png||Define a backup storage]] | [[Image:Screen-define-backup-storage.png||Define a backup storage]] | ||
− | + | Selanjutnya, kita dapat mendefinisikan backup job menggunakan storage tersebut. | |
[[Image:Screen-define-backup-job.png||Define new backup job]] | [[Image:Screen-define-backup-job.png||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 | ||
<pre>qmrestore vzdump-qemu-555.tar 500</pre> | <pre>qmrestore vzdump-qemu-555.tar 500</pre> | ||
− | + | Contoh 2: Restore backup OpenVZ container CT 777 (backup file: vzdump-openvz-777.tar) ke CT 600 | |
<pre>vzrestore vzdump-openvz-777.tar 600</pre> | <pre>vzrestore vzdump-openvz-777.tar 600</pre> | ||
− | + | ||
+ | Contoh 3: Restore backup KVM VM 555 (backup file: vzdump-qemu-555.tgz) ke CT 500 di storage dengan nama raid1data | ||
<pre>qmrestore --storage raid1data vzdump-qemu-555.tgz 500</pre> | <pre>qmrestore --storage raid1data vzdump-qemu-555.tgz 500</pre> | ||
+ | |||
=Live Migration= | =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 tentang [[ProxMox: Membuat Cluster | Membuat Cluster di Proxmox]] |
+ | |||
+ | ==Referensi== | ||
+ | |||
+ | * http://pve.proxmox.com/wiki/Backup_-_Restore_-_Live_Migration | ||
+ | * vavai.com/2011/08/10/backup-data-virtual-machine-pada-proxmox-virtual-environment-proxmox-ve/ | ||
+ | |||
+ | ==Pranala Menarik== | ||
+ | |||
+ | * [[Cloud]] | ||
+ | * [[Proxmox]] |
Latest revision as of 05:02, 30 January 2012
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
Dump sederhana CT 777 — tidak ada snapshot, hanya arsip wilayah private & file konfigurasi container ke default dump directory (biasanya /vz/dump/
).
vzdump 777
Gunakan rsync dan suspend/resume untuk membuat snapshot (minimal downtime).
vzdump --suspend 777
Backup semua container dan kirim notifikasi mail ke root.
vzdump --suspend --all --mailto root
Gunakan LVM2 untuk membuat snapshots (tidak ada downtime).
vzdump --dumpdir /space/backup --snapshot 777
Perhatikan bahwa menggunakan LVM2 dan vzdump untuk membuat snapshot membutuhkan 512Mb free space di VG seperti di jelaskan sini.
Restore
Restore backup di atas ke CT 600:
vzrestore /space/backup/vzdump-777.tar 600
atau
vzdump --restore /space/backup/vzdump-777.tar 600
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
Selanjutnya, kita dapat mendefinisikan backup job menggunakan storage tersebut.
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 tentang Membuat Cluster di Proxmox
Referensi
- http://pve.proxmox.com/wiki/Backup_-_Restore_-_Live_Migration
- vavai.com/2011/08/10/backup-data-virtual-machine-pada-proxmox-virtual-environment-proxmox-ve/