]> git.proxmox.com Git - pve-docs.git/blob - pvesr.adoc
9acb8aeace875cd2c8850d9458e20a5f6f40118f
[pve-docs.git] / pvesr.adoc
1 ifdef::manvolnum[]
2 pvesr(1)
3 ========
4 :pve-toplevel:
5
6 NAME
7 ----
8
9 pvesr - Proxmox VE Storage Replication
10
11 SYNOPSIS
12 --------
13
14 include::pvesr.1-synopsis.adoc[]
15
16 DESCRIPTION
17 -----------
18 endif::manvolnum[]
19
20 ifndef::manvolnum[]
21 Storage Replication
22 ===================
23 :pve-toplevel:
24 endif::manvolnum[]
25
26 The {PVE} storage replication tool (`pvesr`) manage the Proxmox VE Storage Based Replication.
27 Storage Replication bring guest redundancy for local storage's,
28 reduce the migration time and will only replicate new data.
29
30 It will replicate the vdisk of guest to an other node this make that data available
31 without using shared/distributed storage. So in case of a node failure your guest data still available
32 on the replicated node.
33
34 The minimal replication interval are 1 minute and the maximal interval is once a week.
35 Interval schedule format is a subset of `systemd` calendar events.
36 Every interval time your guest vdisk data will be synchronized,
37 but only the new data will replicated. This reduce the amount of data to a minimum.
38 New data are data what are written to the vdisk after the last replication.
39
40 Every guest can replicate to many target nodes, but only one replication job per target node is allowed.
41
42 The migration of guests, where storage replication is activated, is currently only offline possible.
43 When the guest will migrate to the target of the replication, only the delta of the data must migrated and
44 the replication direction will switched automatically in the opposite direction.
45 If you migrate to a node where you do not replicate, it will send the whole vdisk data to the new node and after the migration it continuous the replication job as usually.
46
47 WARNING: High-Availability is possible with Storage Replication but this can lead to lose data. So be aware of this problem before you use this combination.
48
49 Supported Storage Types
50 -----------------------
51
52 .Storage Types
53 [width="100%",options="header"]
54 |============================================
55 |Description |PVE type |Snapshots|Stable
56 |ZFS (local) |zfspool |yes |yes
57 |============================================
58
59 Schedule
60 --------
61
62 Proxmox VE has a very flexible replication scheduler with will explained in detail here.
63
64 A schedule string has following format.
65
66 [day of the week] <time>
67
68 Day of the week are taken of sun, mon, tue, wed, thu, fri and sat.
69 It is allowed to make a list of this token.
70 Or alternative you can use a span.
71
72 The second part are the time, here the string contains two sub-string separate by `:`.
73 First comes the hours, than the minutes.
74 0..23 are the allowed values for hours and 0..59 for minutes.
75 If hours is missing it will substitute with `*`, this also counts for the day of the week.
76 The `*` will be interpreted as wildcard. In case of the "all day of the week" it would be sun..sat, for the hours 0..23 or for the minutes 0..59.
77
78 Examples:
79 ~~~~~~~~~
80
81 .Schedule Examples
82 [width="100%",options="header"]
83 |============================================
84 |String |Meaning
85 |"mon,tue,wed,thu,fri" => "mon..fir" |All working days at 0:00.
86 |"sat,sun" => "sat..sun" |Only on weekend at 0:00.
87 |"mon,wed,fri" |Only on Monday, Wednesday and Friday at 0:00.
88 |"12:05" => "sun..sat 12:05" |All weekdays at 12:05 PM.
89 |"*/5" |All five minutes on all weekdays.
90 |"mon..wed 30/10" |Monday, Tuesday, Wednesday at all hours and 30, 40, 50 minutes.
91 |"fri 12..13:5/20" |Friday at 12:05, 12:25, 12:45, 13:05, 13:25 and 13:45.
92 |"12/2:05" |All weekdays every 2 hours start at 12:05 until 22:05
93 |============================================
94 The simplest case is the `*` which means every min what is the minimum interval.
95
96
97 Error State
98 -----------
99
100 It can happen that a job will have a error.
101 Common issues for example:
102
103 Network is not working.
104
105 No space on the disk.
106 ...
107
108 In this case storage replication will retry every 30 miuntes.
109
110
111 Migrating a guest in case of Error
112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113
114 Assumed that you have two guests (KVM 100| LXC 200) running on node A (pve1) and replicate to node B (pve2).
115 Node A is fails and can not get back online. Now you have to migrate the guest to Node B manually.
116
117 Connect to node B with ssh.
118
119 - check if that the cluster has quorum.
120
121 pvecm status
122
123 Is quorum is ok continuing with the skip[ the next step.
124
125 - If you have no quorum, it is important to make your pmxcfs writable.
126
127 WARNING: If expected is set, please avoid large changes on the nodes before the cluster is quorate online because there is a little change to a split brain.
128
129 pvecm expected 1
130
131 - move the guest config form the origin node A to node B.
132 cd /etc/pve/node && mv pve1/qemu-server/100.conf pve2/qemu-server/100.conf
133 cd /etc/pve/node && mv pve1/lxc/200.conf pve2/lxc/100.conf
134
135 - Now you can start the guests.
136
137 qm start 100
138 pct start 100
139
140
141 Create Replication
142 ------------------
143
144 [thumbnail="gui-create-replica-on-node.png"]
145
146 You can easy create a replication job on the GUI or as well on the command line.
147 There are only a few setting to configure.
148
149 The only required parameter on the GUI is the target node.
150 If you create a job on the command line also a unique id is needed.
151 This id will automatically generated in case of GUI created jobs.
152 The id contains the VMID and a consecutive number separated by a minus.
153 All other parameters are optional.
154
155 Update Replication Job
156 ----------------------
157
158 For now is possible to update rate limit and the scheduler.
159 It can be done on the GUI or on the cli.
160
161
162 Using the Command Line Interface
163 --------------------------------
164
165 Examples
166 ~~~~~~~~
167
168 Create a replication job for VM 100 first job, which will run all 5 min with max bandwidth of 10MByte/s.
169
170 pvesr create-local-job 100-0 pve1 --schedule */5 --rate 10
171
172 Disable a running job for ID 100-0
173
174 pvesr disable 100-0
175
176 Enable a running job for ID 100-0
177
178 pvesr disable 100-0
179
180 Change the schedule interval to once a hour
181
182 pvesr update 100-0 --schedule '*/00'
183
184 ifdef::manvolnum[]
185 include::pve-copyright.adoc[]
186 endif::manvolnum[]