Alternate server definitions
The Helix Broker can direct user requests to an alternate server to reduce the load on the target server. These alternate servers must be replicas (or brokers, or proxies) connected to the intended target server.
To set up and configure a replica server, see Replication. The broker works with both metadata-only replicas and with replicas that have access to both metadata and versioned files.
You can define any number of alternate replica servers in a broker configuration file.
The syntax for specifying an alternate server is:
altserver: name { target=[protocol:]host:port; }
For example:
altserver: rep_18310 { target=10.5.10.118:18310; } altserver: rep_18320 { target=10.5.10.118:18320; } altserver: rep_18330 { target=10.5.10.118:18330; }
The name you assign to the alternate server is used in Command handler specifications.
Configuring alternate servers to work with central authorization servers
Alternate servers require users to authenticate themselves when they run
commands. For this reason, the
Helix Broker
must be used in conjunction with a central authorization server
(P4AUTH
). For more information about setting up
a central authorization server, see
Authorization and changelist servers.
When used with a central authorization server, a single p4 login
request can create a ticket that is valid for the
user across all servers in the
Helix Broker’s
configuration, enabling the user to log in once. The
Helix Broker
assumes that a ticket granted by the target server is valid across all
alternate servers.
If the target server in the broker configuration file is a central
authorization server, the value assigned to the target
parameter must precisely match the setting of P4AUTH
on the
alternate server machine(s). Similarly, if an alternate sever defined in
the broker configuration file is used as the central authorization
server, the value assigned to the target
parameter for the
alternate server must match the setting of P4AUTH
on the
other server machine(s).
Example of a P4Broker configuration file
If you choose to use a broker instead of a forwarding replica, edit the P4Broker configuration file to add the target, listen port, and other broker information.
target = master:11111; listen = 33333; directory = /p4broker/root/; logfile = broker.log; debug-level = server=1; admin-name = "your name"; admin-phone = x1234; admin-email = your.name@yourcompany.dom redirection = selective; # # Add an "altserver" for the replica: # altserver: replica1 { target = replica:22222; } # # Add command handlers to redirect read-only metadata commands to the replica # command: ^(branches|changes|clients|counters|depots|dirs \ |filelog|files|fstat|groups|interchanges|jobs|labels|opened \ |sizes|fixes|where|workspaces|users)$ { action = redirect; destination = replica1; } # # Prevent user joe from invoking p4 submit from the # buildonly client workspace. # command: submit { user = joe; workspace = buildonly; action = reject; message = "Submit failed: Please do not submit from this workspace."; } # # Allow user 'maria' to run 'p4 opened -a' but not without the '-a' option # command: opened { flags = -a; user = maria; action = pass; } command: opened { user = maria; action = reject; message = "Please use 'p4 opened -a'"; }