Backup procedure
To back up your Helix server installation, perform the following steps as part of your nightly backup procedure.
-
Make a checkpoint by invoking
p4d
with the-jc
(journal-create) flag, or by using the p4 admin command. Use one of the following:On the host, where you might have a script that runs daily and also manages checkpoint files:
$ p4d -jc
or, on the client that is physically separate from the host:
$ p4 admin checkpoint
Because
p4d
locks the entire database when making the checkpoint, you do not generally have to stop the Perforce service during any part of the backup procedure.NoteIf your site is very large (gigabytes of
db.*
files), creating a checkpoint might take a considerable length of time.Under such circumstances, you might want to defer checkpoint creation and journal truncation until times of low system activity. You might, for instance, archive only the
journal
file in your nightly backup, and only create checkpoints and roll the journal file on a weekly basis. -
Ensure that the checkpoint has been created successfully before backing up any files. If a disk crash occurs, it is important to know that the checkpoints you’ve been backing up are complete.
Verifying either of the following:
- p4d -jc
(or
p4 admin checkpoint
) returns the value of0
- the current journal file is truncated
You can also use the command
p4d -jv
to verify the integrity of a checkpoint. - p4d -jc
(or
-
Confirm that the checkpoint was correctly written to disk by comparing the MD5 checksum of the checkpoint with the
.md5
file created by the checkpoint process.The checksum in the
.md5
file corresponds to the checksum of the file as it existed before any compression was applied, and assumes UNIX-style line endings even if the service is hosted on Windows.If your checkpoint file was created with the
-z
compression option, you might need to decompress it and account for line ending differences. On Windows, after decompressing a checkpoint, Windows line endings must be re-added before calculating the.md5
sum. -
Once the checkpoint has been created successfully, back up:
- the checkpoint file and its
.md5
file - the rotated journal
file. If the checkpoint is
n
, the rotated journal isjournal.n-1
. See also Journal files. - the license file
- the versioned files
TipOPTIONAL for backup:
- log files
- readonly clients - see Using read-only and partitioned clients in automated builds
There is no use case for backing up the following:
- db.* files
- server.locks directory
NoteThere are rare instances (for instance, users obliterating files during backup, or submitting files on Windows servers during the file backup portion of the process) in which your versioned file tree can change during the interval between the time the checkpoint was taken and the time at which the versioned files are backed up by the backup utility.
Most sites are unaffected by these issues. Having Helix server available on a 24/7 basis is generally a benefit worth this minor risk, especially if backups are being performed at times of low system activity.
If, however, the reliability of every backup is of paramount importance, consider stopping the Perforce service before checkpointing, and restart it only after the backup process has completed.
NoteOn Windows, if you make your system backup while the Perforce service is running, you must ensure that your backup program doesn’t attempt to back up the
db.*
files.If you try to back up the
db.*
files with a running server, Windows locks them while the backup program backs them up. During this brief period, Helix server is unable to access the files. Therefore, if a user attempts to perform an operation that would update the file, the server can fail.If your backup software doesn’t allow you to exclude the
db.*
files from the backup process, stop the server withp4 admin stop
before backing up, and restart the service after the backup process is complete. - the checkpoint file and its
- If you have used the
p4 serverid
command to identify your server with aserver.id
file, theserver.id
file, which is in the server’s root directory, must be backed up.
We recommend that administrators perform
weekly, rather than nightly. For large installations, the verification of files:p4 verify
- takes considerable time to run
- puts the server under heavy load, which can impact the performance of other Helix server commands
The command is:
$ p4 verify //...
or
$ p4 verify -q //...
The -q (quiet) option produces output only if errors are detected.
By running p4 verify, you confirm whether the archive data on the server is correct. Regular use of p4 verify is good practice because it enables you to:
- locate any corruption
- determine whether or not the files restored from your backups following a crash are in good condition
For more about the p4 verify command, see Verifying files by signature.
The instructions on this page are basic. If you organization has a large data set, see the reference implementation that features zero-downtime checkpoints, near-zero downtime upgrades, and more: the Server Deployment Package (SDP) at https://swarm.workshop.perforce.com/projects/perforce-software-sdp/.
Your search for returned result(s).