Introduction
The opHA 3 has a cli tool to perform the same operations than the CLI, but with some additional debugging information and it also allows the task automation.
/usr/local/omk/bin/opha-cli.pl Usage: opha-cli.pl act=[action to take] [options...] opha-cli.pl act=discover url_base=... username=... password=.... role=... mirror=... opha-cli.pl act=<import_peers|export_peers|list_peers> opha-cli.pl act=delete_peer {cluster_id=...|server_name=...} opha-cli.pl act=pull [data_types=X...] [peers=Y] [force=t] pull data types except nodes primary <-- peers opha-cli.pl act=sync-all-nodes [peers=Y] sync all node data from the primary to the pollers primary --> peers opha-cli.pl act=sync-processed-nodes sync node data based on changes done by opnode_admin primary --> peers opha-cli.pl act=import_config_data for firsts installation, provide initial data (groups) opha-cli.pl act=cleanup simulate=f/t clean metadata and files opha-cli.pl act=clean_orphan_nodes simulate=f/t remove nodes with unknown cluster_id opha-cli.pl act=resync_nodes peer=server_name remove the nodes from the poller in the primary and pull the nodes from the poller primary <-- peers opha-cli.pl act=clean_data peer=server_name [all=true] Like resync data but with all the data types primary <-- peers By default, cleanup just pull data all=true includes nodes opha-cli.pl act=cleanup_poller simulate=f/t from the pollers, clean duplicate configuration items and files opha-cli.pl act=check_duplicates check for duplicate nodes opha-cli.pl act=get_status opha-cli.pl act=setup-db opha-cli.pl act=show_roles opha-cli.pl act=data_verify opha-cli.pl act=lock_peer {cluster_id=...|server_name=...} opha-cli.pl act=unlock_peer {cluster_id=...|server_name=...} opha-cli.pl act=peer_islocked {cluster_id=...|server_name=...}
Core functionality
Discover Peer
You can discover a new peer with the following command:
opha-cli.pl act=discover url_base=... username=... password=.... role=... mirror=...
Where:
- role: Poller or Mirror
- Mirror: Should we specify the mirror of which poller when role=mirror
Import and Export Peers
We can import, export and list all the peers information with:
opha-cli.pl act=<import_peers|export_peers|list_peers>
Delete Peer
It is possible to delete a peer with the command:
opha-cli.pl act=delete_peer {cluster_id=...|server_name=...}
This command will remove the peer and all the associated data: Nodes, inventory, latest data, etc.
We need to specify OR the cluster_id OR the server name.
Pull
With pull, we will sync the inventory, latest data, events, status and registry data.
opha-cli.pl act=pull [data_types=X...] [peers=Y] [force=t]
Where:
- data_types: We can specify specific data types, if nothing is specified, all data types will be pulled.
- peers: List of peers to pull. If no peers are specified, all the peers will be pulled.
- force: By default, just the data changed from the last pull is synchronised. With this parameter, all the data will be moved.
The pull is running in the opha cron job.
Mirror and poller pulls
When we pull from a mirror, if its poller is active, just the registry and status data will be pulled.
It will happen the opposite: If the mirror is active, the poller data won't be pulled.
Nodes Synchronisation
To synchronise the nodes, we can run the polling:
opha-cli.pl act=sync-all-nodes [peers=Y]
Where:
- peers: List of peers to sync. If no peers are specified, all the peers will be pulled.
The sync-all-nodes is running in the opha cron job.
sync-processed-nodes
Will sync the nodes processed by opnode_admin:
opha-cli.pl act=sync-processed-nodes
Import Initial data
for firsts installations, provide initial data, basically setup the groups for pollers and primary and add the peers.
opha-cli.pl act=import_config_data
Cleanup Functions
cleanup
....
clean_orphan_nodes
....
resync_nodes
....
Clean data
....
cleanup poller
....
check duplicates
....
Diagnosis information
get status
....
Setup DB
....
Show roles
....
Data Verify
....
Lock Peer
....