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 $GPHOME environment 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, using hawq 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.conf file 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

cluster
Start a HAWQ cluster.

master
Start HAWQ master.

segment
Start a local segment node.

standby
Start a HAWQ standby master.

Options

-a, (do not prompt)
Do not prompt the user for confirmation.

-l, --logdir <logfile_directory>
The directory to write the log file. Defaults to ~/hawqAdminLogs.

-q, --quiet (no screen output)
Run in quiet mode. Command output is not displayed on the screen, but is still written to the log file.

-v, --verbose
Displays detailed status, progress and error messages and writes them to the log files.

-t, --timeout
Sets timeout value in seconds. The default is 60 seconds.

-n, --no-update
Resync the standby with the master, but do not update system catalog tables.

--locale=<locale>
Sets the default locale used by HAWQ. If not specified, the 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.

--lc-collate=<locale>
Similar to --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.

--lc-ctype=<locale>
Similar to --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.

--lc-messages=<locale>
Similar to --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.

--lc-monetary=<locale>
Similar to --locale, but sets the locale used for formatting currency amounts.

--lc-numeric=<locale>
Similar to --locale, but sets the locale used for formatting numbers.

--lc-time=<locale>
Similar to --locale, but sets the locale used for formatting dates and times.

--bucket_number=<number>
Sets value of 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.

--max_connections=<number>
Sets the number of client connections allowed to the master. The default is 1280. Segment connections can be modified at a later time. For more information, see Configuring Client Authentication.

--shared_buffers <number>
Sets the number of shared_buffers to be used when initializing HAWQ.

-s, --standby-host <name_of_standby_host>
Adds a standby host name to hawq-site.xml and syncs it to all the nodes. If a standby host name was already defined in hawq-site.xml, using this option will overwrite the existing value.

-?, --help
Displays the online help.

Examples

Initialize a HAWQ array with an optional standby master host:

$ hawq init standby