Skip to main content
Common Reference

The multi_trepctl Command

The multi_trepctl command provides unified status and operation support across your installation across multiple hosts without the need to run the trepctl command across multiple hosts and/or services individually.

Usage
multi_trepctl [command] [options]

The default operation, with no further command-line commands or arguments displays the status of all the hosts and services identified as related to the current host. In a typical single-service deployment, the command outputs the status of all services by determining the relationship between hosts connected to the default service:

shell> multi_trepctl
| host | serviceName | role | state | appliedLastSeqno | appliedLatency |
| tr-ms1 | alpha | master | ONLINE | 54 | 0.867 |
| tr-ms2 | alpha | slave | ONLINE | 54 | 1.945 |
| tr-ms3 | alpha | slave | ONLINE | 54 | 42.051 |

On a server with multiple services, information is output for each service and host:

shell> multi_trepctl
| host | servicename | role | state | appliedlastseqno | appliedLatency |
| east1 | east | master | ONLINE | 53 | 0.000 |
| east1 | west | slave | OFFLINE:ERROR | -1 | -1.000 |
| west1 | west | master | ONLINE | 294328 | 0.319 |
| west1 | east | slave | ONLINE | 53 | 119.834 |
| west2 | west | master | ONLINE | 231595 | 0.316 |
| west2 | east | slave | ONLINE | 53 | 181.128 |
| west3 | east | slave | ONLINE | 53 | 204.790 |
| west3 | west | slave | ONLINE | 231595 | 22.895 |

multi_trepctl Options

The multi_trepctl tool provides a number of options that control the information and detail output when the command is executed.

OptionDescriptionVersion
--by-serviceSort the output by the service name.
--fieldsFields to be output during during summary.
Valid: host, serviceName, role, state, appliedLastSeqNo, appliedLatency
--host
Aliases: --hosts
Host or hosts on which to limit output.
--outputSpecify the output format.
Valid: info, tab, list, name, json, yaml
--path
Aliases: --paths
Directory or directories to check when looking for tools.
--role
Aliases: --roles
Limit the output to show only the specified role.
--service
Aliases: --services
Service or services on which to limit output.
--skip-headersSkip the headers.
--sort-bySort by a specified field.
Valid: host, serviceName, role, state, appliedLastSeqNo, appliedLatency

Where:

--by-service

Order the output according to the service name and role within the service:
shell> multi_trepctl --by-service
| host | servicename | role | state | appliedlastseqno | appliedLatency |
| east1 | east | master | ONLINE | 64 | 59.380 |
| west1 | east | slave | ONLINE | 64 | 60.889 |
| west2 | east | slave | ONLINE | 64 | 60.970 |
| west3 | east | slave | ONLINE | 64 | 61.097 |
| west1 | west | master | ONLINE | 294328 | 0.319 |
| west2 | west | master | ONLINE | 231595 | 0.316 |
| east1 | west | slave | OFFLINE:ERROR | -1 | -1.000 |
| west3 | west | slave | ONLINE | 231595 | 22.895 |

--fields

Limited the output to the specified list of fields from the output of fields output by trepctl. For example, to limit the output to the host, role, and appliedLatency:
shell> multi_trepctl --fields=host,role,appliedlatency
| host | role | appliedlatency |
| tr-ms1 | master | 0.524 |
| tr-ms2 | slave | 0.000 |
| tr-ms3 | slave | -1.000 |

--host

Aliases--hosts
Limit the output to the host, or a comma-separated list of hosts specified. For example:
shell> multi_trepctl --hosts=tr-ms1,tr-ms3
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| tr-ms1 | alpha | master | ONLINE | 2322 | 0.524 |
| tr-ms3 | alpha | slave | OFFLINE:ERROR | -1 | -1.000 |

--output

Specify the output format.
For example, to output the current status in JSON format:
shell> multi_trepctl --output json
[
{
"appliedlastseqno": 2322,
"appliedlatency": 0.524,
"host": "tr-ms1",
"role": "master",
"servicename": "alpha",
"state": "ONLINE"
},
{
"appliedlastseqno": 2322,
"appliedlatency": 0.0,
"host": "tr-ms2",
"role": "slave",
"servicename": "alpha",
"state": "ONLINE"
},
{
"appliedlastseqno": -1,
"appliedlatency": -1.0,
"host": "tr-ms3",
"role": "slave",
"servicename": "alpha",
"state": "OFFLINE:ERROR"
}
]

--path

Aliases--paths
Limit the search for trepctl to the specified path or comma-separated list of paths. On a deployment with multiple services, the output will be limited by the services installed within the specified directories:
shell> multi_trepctl --path /opt/replicator
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| db1 | west | slave | ONLINE | 3 | 0.450 |
| db2 | west | slave | ONLINE | 3 | 0.481 |
| db3 | west | slave | ONLINE | 3 | 0.484 |
| db4 | east | slave | ONLINE | 4 | 0.460 |
| db5 | east | slave | ONLINE | 4 | 0.451 |
| db6 | east | slave | ONLINE | 4 | 0.496 |
This is also useful when control of cross-site replicators is desired in Multi-Site/Active-Active topologies.
For example, take all cross-site replicators offline:
shell> multi_trepctl --path /opt/replicator offline
To bring all cross-site replicators online:
shell> multi_trepctl --path /opt/replicator online

--role

Aliases--roles
Limit the output to show only the specified role or comma-separated list of roles:
shell> multi_trepctl --roles=slave
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| tr-ms2 | alpha | slave | ONLINE | 2322 | 0.000 |
| tr-ms3 | alpha | slave | OFFLINE:ERROR | -1 | -1.000 |

--service

Aliases--services
Limit the output to the specified service or comma-separated list of services:
shell> multi_trepctl --service=east
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| east1 | east | master | ONLINE | 53 | 0.000 |
| west1 | east | slave | ONLINE | 53 | 119.834 |
| west2 | east | slave | ONLINE | 53 | 181.128 |
| west3 | east | slave | ONLINE | 53 | 204.790 |

--skip-headers

Prevents the generation of the headers when generating the list output format:
shell> multi_trepctl --skip-headers
| tr-ms1 | alpha | master | ONLINE | 2322 | 0.524 |
| tr-ms2 | alpha | slave | ONLINE | 2322 | 0.000 |
| tr-ms3 | alpha | slave | OFFLINE:ERROR | -1 | -1.000 |

--sort-by

Sort by the specified fieldname. For example, to sort the output by the latency:
shell> multi_trepctl --sort-by appliedlatency
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| tr-ms3 | alpha | slave | OFFLINE:ERROR | -1 | -1.000 |
| tr-ms2 | alpha | slave | ONLINE | 2322 | 0.000 |
| tr-ms1 | alpha | master | ONLINE | 2322 | 0.524 |

multi_trepctl Commands

The default operational mode is for multi_trepctl list to output the status. A specific mode can also be specified on the command-line.

OptionDescriptionVersion
backupsList all the backups available across all configured hosts and services.
heartbeatInserts a heartbeat on all primaries within the service.
listList the information about each service.
masterofList all the primaries of configured hosts and services.
runRun the specified trepctl command on all hosts/services.

In addition to the two primary commands, multi_trepctl can execute commands that would normally be applied to trepctl, running them on each selected host, service or directory according to the options. The output format and expectation is controlled through the list and run commands.

For example:

shell> multi_trepctl status

Outputs the long form of the status information (as per trepctl reset) for each identified host.

backups

Lists the available backups across all replicators.
shell> multi_trepctl backups
| host | servicename | backup_date | prefix | agent |
| host1 | alpha | 2014-08-15 09:40:37 | store-0000000002 | mysqldump |
| host1 | alpha | 2014-08-15 09:36:57 | store-0000000001 | mysqldump |
| host2 | alpha | 2014-08-12 07:02:29 | store-0000000001 | mysqldump |

heartbeat

Runs the trepctl heartbeat command on all hosts that are identified as masters.
shell> multi_trepctl heartbeat
host: host1
servicename: alpha
role: master
state: ONLINE
appliedlastseqno: 8
appliedlatency: 2.619
output:

list

The multi_trepctl list mode is the default mode for multi_trepctl and outputs the current status across all hosts and services as a table:
shell>multi_trepctl
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| host1 | firstrep | master | OFFLINE:ERROR | -1 | -1.000 |
| host2 | firstrep | slave | GOING-ONLINE:SYNCHRONIZING | 5271 | 4656.264 |
| host3 | firstrep | slave | OFFLINE:ERROR | -1 | -1.000 |
| host4 | firstrep | slave | OFFLINE:ERROR | -1 | -1.000 |
Or selected hosts and services if options are specified. For example, to get the status only for host1 andhost2:
shell> multi_trepctl --hosts=host1,host2
| host | servicename | role | state | appliedlastseqno | appliedlatency |
| host1 | firstrep | master | ONLINE | 5277 | 0.476 |
| host2 | firstrep | slave | ONLINE | 5277 | 0.000 |
The multi_trepctl command implies that the status or information is being output from each of the commands executed on the remote hosts and services.

masterof

Lists which hosts are primaries of others within the configured services.
shell> multi_trepctl masterof
| servicename | host | uri |
| alpha | host1 | thl://host1:2112/ |

run

The multi_trepctl run command can be used where the output of the corresponding trepctl command cannot be formatted into a convenient list. For example, to execute a backup on every host within a deployment:
shell> multi_trepctl run backup
The same filters and host or service selection can also be made:
shell> multi_trepctl run backup --hosts=host1,host2,host3
host: host1
servicename: firstrep
output: |
Backup completed successfully; URI=storage://file-system/store-0000000005.properties
---
host: host2
servicename: firstrep
output: |
Backup completed successfully; URI=storage://file-system/store-0000000001.properties
---
host: host3
servicename: firstrep
output: |
Backup completed successfully; URI=storage://file-system/store-0000000001.properties
...
Return from the command will only take place when remote commands on each host have completed and returned.