hawq init
The hawq init cluster command initializes a HAWQ system and starts it.
Use the hawq init master and hawq init segment commands to individually initialize the master or segment nodes, respectively. Specify any format options at this time. The hawq init standby command initializes a standby master host for a HAWQ system.
Use the hawq init <object> --standby-host option to define the host for a standby at initialization.
Synopsis
hawq init <object> [--options]
hawq init standby | cluster
[--standby-host <address_of_standby_host>]
[<options>]
hawq init -? | --help
where:
<object> = cluster | master | segment | standby
<options> =
[-a] [-l <logfile_directory>] [-q] [-v] [-t]
[-n]
[--locale=<locale>] [--lc-collate=<locale>]
[--lc-ctype=<locale>] [--lc-messages=<locale>]
[--lc-monetary=<locale>] [--lc-numeric=<locale>]
[--lc-time=<locale>]
[--bucket_number <number>]
[--max_connections <number>]
[--shared_buffers <number>]
Description
The hawq init <object> utility creates a HAWQ instance using configuration parameters defined in $GPHOME/etc/hawq-site.xml. Before running this utility, verify that you have installed the HAWQ software on all the hosts in the array.
In a HAWQ DBMS, each database instance (the master and all segments) must be initialized across all of the hosts in the system in a way that allows them to work together as a unified DBMS. The hawq init cluster utility initializes the HAWQ master and each segment instance, and configures the system as a whole. When hawq init cluster is run, the cluster comes online automatically without needing to explicitly start it. You can start a single node cluster without any user-defined changes to the default hawq-site.xml file. For larger clusters, use the template-hawq-site.xml file to specify the configuration.
To use the template for initializing a new cluster configuration, replace the items contained within the % markers. For example, replace value%master.host%value and %master.host% with the master host name. After modification, rename the file to the name of the default configuration file: hawq-site.xml.
- Before initializing HAWQ, set the
$GPHOMEenvironment variable to point to the location of your HAWQ installation on the master host and exchange SSH keys between all host addresses in the array, usinghawq ssh-exkeys. To initialize and start a HAWQ cluster, enter the following command on the master host:
$ hawq init cluster
This utility performs the following tasks:
- Verifies that the parameters in the configuration file are correct.
- Ensures that a connection can be established to each host address. If a host address cannot be reached, the utility will exit.
- Verifies the locale settings.
- Initializes the master instance.
- Initializes the standby master instance (if specified).
- Initializes the segment instances.
- Configures the HAWQ system and checks for errors.
- Starts the HAWQ system.
The hawq init standby utility can be run on either the currently active primary master host or on the standby node.
hawq init standby performs the following steps:
- Updates the HAWQ system catalog to add the new standby master host information
- Edits the
pg_hba.conffile of the HAWQ master to allow access from the newly added standby master. - Sets up the standby master instance on the alternate master host
- Starts the synchronization process
A backup, standby master host serves as a ‘warm standby’ in the event of the primary master host becoming non-operational. The standby master is kept up to date by transaction log replication processes (the walsender and walreceiver), which run on the primary master and standby master hosts and keep the data between the primary and standby master hosts synchronized. To add a standby master to the system, use the command hawq init standby, for example: init standby host09. To configure the standby hostname at initialization without needing to run hawq config by defining it, use the –standby-host option. To create the standby above, you would specify hawq init standby --standby-host=host09 or hawq init cluster --standby-host=host09.
If the primary master fails, the log replication process is shut down. Run the hawq activate standby utility to activate the standby master in its place; upon activation of the standby master, the replicated logs are used to reconstruct the state of the master host at the time of the last successfully committed transaction.
Objects
Options
~/hawq/AdminLogs.LC_ALL, LC_COLLATE, or LANG environment variable of the master host determines the locale. If these are not set, the default locale is C (POSIX). A locale identifier consists of a language identifier and a region identifier, and optionally a character set encoding. For example, sv_SE is Swedish as spoken in Sweden, en_US is U.S. English, and fr_CA is French Canadian. If more than one character set can be useful for a locale, then the specifications look like this: en_US.UTF-8 (locale specification and character set encoding). On most systems, the command locale will show the locale environment settings and locale -a will show a list of all available locales.--locale, but sets the locale used for collation (sorting data). The sort order cannot be changed after HAWQ is initialized, so it is important to choose a collation locale that is compatible with the character set encodings that you plan to use for your data. There is a special collation name of C or POSIX (byte-order sorting as opposed to dictionary-order sorting). The C collation can be used with any character encoding.--locale, but sets the locale used for character classification (what character sequences are valid and how they are interpreted). This cannot be changed after HAWQ is initialized, so it is important to choose a character classification locale that is compatible with the data you plan to store in HAWQ.--locale, but sets the locale used for messages output by HAWQ. The current version of HAWQ does not support multiple locales for output messages (all messages are in English), so changing this setting will not have any effect.--locale, but sets the locale used for formatting currency amounts.--locale, but sets the locale used for formatting numbers.--locale, but sets the locale used for formatting dates and times.default_hash_table_bucket_number, which sets the default number of hash buckets for creating virtual segments. This parameter overrides the default value of default_hash_table_bucket_number set in hawq-site.xml by an Ambari install. If not specified, hawq init will use the value in hawq-site.xml.Examples
Initialize a HAWQ array with an optional standby master host:
$ hawq init standby