Setting Up Greenplum Command Center

Installing and enabling Greenplum Command Center

Installing and enabling Greenplum Command Center is a two-step process. 

1.  First you must create the Greenplum Command Center database and enable Greenplum Command Center data collection agents within your Greenplum system.

 

2.  After data collection is enabled, the next (optional) step is to install and configure the Greenplum Command Center Console (the Web application used to view the Command Center data stored in Greenplum Database).

The Greenplum Database software version of Greenplum Command Center Console is shipped separately from your Greenplum Database installation. Download the installer file from the EMC Download Center. Installer files are available for RedHat 64-bit or SuSE Linux 64 bit platforms.

The Greenplum Data Computing Appliance (DCA) version of the Greenplum Command Center is already installed on the appliance. EMC Services will work with you to further configure Command Center for your enviroment.

Enabling the Command Center Data Collection Agents

This section describes how to create the Command Center database and enable the Command Center data collection agents. When the data collection agents are enabled, their processes are started and stopped along with the Greenplum Database server processes (using gpstart and gpstop).

Greenplum provides a gpperfmon_install utility that performs the following tasks:

Install the Command Center database and enable Command Center agents

1.Log in to the Greenplum master host as the gpadmin user.

$ su - gpadmin

2.Run the gpperfmon_install utility with the --enable option. You must supply the connection port of the Greenplum Database master server process, and set the password for the gpmon superuser that will be created. For example:

$ gpperfmon_install --enable --password p@$$word --port 5432

3.When the utility completes, restart Greenplum Database server. The data collection agents will not start until the database is restarted:

$ gpstop -r

4.Using the ps command, verify that the data collection process is running on the Greenplum master. For example:

$ ps -ef | grep gpmmon

5.Run the following command to verify that the data collection processes are writing to the Command Center database. If all of the segment data collection agents are running, you should see one row per segment host.

$ psql gpperfmon -c 'SELECT * FROM system_now;'

The data collection agents are now running, and your Greenplum system now has a gpperfmon database installed. This is the database where Command Center data is stored. You can connect to it as follows:

$ psql gpperfmon

To configure a standby master host (if enabled)

6.Copy the $MASTER_DATA_DIRECTORY/pg_hba.conf file from your primary master host to your standby master host. This ensures that the required connection options are also set on the standby master.

7.Copy your ~/.pgpass file from your primary master host to your standby master host. This file usually resides in the gpadmin user’s home directory.

Installing the Greenplum Command Center Console

The Command Center Console provides a graphical interface for viewing performance data and for administering certain aspects of your Greenplum system. Normally installed on the Greenplum master host, the console is a web-based user interface accessed through a supported browser.

The Command Center Console is typically installed on the Greenplum Database master host. However, you have the option to install the console on a host different from the master host. Note that this setup incurs a performance penalty due to the numerous database connections the console must open over the network.

If you have multiple Greenplum Database instances, you can create separate Command Center Console instances for each of them. Each separate console instance operates on a unique port and has its own unique configuration options.

The Command Center Console supports for any browsers that have Adobe Flash 9.0 or higher enabled. For example, the following browsers are supported:

The Command Center Console runs on a lighttpd web server. The default web server port is 28080.

Installing the Command Center Console involves the following high-level tasks:

Install the Command Center Console

If you are installing the Command Center Console on a remote system (that is, not the same system on which you installed Greenplum Database), you must also install Greenplum Database installation binary files on the remote system. After installing the binary files, source greenplum_path.sh, then perform the Console installation steps described below. Note that you do not need to initiate the database. 

1.Download the installer file from the EMC Download Center. Installer files are available for RedHat 64-bit, Solaris 64-bit or SuSE Linux 64 bit platforms.

You do not need to download the installer file if you are installing the console on an EMC Data Computing Appliance; the installer file is already loaded on DCAs.

2.Unzip the installer file where PLATFORM is either RHEL5-x86_64 (RedHat 64-bit), SOL-x86_64 (Solaris 64-bit), or SuSE10-x86_64 (SuSe Linux 64-bit). For example:

# unzip greenplum-cc-web-versionx.x-PLATFORM.zip

3.Launch the installer using bash. For example:

# /bin/bash greenplum-cc-web-versionx.x-PLATFORM.bin

4.Type yes to accept the license agreement.

5.The installer will prompt you to provide an installation path. Press ENTER to accept the default install path:

(/usr/local/greenplum-cc-web-versionx.x)

or enter an absolute path to an install location. You must have write permissions to the location you specify. This location is referred to as $GPPERFMONHOME.

6.If you ran the installer as root, change the ownership of the Console installation directory to the gpadmin user. For example:

# chown -R gpadmin /usr/local/greenplum-cc-web-versionx.x

7.The installation directory contains a gpperfmon_path.sh file with path and environment settings for the Console. You must source this file in your gpadmin user’s startup shell profile (such as .bashrc).

For example, you could add a line similar to the following to your chosen profile files:

source /usr/local/greenplum-cc-web-versionx.x/ \ gpperfmon_path.sh

After editing the chosen profile file, source it as the correct user to make the changes active. For example:

$ source ~/.bashrc

8.Configure the Console

Setting up the Command Center Console

The gpcmdr utility sets up the Command Center Console on the current host. On hosts other than the Greenplum master host, the console experiences slower performance due to frequent connections to the gpperfmon database.

During the setup process, the utility prompts you for values to configure Console connections to a single Greenplum Database instance. To configure connections to multiple Greenplum Database instances, run the setup routine multiple times. To accept the displayed default values for any of these parameters at configuration time, hit the ENTER key.

Set up the Greenplum Command Center Console

1.Log in as the Greenplum administrator (gpadmin).

2.With the Greenplum Database instance running, launch the setup utility. For example:

$ gpcmdr --setup

3.Provide an instance name for the Greenplum Database instance monitored by this Console. To monitor multiple instances, you must run the setup utility separately for each instance.

4.Select y or n to specify if the Greenplum Database master for this instance is on a remote host. Note that Console performance is better when the Console and Greenplum Database master are on the same host.

If the master host is remote, enter y and enter the hostname of the master at the prompt.

Note: Verify that you can connect to the master host from the host on which you are installing the Command Center Console. Enter:

psql -h master_host_name -p port -U gpmon

Note: If you cannot establish a connection, make sure you create a .pgpass file on the host running the Command Center Console as described in “Configuring Authentication for the Command Center Console” .

5.Provide a display name for the instance. This name is shown in the Console user interface. This prompt does not appear if the master host is remote.

6.Provide the port for the Greenplum Database master instance.

7.Provide a port number for the Command Center Console web server. The default is 28080.

8.(Optional) Enter y or n to set up SSL connections for the Command Center Console. If you enter Y, you are prompted for the following distinguished name (DN) information used to create an unsigned certificate for the Command Center Console. For example:

Country Name (2 letter code) [GB]:US

State or Province Name (full name) [Berkshire]:California

Locality Name (eg, city) [Newbury]:San Mateo

Organization Name (eg, company) [My Company Ltd]:Greenplum

Organizational Unit Name (eg, section) []:Engineering

Common Name (eg, your name or your server's hostname) []:mdw1

Email Address []:gpadmin@greenplum.com

Note: Because database login information is sent over the network, Greenplum recommends using SSL to encrypt these communications.

9.Start and log into the Console. See “Connecting to the Greenplum Command Center Console”.

You can also configure authentication so that other Greenplum users can log into the Console, as described in “Configuring Authentication for the Command Center Console”.

Connecting to the Greenplum Command Center Console

Start the Greenplum Command Center Console by entering:

gpcmdr --start

If you do not specify an instance name, all Command Center Console instances are started. To start a particular instance, you can specify the name of the instance. For example:

gpcmdr --start "instance_name"

After the instance is running, you can open the Command Center Console in a supported browser using the correct hostname and port. For example, to open a Command Center instance running on port 28080 on the local host with SSL, use the following web address:

If connecting to a Command Center instance using SSL on port 28080, enter:

At the login prompt, enter the user name and password of a Greenplum role that has been properly configured to allow authentication to Greenplum Command Center (for example, gpmon), then click Login. This opens the Dashboard page of the Command Center Console, which provides a graphical system snapshot and a summary view of active queries. See the Command Center Console online help for more information.

You must be a Greenplum administrator to fully use the Greenplum Command Center Console. Administrators can view information for all queries as well as system metrics, while regular database users can only monitor their own queries.

Configuring Authentication for the Command Center Console

When you installed Greenplum Command Center database and enabled the data collection agents, a gpmon superuser was created by the installation utility. This is the Greenplum role used to manage the Command Center components and data within the Greenplum environment. The gpmon role is configured to use md5-encrypted password authentication to connect to the Greenplum Database instance.

Typically, you will not be connecting to the Command Center Console as gpmon, and instead connect as another Greenplum user. The Command Center Console is configured by default to require md5-encrypted password authentication, so make sure the Greenplum role has an md5-encrypted password set.

Note: If you are using Greenplum Database version 4.2.1 or higher, you have the option of using SHA-256-encrypted password authentication.

Any Greenplum Database users with appropriate privileges can access Command Center. See the Greenplum Database Administrator Guide for information about creating database users and roles.

Using Trust Authentication

You can bypass password authentication by using trust authentication. Trust authentication allows Greenplum users to login to the Command Center Console without authenticating, and is recommended only for testing purposes. It should not be used in production Greenplum environments. Greenplum recommends using password authentication with SSL for production installations.

To allow trust access

1.Set allow_trust_logon to yes in the gpperfmonui.conf file (Greenplum Command Center configuration file) located in:

$GPPERFMONHOME/instances/instance_name/conf

where instance_name is the name of the instance that you specified when you ran gpperfmon --setup.

2.Edit $MASTER_DATA_DIRECTORY/pg_hba.conf to specify trust authentication for connections made by any role to the gpperfmon database. For example:

host gpperfmon all 0.0.0.0/0 trust

3.Use gpstop to reload the pg_hba.conf file:

$ gpstop -u

Using SSL Encryption

If you enable SSL at setup time, the installer creates a self-signed certificate and uses OpenSSL encryption for all connections to the Command Center web server.

Because this is a self-signed certificate, supported browsers may need to be configured to accept or allow it as a security exception. This does not detract from the added security gained from encrypting communications between the browser client and the web server.

Optionally, you can obtain and use a certificate signed by a trusted certificate authority such as Verisign. If you use a trusted certificate, edit the lighttpd.conf file (located in $GPPERFMONHOME/instances/instance_name/conf), and set the ssl.pemfile to point to the location of the certificate. For example:

ssl.pemfile = "$GPPERFMONHOME/instances/instance_name/conf/cert.pem"

For more information on the lighttpd.conf file, see “Web Server Administration” .

Setting up the Command Center Console on a Standby Master

1.Install the Command Center Console software on the standby master host using the same instructions in “Installing the Greenplum Command Center Console” .

2.Set up a new Command Center Console instance on the standby master host using the instructions in “Setting up the Command Center Console” . 

During the setup process, make sure to specify the following options specific to the standby master:

3.If you fail over to your standby master host, the data collection agents are restarted automatically upon activation of the standby. However, you must manually start the Command Center Console using gpcmdr --start.

About the Command Center Installation

The installation and setup procedures create a software installation directory and a directory containing files and folders to support each Greenplum Command Center Console instance.

Software Installation Directory

The following files and first-level subdirectories are copied into the installation folder that you specified when you installed Greenplum Command Center Console. This location is referred to as $GPPERFMONHOME.

Instances Directory

The $GPPERFMONHOME/instances directory contains subdirectories named for each instance created during console setup. The conf subdirectory contains configuration files that you can edit. Other files and folders are used by the web services for the instance, and should not be modified or deleted.

Each subdirectory contains the following files and first-level subdirectories:

Querying the Command Center Database

Greenplum Command Center database stores system, query, health, disk space, and dial-home data collected by Command Center agents that run on the master host and each segment (either Hadoop or database) host. This information provides immediate visibility into key areas affecting database performance, and is typically accessed through the Greenplum Command Center Console.

However, you can also use direct SQL queries and views on Command Center data. Before performing any of the tasks in this section, make sure the Greenplum Command Center is completely installed and configured, as described in “Installing the Greenplum Command Center Console” , and “Setting up the Command Center Console” Section.

Viewing Historical System Metrics using SQL

Historical tables in the Command Center database store all system data collected by Command Center. You can analyze this data to identify trends in the performance of the Greenplum system over time.

With a default quantum setting of 15 seconds, Command Center collects very large amounts of historical system data. To view meaningful groupings of system data records, you can view the data by selected time intervals with a SQL view (as described below).

The following provides an example SQL view for viewing aggregated system metrics. In this example view named system_metrics_aggregate_1min, rows of system metrics from system_history are averaged over one-minute intervals and aggregated across all segments in the array:

DROP VIEW IF EXISTS system_metrics_aggregate_1min;

CREATE VIEW system_metrics_aggregate_1min AS (

SELECT date_trunc('minute', ctime) AS sample_time, hostname, avg(mem_total) AS mem_total,

avg(mem_used) AS mem_used,

avg(mem_actual_used) AS mem_actual_used,

avg(mem_actual_free) AS mem_actual_free,

avg(swap_total) AS swap_total, avg(swap_used) AS swap_used, avg(swap_page_in) AS swap_page_in,

avg(swap_page_out) AS swap_page_out,

avg(cpu_user) AS cpu_user, avg(cpu_sys) AS cpu_sys, avg(cpu_idle) AS cpu_idle,

avg(load0) AS load0, avg(load1) AS load1,

avg(load2) AS load2,

Querying the Command Center Database 17

Greenplum Command Center Administrator Guide 1.2 – Chapter 2: Setting Up Greenplum Command Center

avg(disk_ro_rate) AS disk_ro_rate,

avg(disk_wo_rate) AS disk_wo_rate,

avg(disk_rb_rate) AS disk_rb_rate,

avg(disk_wb_rate) AS disk_wb_rate,

avg(net_rp_rate) AS net_rp_rate,

avg(net_wp_rate) AS net_wp_rate,

avg(net_rb_rate) AS net_rb_rate,

avg(net_wb_rate) AS net_wb_rate

FROM system_history

GROUP BY hostname, sample_time

);

To change the interval for averaging results, adjust the value specified for date_trunc. Valid values are microseconds, milliseconds, second, minute, hour, day, week, month, quarter, year, decade, century and millennium.

Note: You use can also the Command Center Console to view historical system metrics. See the Command Center Console online help for more information.

Viewing Historical Query Metrics using SQL

Historical tables in the Command Center database store all query and iterator data collected by Command Center. You can analyze this data to identify trends in the performance of Greenplum system over time.

Calculating the average, minimum and maximum values for system-wide query statistics aggregated over time can yield a useful view of database utilization. The following information provides an example SQL view for viewing query statistics in this way.

In this example view named database_metrics_1hour, rows of statistics from the table database_history are averaged over hour-long intervals:

DROP VIEW if exists database_metrics_1hour;

CREATE VIEW database_metrics_1hour AS (

SELECT date_trunc('hour', ctime) AS sample_time, avg(queries_total) AS queries_total,

min(queries_total) AS queries_total_min,

max(queries_total) AS queries_total_max, avg(queries_running) AS queries_running, min(queries_running) AS queries_running_min, max(queries_running) AS queries_running_max, avg(queries_queued) AS queries_queued,

min(queries_queued) AS queries_queued_min, max(queries_queued) AS queries_queued_max

FROM database_history

GROUP BY sample_time );

To change the interval for averaging results, adjust the value specified for date_trunc. Valid values are microseconds, milliseconds, second, minute, hour, day, week, month, quarter, year, decade, century and millennium.

Note: You use can also the Command Center Console to view historical query metrics. See the Command Center Console online help for more information.

Uninstalling Greenplum Command Center

To uninstall, you must stop both the Command Center Console and disable the Command Center data collection agents. Optionally, you may also want to remove any data associated with Greenplum Command Center by removing your Command Center Console installation and the Command Center database.

To uninstall the Command Center Console

1.Stop Command Center Console if it is currently running. For example:

$ gpcmdr --stop

2.Remove the Command Center installation directory. For example:

$ rm -rf /usr/local/greenplum-cc-web-version

To disable the Command Center Agents

3.Remove or comment out the gpmon entries in pg_hba.conf. For example:

#local gpperfmon gpmon md5

#host gpperfmon gpmon 0.0.0.0/0 md5

4.Drop the Command Center superuser role from the database. For example:

$ psql template1 -c 'DROP ROLE gpmon;'

5.Restart the Greenplum Database instance:

$ gpstop -r

6.Clean up any uncommitted Command Center data and log files that reside on the master file system:

$ rm $MASTER_DATA_DIRECTORY/gpperfmon/data/*

$ rm $MASTER_DATA_DIRECTORY/gpperfmon/logs/*

7.If you do not want to keep your historical Command Center data, drop the gpperfmon database:

$ dropdb gpperfmon