Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Server Administration Documentation | 2025.2

# Alternate server definitions

The P4 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 Information that P4 Server maintains, such as who created file revisions in the depot, whether the file is a 'lazy copy,, the current state of client workspaces, protections, groups, users, labels, streams, and branches. Metadata is stored in the server database and is separate from the 'archive files' that users submit from their client workspace into the depot. and versioned files Source files stored in the depot, including one or more revisions to each file. Also known as archive files, archives, and depot files. Versioned files typically use the naming convention 'filename,v' or '1.changelist.gz'..

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 P4 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 P4 Broker’s configuration, enabling the user to log in once. The P4 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.

Copy

    target      = london: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'";
    }

Your search for returned results