gpaddmirrors
Adds mirror segments to a Apache Cloudberry system that was initially configured without mirroring.
Synopsis
gpaddmirrors [-p <port_offset>] [-m <datadir_config_file> [-a]] [-s]
[-d <coordinator_data_directory>] [-b <segment_batch_size>] [-B <batch_size>] [-l <logfile_directory>]
[-v] [--hba-hostnames <boolean>]
gpaddmirrors -i <mirror_config_file> [-a] [-d <coordinator_data_directory>]
[-b <segment_batch_size>] [-B <batch_size>] [-l <logfile_directory>] [-v]
gpaddmirrors -o output_sample_mirror_config> [-s] [-m <datadir_config_file>]
gpaddmirrors -?
gpaddmirrors --version
Description
The gpaddmirrors
utility configures mirror segment instances for an existing Apache Cloudberry system that was initially configured with primary segment instances only. The utility will create the mirror instances and begin the online replication process between the primary and mirror segment instances. Once all mirrors are synchronized with their primaries, your Apache Cloudberry system is fully data redundant.
Important During the online replication process, Apache Cloudberry should be in a quiescent state, workloads and other queries should not be running.
By default, the utility will prompt you for the file system location(s) where it will create the mirror segment data directories. If you do not want to be prompted, you can pass in a file containing the file system locations using the -m
option.
The mirror locations and ports must be different than your primary segment data locations and ports.
The utility creates a unique data directory for each mirror segment instance in the specified location using the predefined naming convention. There must be the same number of file system locations declared for mirror segment instances as for primary segment instances. It is OK to specify the same directory name multiple times if you want your mirror data directories created in the same location, or you can enter a different data location for each mirror. Enter the absolute path. For example:
Enter mirror segment data directory location 1 of 2 > /gpdb/mirror
Enter mirror segment data directory location 2 of 2 > /gpdb/mirror
OR
Enter mirror segment data directory location 1 of 2 > /gpdb/m1
Enter mirror segment data directory location 2 of 2 > /gpdb/m2
Alternatively, you can run the gpaddmirrors
utility and supply a detailed configuration file using the -i
option. This is useful if you want your mirror segments on a completely different set of hosts than your primary segments. The format of the mirror configuration file is:
<contentID>|<address>|<port>|<data_dir>
Where <contentID>
is the segment instance content ID, <address>
is the host name or IP address of the segment host, <port>
is the communication port, and <data_dir>
is the segment instance data directory.
For example:
0|sdw1-1|60000|/gpdata/m1/gp0
1|sdw1-1|60001|/gpdata/m2/gp1
The gp_segment_configuration
system catalog table can help you determine your current primary segment configuration so that you can plan your mirror segment configuration. For example, run the following query:
=# SELECT dbid, content, address as host_address, port, datadir
FROM gp_segment_configuration
ORDER BY dbid;
If you are creating mirrors on alternate mirror hosts, the new mirror segment hosts must be pre-installed with the Apache Cloudberry software and configured exactly the same as the existing primary segment hosts.
You must make sure that the user who runs gpaddmirrors
(the gpadmin
user) has permissions to write to the data directory locations specified. You may want to create these directories on the segment hosts and chown
them to the appropriate user before running gpaddmirrors
.
Note This utility uses secure shell (SSH) connections between systems to perform its tasks. In large Apache Cloudberry deployments, cloud deployments, or deployments with a large number of segments per host, this utility may exceed the host's maximum threshold for unauthenticated connections. Consider updating the SSH
MaxStartups
configuration parameter to increase this threshold. For more information about SSH configuration options, refer to the SSH documentation for your Linux distribution.