bihactl
bihactl — create a BiHA cluster in Postgres Pro
Synopsis
bihactl cluster init [option...] --biha-listen-addresses --pgdata
bihactl cluster status [option...]
bihactl cluster show-config [option...]
bihactl node add [option...] --biha-node-id --pgdata { --use-leader | --magic-file | --magic-string }
bihactl node set front-follower [option...] --id { --magic-file | --magic-string }
bihactl node set leader [option...] --id { --magic-file | --magic-string }
bihactl run [option...]
bihactl segment add [option...] { --use-leader | --magic-file | --magic-string }
bihactl segment set leader [option...] --id { --magic-file | --magic-string }
bihactl unit set leader [option...] --id { --magic-file | --magic-string }
bihactl upgrade start [option...] { --magic-string | --new-leader-biha-port | --new-leader-host | --new-leader-port | --new-pgdata | --old-bin | --old-pgdata | --subscriber-username }
bihactl upgrade move { --new-magic-string | --new-pgdata | --old-bin | --old-pgdata }
bihactl upgrade finish [option...] { --new-magic-string | --subscriber-username }
bihactl --version
bihactl --help
Description
bihactl is a command line utility that allows creating a BiHA cluster, changing its composition, as well as monitoring the cluster status. For more information about the BiHA solution, refer to Built-in High Availability (BiHA).
Important
bihactl for Postgres Pro Standard is not supported on Elbrus CPU architecture.
Note
bihactl does not support using the equal sign with include_dir in the postgresql.conf configuration file. For proper operation, use the documented syntax.
This section contains information about the bihactl utility commands:
The follower node can be added using a magic string saved after the bihactl cluster init command by adding the -s option to the bihactl bihactl node add command.
Command-Line Reference #
cluster init #
Syntax:
bihactl cluster init [--biha-hosts=hosts] --biha-listen-addresses=addresses[--biha-node-id=node_id] [--biha-port=biha_port] [--cluster-name=cluster_name] [--convert [--server-cert=/path/to/server.crt\ --server-key=/path/to/server.key]] [--magic-file=magic_file] [--max-replicas=max_number_of_replicas] [--minnodes=min_node_num] [--node-name=node_name] [--no-password] [--nquorum=quorum_value] [--options=initdb_options] --pgdata=datadir[--pg-port=port] [--preferred-roles=preferred_roles_for_replication] [--priority=node_priority] [--replication-hosts=replication_hosts] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] [--sync-standbys=sync_standbys_num[--sync-standbys-min=sync_standbys_min_num]] [--sql-hosts=sql_hosts] [--use-ssl] [--username=name_of_bootstrap_superuser]
Initializes a cluster and sets the leader node. The command must be executed on the server where you want to host the leader. When this command is executed, bihactl accesses the initdb utility, and at this stage you can also specify its parameters with the -o option or using initdb options directly.
For more information, refer to Authentication Options, Leader Connection Options, and Network Options.
-Inode_id--biha-node-id=#node_idSpecifies the unique ID of the node. The value must be integer and greater than zero.
--cluster-name=#cluster_nameSpecifies the name of the BiHA cluster. The default name is
biha_node_1111.-C--convert#Converts the existing node into the leader node of the BiHA cluster. If the name of the bootstrap superuser of your existing node is not
postgres, use the --username option to specify this name.--max-replicas=#max_number_of_replicasSpecifies the maximum number of biha replication connections to a node, i.e. the maximum number of walsenders where
application_nameisbiha_node_*.Possible values are:
0,INT_MAX. The default value isINT_MAX, the number of connections is unlimited.-Mmin_node_num--minnodes=#min_node_numSpecifies the minimum number of operational nodes for the leader node to be open for write transactions. If not specified, the value equals the
--nquorumvalue.--no-password#If set, bihactl does not prompt you to manually specify the password for the
biha_replication_userrole.--node-name=#node_nameSpecifies the leader node name.
-Nquorum_value--nquorum=#quorum_valueSpecifies the minimum number of nodes which must vote for the new leader node if the current leader is down. The default value is
2.When setting up this value, consider the split-brain risk. It is recommended to use the following formula: (
total_number_of_nodes+ 1)/2. For example, if your cluster has 3 nodes, thequorum_valuevalue must be 2.-oinitdb_options--options=#initdb_optionsSpecifies additional options of initdb. This option is ignored if you convert your existing node using --convert.
Using the
--usernameoption of initdb is not supported. Use the--usernameoption of bihactl instead.-Ddatadir--pgdata=#datadirSpecifies the directory where the database cluster should be stored. By default, bihactl uses the
PGDATAvalue.--preferred-roles=#preferred_roles_for_replicationSpecifies the preferred role of a node for replication in a BiHA cluster with cascading replication.
Possible values are: combinations of
L(leader),F(follower), andR(referee). The value must be 1 to 3 symbols long and must not contain repeatable symbols. For example:L,F,LFR, orLF.The default value is
L, meaning that data is replicated from the leader only.--priority=#node_prioritySets the node priority that affects both elections and replication in a cluster, in seconds. Possible values:
0,INT_MAX. The default value is-1, meaning that the parameter is ignored. You can modify this parameter value only by the biha.set_priority function.BiHA uses this configuration parameter for the following purposes:
To set the replication start timeout when selecting the replication source in a BiHA cluster with configured cascading replication. The higher the value, the later the node starts replication and allows connection of nodes with lower priority. The parameter is required for the nodes to establish the cascading replication schema automatically.
To set the node priority in a cluster with synchronous replication. The value determines the timeout that must be reached before the node stands as a candidate in elections. The zero value indicates the highest priority.
Important
To ensure correct operation of this parameter, set the --sync-standbys value one unit less than the total number of cluster nodes.
-Ysync_standbys_num--sync-standbys=#sync_standbys_numEnables quorum-based synchronous replication by setting the synchronous_standby_names parameter and specifying the number of synchronous standbys (quorum) with the
ANYmethod. The value must be integer and greater than zero, as well as higher than the value of --sync-standbys-min parameter if set, and must not exceed the number of followers excluding referee. It is recommended to set thesync_standbys_numvalue less than the value of --minnodes.-ysync_standbys_min_num--sync-standbys-min=#sync_standbys_min_numEnables relaxed quorum-based synchronous replication by specifying the
MINfield value of the synchronous_standby_names parameter, which is the minimum number of synchronous standbys that must be available for the leader node to continue confirming transactions.sync_standbys_min_nummust be integer and equal to or greater than zero, as well as lower than --sync-standbys. If the option is not specified, the BiHA cluster operates according to the default synchronous replication restrictions, i.e. the leader node is not available for write transactions until all followers catch up with its current state.-S--use-ssl#Enables the protected mode of the service information exchange between cluster nodes with SSL/TLS over the biha control channel (
BCP).Important
To use SSL for service connections, your installed OpenSSL version must be 1.1.1 or higher. Otherwise, the BiHA cluster is created without SSL for service connections, and a corresponding message is recorded in the log.
--username=#name_of_bootstrap_superuserSets the user name of the bootstrap superuser. This defaults to the name of the operating-system user running
initdb. Use this option in the following cases:When you initialize a BiHA cluster from scratch and want to set the bootstrap superuser name other than
postgres.When you convert an existing node where the bootstrap superuser name is not
postgres.
Using the
--usernameoption of initdb is not supported.
cluster show-config #
Syntax:
bihactl cluster show-config [--biha-listen-addresses=addresses] [--format=data_output_format] [--magic-file=magic_file] [--magic-string=magic_string] [--pg-port=port] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]]
Displays the full cluster configuration information. An example of a command output in the JSON format looks as follows:
{
"proxima_enabled": false,
"use_ssl": false,
"service_mode": false,
"user_biha_cert": "",
"user_biha_key": "",
"ssl_certificate": "",
"ssl_private_key": "",
"ssl_mode": "",
"synchronous_standby_names": {
"count": -1,
"min": -2,
"names": []
},
"unit": {
"id": 1111,
"name": "biha_node_1111",
"can_be_leader": true,
"can_vote": true,
"priority": -1,
"leader_timeout": 20000,
"mode": "regular",
"repl_pref_roles": "L",
"nquorum": 1,
"minnodes": 1,
"heartbeat_send_period": 1000,
"heartbeat_max_lost": 10,
"no_wal_on_follower": 5000,
"children": [
{
"id": 111,
"name": "biha_node_111",
"can_be_leader": true,
"can_vote": true,
"priority": -1,
"leader_timeout": 20000,
"mode": "regular",
"repl_pref_roles": "L",
"nquorum": 2,
"minnodes": 2,
"heartbeat_send_period": 1000,
"heartbeat_max_lost": 10,
"no_wal_on_follower": 5000,
"children": [
{
"id": 1,
"name": "biha_node_1",
"can_be_leader": true,
"can_vote": true,
"priority": -1,
"leader_timeout": 20000,
"mode": "regular",
"repl_pref_roles": "L",
"pg_port": 5432,
"biha_port": 15432,
"max_replicas": 2147483647,
"flw_ro": true,
"config_send_period": 10000,
"watchdog_timeout": 2,
"callbacks_timeout": 10000,
"asyncaction_timeout": 30000,
"manage_slots_xmin": true,
"deny_wal_sources": [],
"biha_listen_addresses": [
{
"address": "biha-db-4",
"port": -1
}
],
"sql_hosts": [],
"replication_hosts": [],
"biha_hosts": [],
"unit_type": "node"
},
{
"id": 2,
"name": "biha_node_2",
"can_be_leader": true,
"can_vote": true,
"priority": -1,
"leader_timeout": 20000,
"mode": "regular",
"repl_pref_roles": "L",
"pg_port": 5432,
"biha_port": 5433,
"max_replicas": 2147483647,
"flw_ro": true,
"config_send_period": 10000,
"watchdog_timeout": 2,
"callbacks_timeout": 10000,
"asyncaction_timeout": 30000,
"manage_slots_xmin": true,
"deny_wal_sources": [],
"biha_listen_addresses": [
{
"address": "biha-db-2",
"port": -1
}
],
"sql_hosts": [],
"replication_hosts": [],
"biha_hosts": [],
"unit_type": "node"
}
],
"unit_type": "segment"
}
],
"unit_type": "segment"
}
}
For more information, refer to Authentication Options, Leader Connection Options, and Network Options.
--format=data_output_formatSpecifies the output format for the configuration information. Possible values are:
json(default),yaml.
cluster status #
Syntax:
bihactl cluster status [--biha-listen-addresses=addresses] [--format=data_output_format] [--magic-file=magic_file] [--magic-string=magic_string] [--pg-port=port] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]]
Checks the node status and displays it in the biha.status_v view.
For more information, refer to Authentication Options, Leader Connection Options, and Network Options.
--format=data_output_formatSpecifies the output format for the status information. Possible values are:
json,yaml, andtable(default).
node add #
Syntax:
bihactl node add [--biha-hosts=hosts] [--biha-listen-addresses=addresses] [--backup-method=backup_method] [--backup-options=backup_options] --biha-node-id=node_id[--biha-port=biha_port] [--can-vote=true_or_false] [--can-be-leader=true_or_false] [--convert-standby [--server-cert=/path/to/server.crt\ --server-key=/path/to/server.key]] [--max-replicas=max_number_of_replicas] [--mode=node_mode] [--referee-with-postgres-db]] [--node-name=node_name] --pgdata=datadir[--pg-port=port] [--preferred-roles=preferred_roles_for_replication] [--priority=node_priority] [--replication-hosts=replication_hosts] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] {--segment-id=segment_id| --segment-name=segment_name} {--use-leader=conn_info| --magic-string=magic_string| --magic-file=magic_file} [--sql-hosts=sql_hosts]
Adds a follower node to the initialized cluster. The command must be executed on the server where you want to host a follower. When this command is executed, a backup of the leader node is created by means of pg_basebackup or pg_probackup. When you add a node, bihactl keeps the replication slot by calling pg_basebackup with the --slot= parameters or pg_probackup with the SLOT_NAME, --wal-method=stream, --checkpoint=fast--stream --slot= parameters, which prevents deletion of WAL on the leader during backup. SLOT_NAME
Note
You must add nodes one by one. Do not add a new node if creation of a previously added node has not been completed yet and the node is in the CSTATE_FORMING state. Otherwise, you may encounter the following error:
WARNING: aborting backup due to backend exiting before pg_backup_stop was
called
The backup utility can be set with the -m option, while the parameters of the selected backup are specified with the -O option.
For more information, refer to Authentication Options, Leader Connection Options, and Network Options.
-mbackup_method--backup-method=#backup_methodSpecifies the backup utility. The allowed values are
pg_basebackup,pg_probackup, andpg_probackup3. The default value ispg_basebackup. If you do not specify the--backup-methodoption, the default backup method is used. Thepg_basebackuputility is the only value that can be used when adding the referee node.-Obackup_options--backup-options=#backup_optionsSpecifies additional backup options depending on the backup utility specified in the
--backup-methodoption.-Inode_id--biha-node-id=#node_idSpecifies the unique ID of the node. The value must be integer and greater than zero.
--can-vote#Determines whether a node is allowed to vote. The default value is
true. If set tofalse, the node cannot vote, as well as cannot stand as a candidate in elections of the new leader.--can-be-leader#Determines the ability of a node to become the leader. The default value is
true. If set tofalse, the node cannot stand as a candidate in elections of the new leader.-c--convert-standby#Converts an existing node to make it a follower node in the high-availability cluster. The node should be a leader node replica prior to the conversion.
--max-replicas=#max_number_of_replicasSpecifies the maximum number of biha replication connections to a node, i.e. the maximum number of walsenders where
application_nameisbiha_node_*.Possible values are:
0,INT_MAX. The default value isINT_MAX, the number of connections is unlimited.-rnode_mode--mode=#node_modeSpecifies the operation mode of the node. The allowed values are as follows:
regular: The node can operate as the leader or as a follower. This is the default value.referee: The node only participates in the leader elections and does not contain any user databases.referee_with_wal: The node participates both in the leader elections in the same way as in therefereemode and receives the entire WAL from the leader node.
By default, the
postgresdatabase is not copied to a node inrefereeorreferee_with_walmodes. To copy thepostgresdatabase to the referee, use the --referee-with-postgres-db option.--node-name=#node_nameSpecifies the follower node name. If not specified, the name is generated automatically as
biha_node_+--biha-node-id. For example, if--biha-node-idis 1, the name isbiha_node_1.-Ddatadir--pgdata=#datadirSpecifies the directory where the database cluster should be stored. If not specified, bihactl uses the
PGDATAvalue.--preferred-roles=#preferred_roles_for_replicationSpecifies the preferred role of a node for replication in a BiHA cluster with cascading replication.
Possible values are: combinations of
L(leader),F(follower), andR(referee). The value must be 1 to 3 symbols long and must not contain repeatable symbols. For example:L,F,LFR, orLF.The default value is
L, meaning that data is replicated from the leader only.--priority=#node_prioritySets the node weight that affects both elections and replication in a cluster, in milliseconds. Possible values are:
0,INT_MAX. The default value is-1, meaning that the parameter is ignored. You can modify this parameter value only by the biha.set_priority function.BiHA uses this configuration parameter for the following purposes:
To set the replication start timeout when selecting the replication source in a BiHA cluster with configured cascading replication. The higher the value, the later the node starts replication and allows connection of nodes with lower priority. The parameter is required for the nodes to establish the cascading replication schema automatically.
To set the node priority in a cluster with synchronous replication. The value determines the timeout that must be reached before the node stands as a candidate in elections. The zero value indicates the highest priority.
Important
To ensure correct operation of this parameter, set the --sync-standbys value one unit less than the total number of cluster nodes.
-R--referee-with-postgres-db#Copies the
postgresdatabase with all the objects to the referee node. You can only use this option when adding a node in therefereeorreferee_with_walmode.--server-cert=#/path/to/server.crtSpecifies the path to the SSL certificate for the BiHA node in the PEM format.
--server-key=#/path/to/server.keySpecifies the path to the private key for the --server-cert certificate in the PEM format.
--segment-id=#segment_idSpecifies the unique identifier of the segment where the node is added to. If you do not specify the segment, the node is added to the default
111segment. You must use either--segment-idor --segment-name to specify the segment.--segment-name=#segment_nameSpecifies the name of the segment where the node is added to. If you do not specify the segment, the node is added to the default
111segment. You must use either--segment-nameor --segment-id to specify the segment.
node set front-follower #
Syntax:
bihactl node set front-follower --id=node_id[--mode=switchover_mode] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] {--magic-string=magic_string| --magic-file=magic_file}
Promotes the node with the specified identifier to the front follower. The promoted node must be located in the follower segment. The command can be executed on any node of a BiHA cluster.
For more information, refer to Authentication Options and Leader Connection Options.
--id=#node_idSpecifies the unique identifier of a node that your want to promote. The node must be located in the follower segment.
--mode=#switchover_modeSpecifies the switchover mode. The following modes are supported:
graceful: The promoted node waits for demotion of the old front follower and, if required, catches up on WAL records. This is the default value.immediate: The switchover occurs immediately, without waiting. The node with the specified ID changes its state directly toFRONT_FOLLOWERskipping theFOLLOWER_OFFEREDstate. In this mode, theLEADER_CHANGE_STARTEDcallback is not called. If the command in theimmediatemode is executed on the current front follower, it immediately starts changing its state toFOLLOWERand broadcasts a message about the leader change to other nodes.Important
The
immediatemode is not safe, using it may lead to data loss. It is recommended to enable automatic synchronization by setting the biha.autorewind configuration parameter totruebefore performing switchover in this mode.
node set leader #
Syntax:
bihactl node set leader --id=node_id[--mode=switchover_mode] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] {--magic-string=magic_string| --magic-file=magic_file}
Promotes the node with the specified identifier to the leader. The promoted node must be located in the leader segment. The command can be executed on any node of a BiHA cluster.
For more information, refer to Authentication Options and Leader Connection Options.
--id=#node_idSpecifies the unique identifier of a node that your want to promote. The node must be located in the leader segment.
--mode=#switchover_modeSpecifies the switchover mode. The following modes are supported:
graceful: The promoted node waits for demotion of the old leader and, if required, catches up on WAL records. This is the default value.immediate: The switchover occurs immediately, without waiting. The node with the specified ID changes its state directly toLEADER_RW/LEADER_ROskipping theFOLLOWER_OFFEREDstate. In this mode, theLEADER_CHANGE_STARTEDcallback is not called. If the command in theimmediatemode is executed on the current leader, it immediately starts changing its state toFOLLOWERand broadcasts a message about the leader change to other nodes.Important
The
immediatemode is not safe, using it may lead to data loss. It is recommended to enable automatic synchronization by setting the biha.autorewind configuration parameter totruebefore performing switchover in this mode.
run #
Syntax:
bihactl runpath/to/script.yml[--sql-output-format=output_format]
Reads a script located at the specified path and executes commands listed in the script. For more information, refer to Section 26.3.14.
-foutput_format--sql-output-format=#output_formatSpecifies the script output format. Possible values:
json,yaml,table(default),csv.
segment add #
Syntax:
bihactl segment add [--id=segment_id] [--minnodes=min_node_num] [--name=segment_name] [--nquorum=quorum_value] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] {--use-leader=conn_info| --magic-string=magic_string| --magic-file=magic_file}
Adds a segment that is used to unite several BiHA cluster nodes located in one data center. The command can be executed on any node of a BiHA cluster.
For more information, refer to Authentication Options and Leader Connection Options.
segment set leader #
Syntax:
bihactl segment set leader --id=segment_id[--mode=switchover_mode] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] {--magic-string=magic_string| --magic-file=magic_file}
Promotes the segment with the specified identifier to the leader segment. The command can be executed on any node of a BiHA cluster.
For more information, refer to Authentication Options and Leader Connection Options.
--id=#segment_idSpecifies the unique identifier of a segment that your want to promote.
--mode=#switchover_modeSpecifies the switchover mode. The following modes are supported:
graceful: The promoted segment waits for demotion of the old leader and, if required, catches up on WAL records. This is the default value.immediate: The switchover occurs immediately, without waiting. The node with the specified ID changes its state directly toLEADER_RW/LEADER_ROskipping theFOLLOWER_OFFEREDstate. In this mode, theLEADER_CHANGE_STARTEDcallback is not called. If the command in theimmediatemode is executed on the current leader, it immediately starts changing its state toFOLLOWERand broadcasts a message about the leader change to other nodes.Important
The
immediatemode is not safe, using it may lead to data loss. It is recommended to enable automatic synchronization by setting the biha.autorewind configuration parameter totruebefore performing switchover in this mode.
unit set leader #
Syntax:
bihactl unit set leader --id=unit_id[--mode=switchover_mode] [--root-cert=/path/to/ca.crt--user-biha-cert=/path/to/client.crt\ --user-biha-key=/path/to/client.key[--biha-ssl-mode=ssl_mode]] {--magic-string=magic_string| --magic-file=magic_file}
Promotes the specified node or segment depending on the identifier provided. The command can be executed on any node of a BiHA cluster. This command is primarily designed for use in automation scripts.
For more information, refer to Authentication Options and Leader Connection Options.
--id=#segment_idSpecifies the unique identifier of a segment that your want to promote.
--mode=#switchover_modeSpecifies the switchover mode. The following modes are supported:
graceful: The promoted segment waits for demotion of the old leader and, if required, catches up on WAL records. This is the default value.immediate: The switchover occurs immediately, without waiting. The node with the specified ID changes its state directly toLEADER_RW/LEADER_ROskipping theFOLLOWER_OFFEREDstate. In this mode, theLEADER_CHANGE_STARTEDcallback is not called. If the command in theimmediatemode is executed on the current leader, it immediately starts changing its state toFOLLOWERand broadcasts a message about the leader change to other nodes.Important
The
immediatemode is not safe, using it may lead to data loss. It is recommended to enable automatic synchronization by setting the biha.autorewind configuration parameter totruebefore performing switchover in this mode.
upgrade start #
Syntax:
bihactl upgrade start [--convert]
[--extra-new-options-gucs -c key=value]
[--extra-shared-libs=shared_libraries]
{--magic-string=magic_string_of_old_leader | --magic-file=magic_file_of_old_leader}
--new-leader-biha-port=new_leader_biha_port
--new-leader-host=new_leader_host
--new-leader-port=new_leader_port
--new-pgdata=new_version_PGDATA_of_leader
--old-bin=/path/to/binaries/of/old/version
--old-pgdata=old_version_PGDATA
[--options=pg_upgrade_options]
[--username=superuser_name]
[--user-cert=/path/to/client.crt --user-key=/path/to/client.key \
[--ssl-mode=ssl_mode]]
[--root-cert=/path/to/ca.crt --user-biha-cert=/path/to/client.crt \
--user-biha-key=/path/to/client.key [--biha-ssl-mode=ssl_mode]]
--subscriber-username=username
Starts major version migration of the BiHA cluster. For more information, refer to Section 26.3.15.1.2.
This command can take the following options:
--convert#Converts the existing follower into the leader node running the new Postgres Pro Standard version. If you specify this option, specifying --new-leader-biha-port, --new-leader-host, and --new-leader-port is not required.
--extra-new-options-gucs -c#key-valueSpecifies a comma-separated list of additional configuration parameters to append to pg_upgrade
--new-options.--extra-shared-libs=#shared_librariesSpecifies shared libraries to be loaded when executing pg_upgrade.
--magic-string=#magic_string_of_old_leaderUses a magic string that contains encoded data to connect to the leader of the old BiHA cluster, i.e. the cluster that needs to be migrated.
--magic-file=#magic_file_of_old_leaderSpecifies the path to a file used to store the magic string with encoded data to connect to the leader of the old BiHA cluster, i.e. the cluster that needs to be migrated.
--new-leader-biha-port=#new_leader_biha_portSpecifies the port of the new leader used to exchange service information between nodes.
--new-leader-host=#new_leader_hostSpecifies the new leader host for incoming connections.
--new-leader-port=#new_leader_portSpecifies the new leader port for incoming connections.
--new-pgdata=#new_version_PGDATA_of_leaderSpecifies the directory where the new cluster leader running the new Postgres Pro Standard version is created as a result of conversion from the follower of the old version. The directory must be empty.
--old-bin=#/path/to/binaries/of/old/versionSpecifies the path to the binaries of the old Postgres Pro Standard version.
--old-pgdata=#old_version_PGDATASpecifies the directory where the follower running the old Postgres Pro Standard version is created. This follower is then upgraded and converted to the new cluster leader running the new Postgres Pro Standard version. The directory must be empty.
-opg_upgrade_options--options=#pg_upgrade_optionsSpecifies additional options of pg_upgrade.
--ssl-mode=#ssl_modeDetermines the SSL authentication policy for --subscriber-username. The following modes are supported:
verify-full(default)requireverify-ca
For more information about modes, see sslmode.
--subscriber-username=#usernameSpecifies the username for the pg_createsubscriber connection. This user must have privileges for creating subscriptions and using
pg_replication_origin_advance().--username=#name_of_bootstrap_superuserSets the user name of the bootstrap superuser. This defaults to the name of the operating-system user running
initdb. Use this option in the following cases:When you initialize a BiHA cluster from scratch and want to set the bootstrap superuser name other than
postgres.When you convert an existing node where the bootstrap superuser name is not
postgres.
Using the
--usernameoption of initdb is not supported.--user-cert=#/path/to/client.crtSpecifies the path to the SSL certificate for --subscriber-username authentication in the PEM format.
--user-key=#/path/to/client.keySpecifies the path to the private key for the --user-cert certificate in the PEM format.
upgrade move #
Syntax:
bihactl upgrade move --new-magic-string=magic_string_of_new_leader--new-pgdata=new_version_PGDATA_of_follower--old-bin=/path/to/binaries/of/old/version--old-pgdata=old_version_PGDATA_of_follower
Moves a follower from the old BiHA cluster to the new BiHA cluster during major version migration. For more information, refer to Section 26.3.15.1.2.
This command can take the following options:
--new-magic-string=#magic_string_of_new_leaderUses a magic string that contains encoded data to connect to the leader of the new BiHA cluster, i.e. the cluster upgraded to the new major version. The magic string is provided as the result of the bihactl upgrade start command.
--new-pgdata=#new_version_PGDATA_of_followerSpecifies the directory where the follower running the new Postgres Pro Standard version is moved. The directory must be empty.
--old-bin=#/path/to/binaries/of/old/versionSpecifies the path to the binaries of the old Postgres Pro Standard version.
--old-pgdata=#old_version_PGDATASpecifies the directory where the follower running the old Postgres Pro Standard version currently locates.
upgrade finish #
Syntax:
bihactl upgrade finish --new-magic-string=magic_string_of_new_leader[--username=superuser_name] [--user-cert=/path/to/client.crt--user-key=/path/to/client.key\ [--ssl-mode=ssl_mode]] --subscriber-username=username
Finishes major version migration of a BiHA cluster. For more information, refer to Section 26.3.15.1.2.
This command can take the following options:
--new-magic-string=#magic_string_of_new_leaderUses a magic string that contains encoded data to connect to the leader of the new BiHA cluster, i.e. the cluster upgraded to the new major version. The magic string is provided as the result of the bihactl upgrade start command.
--ssl-mode=#ssl_modeDetermines the SSL authentication policy for --subscriber-username. The following modes are supported:
verify-full(default)requireverify-ca
For more information about modes, see sslmode.
--subscriber-username=#usernameSpecifies the username for the pg_createsubscriber connection. This user must have privileges for creating subscriptions and using
pg_replication_origin_advance().--username=#name_of_bootstrap_superuserSets the user name of the bootstrap superuser. This defaults to the name of the operating-system user running
initdb. Use this option in the following cases:When you initialize a BiHA cluster from scratch and want to set the bootstrap superuser name other than
postgres.When you convert an existing node where the bootstrap superuser name is not
postgres.
Using the
--usernameoption of initdb is not supported.--user-cert=#/path/to/client.crtSpecifies the path to the SSL certificate for --subscriber-username authentication in the PEM format.
--user-key=#/path/to/client.keySpecifies the path to the private key for the --user-cert certificate in the PEM format.
-v | --version #
Syntax:
bihactl -v bihactl --version
Displays the current version of the bihactl utility.
Authentication Options #
You can use these options with the following commands: bihactl cluster init, bihactl cluster show-config, bihactl cluster status, bihactl node add, bihactl node set front-follower, bihactl node set leader, bihactl segment add, bihactl segment set leader, and bihactl unit set leader.
--biha-ssl-mode=#ssl_modeDetermines the SSL authentication policy for the
biha_replication_userrole. The following modes are supported:verify-full(default)requireverify-ca
For more information about modes, see sslmode.
--root-cert=#/path/to/ca.crtSpecifies the path to the trusted CA certificate in the PEM format.
--server-cert=#/path/to/server.crtSpecifies the path to the SSL certificate for the BiHA node in the PEM format.
--server-key=#/path/to/server.keySpecifies the path to the private key for the --server-cert certificate in the PEM format.
--user-biha-cert=#/path/to/client.crtSpecifies the path to the SSL certificate for the
biha_replication_userrole authentication in the PEM format.--user-biha-key=#/path/to/client.keySpecifies the path to the private key for the --user-biha-cert certificate in the PEM format.
Leader Connection Options #
The --use-leader option is used with bihactl node add and bihactl segment add commands.
The --magic-file and --magic-string options are used with bihactl cluster show-config, bihactl cluster status, bihactl node add, bihactl node set front-follower, bihactl node set leader, bihactl segment add, bihactl segment set leader, and bihactl unit set leader.
-fmagic_file--magic-file=#magic_fileSpecifies the path to a file used to store the magic string with encoded data to connect to the leader node. When this parameter is used with bihactl cluster init command, the generated magic string is saved in the file specified. When used with other commands, the magic string from the file is used to connect to the leader. The file must exist when you execute the commands.
-smagic_string--magic-string=#magic_stringSpecifies the magic string that contains encoded data to connect to the leader node. The magic string is generated in the output of the bihactl cluster init command and looks as follows:
dmVyc2lvbj0xIGhvc3Q9bG9jYWxob3N0IHBvcnQ9NTQzMiBiaWhhLXBvcnQ9NTQzMw==
-lconn_info--use-leader=#conn_infoSpecifies parameters to connect to the leader node in the following format:
host=
leader_hostport=leader_portbiha-port=leader_biha_port
Network Options #
The --biha-listen-addresses and --biha-port options are used with bihactl cluster init, bihactl node add, bihactl cluster show-config, and bihactl cluster status.
The --biha-hosts, --sql-hosts, --replication-hosts, and --pg-port options are used with bihactl cluster init and bihactl node add commands.
--biha-hosts=#hostsUsed by other nodes to connect to the current node by internal control channel (BCP), for example, using a proxy server or a tunnel. If the
biha_hostsvalue is empty, by default, the --biha-listen-addresses value of the current node is used.Possible values: one or several comma-separated addresses in the
hostname:portformat.portis an optional value, if not specified or set to-1, the --biha-port value of the current node is used.For example:
biha-db-1:5433,biha-proxy:8081-Pbiha_port--biha-port=#biha_portSpecifies the port used to exchange service information between nodes. If not specified, the value is set to --pg-port + 1.
--biha-listen-addresses=#addressesDetermines on which addresses listening sockets are open for the internal BCP control channel.
Possible values: one or several comma-separated addresses in the
hostname:portformat.portis an optional value, if not specified or set to-1, the --biha-port value of the current node is used.For example:
biha-db-1:5433,biha-proxy:8081-pport--pg-port=#portSpecifies the node port for incoming connections to Postgres Pro.
If not specified, bihactl uses the default 5432 value.
--replication-hosts=#replication_hostsUsed by other nodes to connect to the current node by replication channel. The --biha-listen-addresses value must include
replication_hosts. If thereplication_hostsvalue is empty, by default, the --biha-listen-addresses value of the current node is used.Possible values: one or several comma-separated addresses in the
hostname:portformat.portis an optional value, if not specified or set to-1, the --biha-port value of the current node is used.The maximum string size is 1024 bytes, otherwise it is ignored.
For example:
biha-db-1:5433,biha-proxy:8081--sql-hosts=#sql_hostsUsed by other nodes to execute SQL queries to the current node. If the
sql_hostsvalue is empty, by default, the --replication-hosts value of the current node is used.Possible values: one or several comma-separated addresses in the
hostname:portformat.portis an optional value, if not specified or set to-1, the --biha-port value of the current node is used.The maximum string size is 1024 bytes, otherwise it is ignored.
For example:
biha-db-1:5433,biha-proxy:8081