HAWQ Client Applications
HAWQ is pre-installed with a number of client utility applications. You can also run client applications in your HAWQ deployment that were created using standard ODBC/JDBC Application Interfaces.
Alternatively, you may want to provide access to your HAWQ master node from a Linux client outside of your HAWQ cluster. One option to enable this access is to install the full HAWQ binary on the client node. A second option is to create a minimal
psql client package from an existing HAWQ installation which you could then install on a non-HAWQ client. Refer to HAWQ psql Client Package for instructions on creating, installing, and running such a package.
HAWQ is installed with a number of client utility applications. These applications are located in the
$GPHOME/bin directory of your HAWQ master host installation. The following client utility applications are the most commonly used:
||create a new database|
||define a new procedural language|
||define a new database role|
||remove a database|
||remove a procedural language|
||remove a role|
||PostgreSQL interactive terminal|
||reindex a database|
||garbage-collect and analyze a database|
When using these client applications, you must connect to a database through the HAWQ master instance. You will need to know the name of your target database, the host name and port number of the master, and what database user name to connect as. This information can be provided on the command-line using the options
-U respectively. If an argument is found that does not belong to any option, it will be interpreted as the database name first.
All of these options have default values which will be used if the option is not specified. The default host is the local host. The default port number is 5432. The default user name is your OS system user name, as is the default database name. Note that OS user names and HAWQ user names are not necessarily the same.
If the default values are not correct, you can set the environment variables
PGUSER to the appropriate values, or use a
~/.pgpass file to contain frequently-used passwords.
You may choose to provide
psql access to your HAWQ master node from a non-HAWQ Linux client. This section describes the procedures for creating, installing, and running a minimal HAWQ
psql client package.
Perform the following steps to create a HAWQ Linux
psql client package:
Log in to a HAWQ node and set up your HAWQ environment:
$ ssh gpadmin@<hawq-node> gpadmin@hawq-node$ . /usr/local/hawq/greenplum_path.sh
Note: You can create the client package on any node on which HAWQ is installed.
Create working directories:
gpadmin@hawq-node$ mkdir hawqclient gpadmin@hawq-node$ cd hawqclient gpadmin@hawq-node$ export HAWQCLIENTWORKDIR=`pwd` gpadmin@hawq-node$ mkdir bin gpadmin@hawq-node$ mkdir lib
Copy the HAWQ
psqlclient binary and libraries to the appropriate work directories:
gpadmin@hawq-node$ cp $GPHOME/bin/psql $HAWQCLIENTWORKDIR/bin/ gpadmin@hawq-node$ cp -d $GPHOME/lib/libpq.* $HAWQCLIENTWORKDIR/lib/
Generate a runtime environment file for the HAWQ client package:
gpadmin@hawq-node$ echo 'HAWQ_CLIENT=`pwd` export PATH=$HAWQ_CLIENT/bin:$PATH export LD_LIBRARY_PATH=$HAWQ_CLIENT/lib:$LD_LIBRARY_PATH' > ./hawq_client_env.sh
$LD_LIBRARY_PATHappropriately for a HAWQ client runtime environment.
Tar and compress the HAWQ client package:
gpadmin@hawq-node$ cd $HAWQCLIENTWORKDIR/../ gpadmin@hawq-node$ tar czvf hawqclient.tar.gz ./hawqclient
These commands create a
hawqclient.tar.gzfile in the current directory.
Perform the following procedure to install the HAWQ
psql client package you created in the previous section on a like Linux-based system:
Log in to the client system and create or navigate to the directory in which you want to install the HAWQ client:
$ ssh <user>@<client> user@client$ cd <install-dir> user@client$ export HAWQCLIENTINSTDIR=`pwd`
Make note of the base HAWQ client install directory, you will need this path to run the client.
Add the HAWQ client install directory setting to your
.bash_profileor similar shell login script:
Substitute the full path to your HAWQ client install directory for
Copy the HAWQ client package you created previously to the client system:
user@client$ scp gpadmin@hawq-node:/<dir>/hawqclient.tar.gz .
Extract the package:
user@client$ tar xzf hawqclient.tar.gz
This command extracts the HAWQ client to
user@client$ rm hawqclient.tar.gz
Perform the following procedure to run a previously-installed HAWQ
psql client package.
Note: If you have enabled Kerberos user authentication for HAWQ, refer to Kerberos Considerations for Non-HAWQ Clients for additional client configuration requirements.
Source the HAWQ client environment file (recall the HAWQ client install directory you noted in the previous section):
user@client$ . $HAWQCLIENTINSTDIR/hawqclient/hawq_client_env.sh
hawq_client_env.shsets up the HAWQ client runtime environment, including setting your
$LD_LIBRARY_PATHto locate the
psqlclient binaries and libraries.
.bash_profileor other shell initialization file to source
hawq_client_env.shon login. For example, add:
psqlclient. Since the HAWQ master is running on another node, you must identify the HAWQ master hostname. You may also be required to provide the HAWQ master port number if the process is not running on the HAWQ default port. Provide these values via environment variables or on the command line:
user@client$ PGHOST=<master-host> PGPORT=<master-port> psql -d <database-name>
user@client$ psql -d <database-name> -h <master-host> -p <master-port>