Helix Core Server (p4d) Reference
Start the Perforce service, perform checkpoint/journaling, or do certain system administration tasks.
Syntax
p4d [ options ]
p4d.exe [ options ]
p4s.exe [ options ]
p4d -j? [-z | -Z] [ args ... ]
p4d [-z] -R service -jr file
p4d [-z] [-R service | -P server-id] -jd file
p4d -Fm | Fs
Description
p4d [ options ] p4d.exe [ options ] p4s.exe [ options ] |
invoke the background process that manages the Helix Server versioning service |
p4d -j? [ -z | -Z ] [ args ... ] | for certain system administration tasks, including some that are related to checkpointing and journaling. See Checkpoint files. |
p4d -Fm | Fs | Failback options |
Rotating the journal means saving the existing journal and creating a new, empty journal for future transactions.
"Truncating" a journal refers to the new journal file starting out as an empty file.
On UNIX and macOS, the executable is p4d
.
On Windows, the executable is p4d.exe
(running as a
server) or p4s.exe
(running as a service).
These commands should be run during quiet periods
Run the following commands during production downtime or quiet periods. These commands lock tables and therefore might block user commands.
Option | Table locking behavior |
---|---|
-jd , -jc , -jcp |
All tables are locked while the command runs and are unlocked as it completes. |
-xu
|
Tables are locked and unlocked one at a time as preparation for the upgrade is done. |
-xv
|
Tables are locked and unlocked one at a time as they are being validated. |
-xx
|
Tables are locked and unlocked as they are being checked against each other. More than two tables might be locked. For example, the check for db.have against db.rev also locks db.revtx |
-xvU
|
Tables are locked and unlocked as they are being checked. |
Exit Status
After successful startup, p4d
does not normally
exit. It merely outputs the following startup message:
Perforce server starting...
and runs in the background.
On failed startup, p4d
returns a nonzero error
code.
Also, if invoked with any of the -j
checkpointing or
journaling options, p4d
exits with a nonzero error
code if any error occurs.
Options
This section includes the following types of options: Server options, General options, Checkpoint and journal options, Journal restore options, Replication and multi-server options, Journal dump and restore filtering, Certificate handling, Configuration options and Failback options.
Server options
Server option | Meaning |
---|---|
|
Run as a daemon (in the background). |
|
Run as a single-threaded (non-forking) process. |
|
Run from |
|
Run quietly (no startup messages). |
-n
|
Start the server in maintenance mode, which means that:
|
|
Write the PID of the server to a file named
The |
--daemonsafe
|
Is like |
|
Irreversibly reconfigure the Helix Core Server (and its metadata) to operate in Unicode mode. Do not use this option unless you know you require Unicode mode. For details, see the Release Notes and the Internationalization Notes. |
-xj |
Directly dump the db.ckphist table (see the schema of the Helix Core Server). This option is similar to the p4 journals command. The use case for
display checkpoint history records from
Note that the
Select only those records where the A The special |
|
Run database upgrades and quit.
|
|
Run low-level database validation and quit.
|
-xx [-q -o output] [table1 [table2]]
|
Check consistency between table pairs, producing a
Note
The Warning
Do not attempt to replay the |
|
Run fast verification. Does not lock database tables, and verifies
only that the unlock count for each table is zero. See also |
|
Display (or set) the server’s |
-xU CleanServerLocks | Safely cleans up the server locks directory, which can help avoid the possible issue of running out of inodes. (See also the Support Knowledgebase article about possible causes of the message No space left on device.) |
General options
General option | Meaning |
---|---|
|
Print help message. |
|
Print version number, and other information, such as which memory manager the server uses. |
|
Specify an audit log file. Overrides |
|
A server description displayed by the |
|
A server name for use with |
|
Specify a journal file. Overrides |
|
Specify a log file. Overrides |
|
Specify a port to listen to. Overrides |
|
Specify the server root directory. Overrides
|
|
Set debug level. Overrides value |
|
Force the service to operate in case-insensitive mode on a normally case-sensitive platform. |
|
Write the server’s PID to the specified file. Default name for the file is |
--show-realtime
|
Display Monitoring the server in real-time monitoring on the command line. For details of this feature, see p4 monitor realtime in Helix Core Command-Line (P4) Reference. |
Checkpoint and journal options
We assume you have read the Backup procedure topic.
To improve performance, consider Parallel checkpointing, dumping and recovery, which is available in checkpoint options that support parallel threads: -jcp
, -jcpm
, -jdp
, -jdpm
, and -jvp
Checkpointing option | Meaning |
---|---|
|
Lock database tables, run |
|
Create checkpoint and rotate the journal.
In this case, your checkpoint and journal files are named
If no
Setting the You can store checkpoints and journals in the directory of your choice by specifying the directory as part of the prefix. With With Without |
|
Same as the |
|
Create checkpoint without saving or rotating the journal.
|
|
Same as the
|
[-R service | -P server-id] -jd [-z] file
|
Similar to All tables are locked while the command runs and are unlocked as it completes. |
|
Rotate the journal, and no checkpointing occurs. Including Your journal file is named |
|
Verify the integrity of the checkpoint or journal specified by
This command does not replay the journal. Including |
|
Compress (in When you use this option with the
creates two files: Warning
If you have downstream replicas, use -Z instead of -z because they cannot read from a compressed journal. |
|
Compress (in Note
Can be used when taking a checkpoint that rotates the journal: p4d -jc -Z The -Z option is not used for recovery: p4d -jr |
Journal restore options
Journal restore option | Meaning |
---|---|
|
Restore metadata from a checkpoint and/or journal file. If the journal header in the checkpoint file contains a server ID and the checkpoint file was created by If you specify the Note
When using a relative path to identify the file, the path is relative to the |
|
Same as the row above, except that the p option supports parallel threads. Using |
-R service -jr file
|
Similar to Tip
The If the journal header in the checkpoint file contains a server ID and the checkpoint file was created by |
|
Journal-restore with integrity-checking. Because this option
locks the database, this option is intended only for use by
replica servers started with the |
|
Allow replaying a checkpoint over an existing database. (Bypass
the check done by the |
|
Read |
|
Ignore failures to delete records. This meaning of
As with all journal-restore commands, if you specify the
|
|
Schedule new revisions for replica network transfer. Required
only in environments that use |
|
Record restored journal records into regular journal, so that the records can be propagated from the server’s journal to any replicas downstream of the server. This combination of options is intended for use in conjunction with Perforce Support. |
|
Ignores all storage records in the replay file and instead recalculates the net storage reference count change from the revision records. Applies the recalculated reference count at the end of the replay or the end of each transaction. Like the Important
This combination of options impacts the performance of journal replay. It is intended for small fixes under the guidance of Perforce Support. |
Replication and multi-server options
Replication and multi-server option | Meaning |
---|---|
|
In multi-server environments, specify an authentication server
for licensing and protections data. Overrides |
|
In multi-server environments, specify a changelist server from
which to obtain changelist numbers. Overrides
|
|
For replicas, specify the target (master) server from which to
pull data. Overrides |
|
For replicas, authenticate as the specified
|
Journal dump and restore filtering
Journal dump/restore filtering | Meaning |
---|---|
|
Dump This command can also be used with non-journaled tables.
|
|
Dump a set of named tables to a single dump
|
|
Dump all tables except the named tables to the dump
|
|
Specify filter patterns for Tip
This option is useful for seeding a filtered replica. |
-R service -jd file
|
Filter tables based on the
|
|
Restore from |
|
Restore from |
Certificate handling
Certificate Handling | Meaning |
---|---|
|
Generate SSL credentials files for the server: create a private
key and certificate file in Requires that |
|
Display the fingerprint of the server’s public key, and exit. Administrators can communicate this fingerprint to end users,
who can then use the |
Configuration options
Configuration option | Meaning |
---|---|
|
Display the contents of |
|
Set a Helix Server configurable without starting the service, optionally specifying the server for which the configurable is to apply. For example, p4d -r . "-cset replica#track=1" p4d -r . "-cset replica#track=1 replica#server=3" It is best to include the entire
|
|
Unset the specified configurable. |
Failback options
In regard to Failback after failover, we recommend that you first preview the commands and only include -y
if the preview looks acceptable.
Command | Purpose |
---|---|
|
To preview the conversion of the original master server to a standby for the current master. |
|
To perform the conversion of the original master server to a standby for the current master. The converted standby will then be ready for a later p4 failback command. |
|
(Optional) To preview the conversion of the original standby server to a standby for the restored master. |
|
(Optional) To perform the conversion of the original standby server to a standby for the restored master. |
Usage Notes
- Do not run p4d as root. See Running the Helix Server (p4d) as an unprivileged user.
- On all systems, journaling is enabled by default. If
P4JOURNAL
is unset whenp4d
starts, the default location for the journal is$P4ROOT
. If you want to manually disable journaling, you must explicitly setP4JOURNAL
tooff
. - Take checkpoints and truncate the journal often, preferably as part of your nightly backup process.
- Checkpointing and journaling preserve only your
Helix Server
metadata (data about your stored files). The stored files
themselves (the files containing your source code) reside under
P4ROOT
and must be also be backed up as part of your regular backup procedure. - It is best to keep journal files and checkpoints on a different hard drive or network location than the Helix Server database.
- If your users use triggers, don’t use the
-f
(non-forking mode) option. To run trigger scripts, the Perforce service needs to be able to "fork" (spawn copies of itself). - After a hardware failure, the options required for restoring your metadata from your checkpoint and journal files can vary, depending on whether data was corrupted.
- Because restorations from backups involving loss of files under
P4ROOT
often require the journal file, we strongly recommend that the journal file reside on a separate filesystem fromP4ROOT
. This way, in the event of corruption of the filesystem containingP4ROOT
, the journal is likely to remain accessible. - The database upgrade option (
-xu
) can require considerable disk space. For details, see the Release Notes.
Typical tasks
To start the service, listening to port |
|
To checkpoint a server with a non-default journal file, the
|
Checkpoint with:
or
|
To compress checkpoints and journals, which creates two files: myCheckpoint.gz and myCheckpoint.md5. | p4d -jd -z myCheckpoint |
To create a compressed checkpoint from a server with files in
directory |
|
To create a compressed checkpoint with a user-specified prefix
of “myCheckpoint” from a server with files in directory
|
|
To restore metadata from a checkpoint named
|
|
To restore metadata from a compressed checkpoint named
|
|