hawq init

The hawq init cluster command initializes a HAWQ system and starts it.

The master or segment nodes can be individually initialized by using hawq init master and hawq init segment commands, respectively. The hawq init standby command initializes a standby master host for a HAWQ system.

The hawq init object --standby-host= option allows defining the host for a standby at initialization.

Synopsis

hawq init object [--options]
hawq init object   
        
            [--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]
            [standby | cluster --standby-host address_of_standby_host 
            [-a] [-l logfile_directory] [-q] [-v] [-t] 
[-n] 
hawq init -? --help

Description

The hawq init <object> utility will create a HAWQ instance using configuration parameters defined in $GPHOME/etc/hawq-site.xml. Before running this utility, make sure 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 such a way that they can all work together as a unified DBMS. The hawq init cluster utility takes care of initializing the HAWQ master and each segment instance, and configuring the system as a whole. When hawq init cluster is run, the cluster comes online automatically without needing to explicitly start it. A single node cluster can be started without any user-defined changes to the default hawq-site.xml file. The template-hawq-site.xml file is used to specify the configuration for larger clusters.

To use the template for initializing a new cluster configuration, replace the items contained within the % markers, for example in: value%master.host%value, %master.host% would be replaced with the master host name. After modification, rename the file to the name of the default configuration file: hawq-site.xml.

Before running hawq-site.xml, you must 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.

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 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 hawq init standby host09. You can configure the standby hostname at initialization without needing to run hawq config by defining it using 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, and the standby master can be activated in its place by using the hawq activate standby utility. 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 ~/hawq/AdminLogs.

-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 250.

–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