Perforce and distributed team development
One perforce proxy and perforce replicated Server
Perforce supports distributed team development through perforce proxy and perforce replicated servers. Proxy and replicated servers can be used independently or in combination as needed. You can simply add a new proxy or replicated server to adapt to the increase of new users around the world.
Perforce proxy
The execution file of perforce proxy is P4P, which is a self-maintained proxy server that caches remote p4server versioned files to the local network, thus greatly reducing the time for local users to transfer files. If a file has been requested by another user to the local proxy, other local users will directly operate on the local proxy, so the user operation experience will be smooth. P4P also reduces the load on the main server. Because P4P is automatically retrieved from the main server and updated, we do not need to back up the proxy.
Perforce Replication Server
The replicated perforce server maintains a read-only copy of the entire repository. You can only replicate P4's Datebase or replicate all P4 database files and versioned files. Read-only operations on the main server can be transferred to the replicated server. This method also reduces the load on the main server. Replication also provides high availability. When the mainserver is down, developers can also access the replication server to perform read operations. Alternatively, you can quickly convert the replicated server to the main server.
As the traffic ctor, perforce brokerbroker sends read-only commands to the local replicated server and forwards the commands that require write permission to the main server or proxy. After the broker and replicated server are used, the user's read-only operations will be smooth.
The difference between proxy and replication:
Proxy only automatically caches versioned files to the server where the proxy is located to reduce the transmission time of remote user files. The database of p4server is still in the main server. Therefore, the main function of proxy is to reduce the file transmission time and improve the user experience.
Replication copies all database or versioned files + database files to the server where replication is located, but the replication server only accepts read-only operations. Therefore, the main role of replication is to reduce the load on the main server.
2. Perforce proxy
Proxyon windows, you can use perforce.exe to install proxy as service, or run P4P on the command line to start proxy.
When running as a service, you need to set service parameters, such as the command P4 set-s "perforce proxy" p4poptions = "-P 1999-T mainserver: 1666 "the startup parameter set for perforce proxy service is"-P 1999-T mainserver: 1666 ","-P 1999 "indicates that the listening port of this proxy is 1999, "-T mainserver: 1666" indicates that this proxy will be a proxy of mianserver: 1666. You can use ipofproxyserver: 1999 to access this proxy.
The proxy can also be started directly from the command line, for example, P4P-P 1999-T central: 1666-r/var/proxyroot's proxy listening port 1999, And the mian server is central: 1666, the cache directory of proxy is/var/proxyroot.
Note:
* Proxy cache directory backup is not required;
* When Synchronizing files, you can use-zproxyverbose to check whether the file is from mainserver or proxyserver, such as P4-zproxyverbose sync noncached.txt;
* The-C parameter indicates File Transfer compression between proxy and mianserver. After compression, the network burden is reduced, but the server compression and decompression burden must be increased;
* P4P caches files to the storage of the proxy only when you submit file modifications or request files. That is to say, the proxy does not automatically cache all files in advance. However, once the file is cached, it is directly obtained from the proxy cache;
* The proxy creator can use-zproxyload to cache versionedfiles with the new proxy to reduce the file transfer time in the future, such as P4-zproxyload sync // depot/main /...;
* Folder connections can be used to avoid the size limit of cached directories;
Tri-replicated Server
Purpose:
* This reduces the burden and downtime of the main server. Long query operations, reports, builds, and checkpoints can all be completed on the replicated server. On the replicated server, checkpoint can reduce the lock time on the main server. For reports and checkpoints, only the database of the P4 server needs to be replaced. For build tasks, the build process needs to access versioned files of main server.
* Provides hot standby servers. If the main server fails, run the P4 replicate command to maintain the replicated server as the hot backup server. At this time, the replicated server requires both database and versioned files to be replicated. The P4 replicated command can only replicated the database file. Replicate of versioned files must use the P4 pull command.
You can use P4 replicate, P4 pull, and p4d to create a replicated server.
1) P4 replicate: indicates that the database of replicate p4 is from one server to another;
2) P4 pull: indicates that the database and versioned files of replicate P4 are transferred from one server to another;
3) In most cases, we use P4 pull, because not only the database of replicate P4, but also the versioned files of automatically replicate P4;
4) The start parameter of the replicated server must be p4d-m-D, and-M indicates that the database file of the replicated server is read-only, -D indicates that versionedfiles of the replicated server are read-only. In short, the replicated server only processes read-only operations;
5) You can also use P4 configure dB. Replication = readonly and LBR. Replication = readonly to set the read-only behavior of the replicated server;
6) Use p4d-in name or P4 configure name to name P4 server;
7) You can specify the users that replicated server interacts with mainserver, such as p4d-u svcuser. This type of user must be of the service type and can only be used as replicated or proxy server, without occupying the license;
8) set the environment variable p4target, or in p4d-t host: port, or after p4d runs, use P4 configure p4target to specify the main server to which the replicated server points;
9) Startup. N is used to specify the number of P4 pull processes. Multiple P4 pull processes can be run simultaneously;
Some restrictions on the replicated Server:
* The Journals of the main server read by the P4 replicate and P4 pull commands must be non-compressed.
* The replicate server must have a license file. You can contact P4 to create a duplicate license file.
* The replicate server and main server must have the same time zone settings.
Five Brokers
It is easy to start p4broker, such as p4broker-C config_file-D. You can also use P4 set-s p4brokeroptions "-c: \ p4broker \ broker. conf" to set command line parameters for p4broker. Use p4broker-C> p4broker. conf to create the conf template.
Generally, conf contains three parts:
* General information, for example, target indicates the p4server processed by the default command, listen indicates the port to be listened on by the broker, and admin information.
* Alternate server definitions: indicates the address of the replicated servers.
Command handler specifications: indicates the command distribution rule.
Complete!