Change the location of server components on the same machine

You can change the location of the following server components on the same machine: P4ROOT, P4PORT, Depot, Log, Helix Core Server executable.

P4ROOT

The Helix Core Server database (db.*) files are located in P4ROOT, the server root directory. If you change P4ROOT, you must also move the database files to that new location.

P4ROOT defaults to the p4d executable directory.

You can change the value of P4ROOT by using the p4d -r startup command or by setting the P4ROOT environment variable. Changing the value while the server is running is safe because the value is only read when the server is starting.

If the server is started as a Windows Service, you can change the server root by using p4 set. For example:

p4 set -S "Perforce" P4ROOT=E:\Perforce

The default service name is "Perforce". If you are running multiple Helix Core Server service instances, specify P4ROOT for each instance separately.

P4PORT

The server port, P4PORT, defaults to 1666.

You can change P4PORT by using the p4d -p startup command or by setting the P4PORT environment variable.

Changing the value while the server is running is safe because the value is only read when the server is starting.

If the server is started as a Windows Service, you can change the server port by using p4 set. For example:

p4 set -S "Perforce" P4PORT=1669

Unless you are using the limited free license, submit a Change of Server Request to get a new license for the new port before to changing the P4PORT value.

P4TARGET and multiple servers

If you have edge, replica, or standby servers, consider whether the P4TARGET for those servers needs to be changed.

Depot

By default, all depot directories are created relative to P4ROOT. You can change that relative location by using the server.depot.root configurable.

Alternatively, the Map field in individual depot specifications can be changed to use an absolute path:

p4 depot depotName

On Windows, the absolute path needs to include the drive letter for the path.

For detailed steps on how to move the depot location safely, see Set a depot location.

Journal

The live journal file name defaults to journal in P4ROOT.

You can change its name and path by either:

If you specify a relative path, make it relative to the server root.

Before you change the journal file location, shut down the server (or stop the Windows service):

Example Steps Command
1. Shut down the server. p4 admin stop
2. Copy the journal to its new location. copy %P4ROOT%\journal D:\JOURNAL\perforce_journal
3a. For a Windows service, change the environmental variable to point to the new journal location.

p4 set -S "Perforce" P4JOURNAL=D:\JOURNAL\perforce_journal

3b. Start the server using the new journal location.

 

For a Windows Service:

net start Perforce

From the command line:

p4d -r %P4ROOT% -J D:\JOURNAL\perforce_journal

4a. Take a checkpoint of the server running with the journal at the new location.

4b. Verify that the journal in the new location is OK.

4c. Delete the journal at the old location.

del %P4ROOT%\journal

Log

The server log defaults to standard error. You can change the log name and path with the -L option or by setting the P4LOG environment variable.

Example:

p4 admin stop
p4 set -S "Perforce" P4LOG=D:\LOG\perforce_log
net start Perforce

Helix Core Server executable

In general, the Helix Core Server executable is located in a directory that can be found by your operating system's search path. For example, it can be located in /usr/local/bin on UNIX, or the default C:\Program Files\Perforce\Server\ on Windows. You can move the p4d executable to its new location, and then make sure that it can be located by your startup script or command.

The Helix Core Server on Windows is usually started as a Windows Service, and the path to the p4s.exe executable is set in the registry. To change this, run the installer.