Identifying your server
Giving your server a unique ID permits most of the server configuration data to be stored in the Helix Core Server. This is an alternative to using startup options or environment variables. A unique server ID is essential for configuring replication because p4 configure settings are replicated from the master server to the replicas along with other metadata.
Configuring the following servers require the use of a server spec:
Type |
Description |
---|---|
Commit Server | central server in a distributed installation |
Edge Server | node in a distributed installation |
Build server | replica that supports integration with a build server (or build farm) |
Standby server | read-only replica that uses p4 journalcopy |
Forwarding standby | forwarding replica that uses p4 journalcopy |
The p4 serverid serverid command can be used to create a small
text file named server.id
in the P4ROOT directory of the server. For example,
p4 serverid UK-commit-1
The server executable, p4d
, can also create this server.id
file with the syntax:
p4d -r $P4ROOT -xD serverid
For example, from the P4ROOT
directory:
p4d -r . -xD UK-commit-1
To see the server id, see the output of the p4d -xD
or the p4 serverid command. If the response is "Server does not yet have a server ID"
, set the server ID with
p4d -r $P4ROOT -xD serverid
To change an existing server ID, delete the server.id
file from the P4ROOT
directory, then set the server ID.
Define the server
After you create the ServerID, bring up the Server spec by using the p4 server command.
For example, issue these two commands:
p4 -p svrA.company.com:11111 serverid myMaster p4 server myMaster
In the Server spec, specify a type of service, such as commit-server
, in the Services
field.
Two ways to set configurables:
Add configurable settings to the DistributedConfig
field of the server spec. For example:
DistributedConfig: monitor=2 security=6
or run commands similar to these:
p4 -p svrA.company.com:11111 configure set myMaster#monitor=2 p4 -p svrA.company.com:11111 configure set myMaster#security=6
After the configuration data has been replicated
A master and each replica is likely to have its own journal and checkpoint files. To ensure their prefixes are unique, use the journalPrefix configurable for each named server.
Run this command:
p4 -p svrA.company.com:11111 configure set myMaster#journalPrefix=/p4/ckps/myMaster
The output is:
For server 'myMaster', configuration variable 'journalPrefix' set to '/p4/ckps/myMaster'
Then run this command:
p4 -p svrA.company.com:11111 configure set myReplica#journalPrefix=/p4/ckps/myReplica
The output is:
For server 'myReplica', configuration variable 'journalPrefix' set to '/p4/ckps/myReplica'