With Perforce Server release 2010.2, server configuration variables were introduced and provide a method for storing server configurations in the Perforce Server database. When the Perforce Server is running, you use the p4 configure command to access and manage configuration variables. If the Perforce Server is not running, or a particular configuration setting is not allowing access to the server, you can use the p4d command and its associated -cshow, -cset, and -cunset options to list, set, and unset server configuration variables.
Note: The -cshow, -cset, and -cunset options were undocumented prior to server release 2013.1.
Server configuration variables are stored in the db.config table in the Perforce Server root directory. The P4ROOT passed to p4d when running -cshow, -cset, and -cunset controls which db.config table is used for the operation.
Listing Server Configuration Variables
To list all server configuration variables, use -cshow:
p4d -r $P4ROOT -cshow
Setting/Unsetting Server Configuration Variables
To set or unset values, use -cset or -cunset:
p4d -r $P4ROOT "-cset [server#]variable=value"
p4d -r $P4ROOT "-cunset [server#]variable"
Changes made by -cset or -cunset only affect the configuration of the server pointed to by P4ROOT. The one caveat to this is when using the -s option to p4d and making changes to the configuration of a master server that has a replica. The use of the -s option to p4d:
p4d -s -r $P4ROOT "-cset master#security=3"
indicates the action is journaled. This means that downstream replicas will see these journal transactions and apply those changes to the replica db.config
Show the server configuration variables for a server with a P4ROOT of /perforce/db:
p4d -r /perforce/db "-cshow"
Set the security configurable to 3 for a server with a P4NAME
p4d -r /perforce/db "-cset master#security=3"
Set the monitor configurable to 2 for a server with a P4NAME of master:
p4d -r /perforce/db "-cset master#monitor=2"
Set the P4TARGET configurable for a server with a P4NAME of replica:
p4d -r /perforce/replica/db "-cset replica#P4TARGET=master:1666"
Set the startup.1 configurable for a server with a P4NAME of replica:
p4d -r /perforce/replica/db "-cset replica#startup.1=pull -i 2"
Unset the monitor configurable for a server with a P4NAME of master:
p4d -r /perforce/db "-cunset master#monitor"
Unset the startup.1 configurable for a server with a P4NAME of replica:
p4d -r /perforce/replica/db "-cunset replica#startup.1"