p4 topology

Reports the Helix Core servers that are connected directly and indirectly to the innermost server, including an indicator of the server this command is running on.

Important

p4 topology is a Technology Preview feature.

Features offered in Technology Preview mode are unsupported and may not be functionally complete. If you use any features in Technology Preview mode, Perforce would appreciate your feedback and any functionality suggestions before the feature becomes supported. Please email us at [email protected].

Syntax

p4 [g-opts] topology [-a]

p4 [g-opts] topology [-a] [-F filter] [-T field...]

p4 [g-opts] topology [-t numberOfDays] [-F filter] [-T field...]

p4 [g-opts] topology -d date [y] [-e] [-s serveraddress]

Description

This command:

  • reports the Helix Core servers that are connected directly and indirectly to the innermost server

  • includes an indicator of the server this command is running on, such as Topology command was run on server - 127.0.0.1:1677

These servers can be connected directly or indirectly. The types of servers listed are: master, commit, edge (including edge-to-edge chaining), read-only replica, forwarding replica, standby, build, proxy, and broker.

By default, the command reports only the latest configurations based on the Server address, Target server address, and serverID for each service.

Output format

Command

Format of the output

p4 topology untagged, used by the Perforce admin for a quick validation
p4 -ztag topology tagged (see -z tag under Global options)
p4 -ztag -Mj topology JSON (see -Mj tag under Global options)

Options

-a

(Optional) Display all the configurations of the services that are captured in the topology table. With the -a option, the output does not exclude records that have been superseded, such as an older standard server entry after that server has been converted to a commit-server.

See Example of -a to see all records as well as db.topology in Helix Server Schema Documentation.

-d date

Defaults to a preview of the deletion of the record specified by using the date in Linux epoch format. To see the date in this format, use the p4 -ztag topology command. See Examples of deleting records.

-e Deletes all the records earlier than, and including, the specified -d date.
-y Can be used before -d to perform the deletion rather than show a preview.
-s serveraddress

Deletes the particular record that matches both the specified -d date and the specified server address.

-t numberOfDays

Display the configurations recorded during the specified number of numberOfDays prior to, and including, today. Any positive integer is valid. See Example of limiting time with -t.

Note

The -t option internally uses the value of the LastSeenDate field. Whereas Date represents the first time that the topology command reported a specific service, LastSeenDate is the most recent time that the topology command reported a specific service.

-F filter

List only those records that match the criteria specified by filter. See Example of filtering for fields with -F.

The filter pattern can be a regular expression. Topology uses the same filtering as p4 fstat. See Filter with -F on the p4 fstat page.

-T field...

Limits output to the specified fields. See Example of limiting fields with -T .

g-opts

See Global options, especially -ztag and -ztag -Mj.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

N/A

N/A

  • super

Note

This command is also available to an operator (see Types of users in p4 user)

Output that includes 0.0.0.0 indicates that the host address is unspecified. In such a case, Helix Core Server listens on all the available IPV4 addresses on the host. For example, if a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a Server running on this host listens on 0.0.0.0, the Server is listening on both IP addresses.

Examples

Example of limiting time with -t

p4 topology -t 7 outputs results for the current day as well as six days prior to the current day.

Example of filtering for fields with -F

p4 topology -F "^ServerAddress=127.0.0.1* ^ServerAddress=0.0.0.0*" uses a regular expression that filters out any results where the ServerAddress begins with 127.0.0.1 or 0.0.0.0

Example of limiting fields with -T

If p4 -ztag topology outputs

... ServerAddress 127.0.0.1:10868
... Date 1645786193
... ServerID oldmaster
... Type standard
... LastSeenDate 1645788650
... ReportingServer true

p4 topology -T ReportingServer,ServerID limits output to the specified fields:

... ServerID oldmaster
... ReportingServer true

Examples of deleting records

First, run p4 -ztag topology to get output that includes the Linux epoch date of each record, such as

... Date 1633567679

Second, preview the deletion of the records with that date:

p4 topology -d 1633567679

and note that the output includes this comment:

# This is in preview mode. For actual deletion, use '-y'.

Finally, confirm that you want to delete all the records of the specified date:

p4 topology -y -d 1633567679

Note

To delete a specific record of that date, include the server address:
p4 topology -y -d 1633567679 -s 127.0.0.1:26385

To delete records of all dates prior to, and including, the specified date, include the -e option:
p4 topology -y -e -d 1633567679

Example of -a to see all records

The output of p4 topology -a can be a superset of the output of p4 topology because the -a option includes records that have been superseded. In this example, a server restart is associated with the conversion of that server's type from standard to commit-server.

p4 topology -a p4 topology
127.0.0.1:4444 master 2022/05/18 13:59:55 commit-server 2022/05/18 13:59:55 127.0.0.1:4444 master 2022/05/18 13:59:55 commit-server 2022/05/18 13:59:55
127.0.0.1:4444 master 2022/05/18 13:59:53 standard 2022/05/18 13:59:53 (This entry does not appear without -a because it is superseded by the server type conversion.)