I’m experimenting with multiple Perforce servers on Windows today, which is fairly simple to configure. I’ve run into a few gotchas, however, so I’d like to enumerate them here.
Installing Multiple Perforce Services on Windows
The procedure is documented on Perforce’s website, but I’ve reproduced the steps here for simplicity.
- Create a new directory for the Perforce service.
- Copy the server executable, service executable, and license file into this directory.
- Create the new Perforce service using the svcinst.exe utility.
- Set up the environment variables.
- Start the new service.
Here is an example set of commands for doing this from the command line:
rem Create the destination directory for the new server. rem This directory will contain the executable images and the depots. md C:\P4Root2 rem Copy the files to the new directory. copy "C:\Program Files\Perforce\Server\p4d.exe" C:\P4Root2 copy "C:\Program Files\Perforce\Server\p4s.exe" C:\P4Root2 copy "C:\Program Files\Perforce\Server\svcinst.exe" C:\P4Root2 copy "C:\Program Files\Perforce\Server\license" C:\P4Root2 cd /d C:\P4Root2 rem Create the service. svcinst create -n Perforce2 -e C:\P4Root2\p4s.exe –a rem Set the service parameters for the new service. p4 set -S Perforce2 P4ROOT=C:\P4Root2 p4 set -S Perforce2 P4PORT=1667 p4 set -S Perforce2 P4LOG=log p4 set -S Perforce2 P4JOURNAL=journal rem Start the service. svcinst start -n Perforce2
The example on the Perforce website uses a different name for the log and journal parameters (
journal2). It’s not clear why this is necessary. I’ve had success with using the standard names.
The parameters for the new service are stored at
HKLM \ SYSTEM \ CurrentControlSet \ services \ Perforce2 \ Parameters. However, changing them manually in regedit may produce unexpected results. I almost messed up my primary server by doing this.
If you need to change the port for a server, you must also stop and restart the service.
Don’t forget to add a rule to the firewall to allow connections to the Perforce Server in the new location. I spun for a little bit trying to figure out why I couldn’t connect from another machine to the new server.
My biggest wish is that there was an actual online community. Perforce references the online community on their support page, but there is no forum or bulletin board anywhere for asking questions. Rather frustrating if you ask me.