Creating the gpperfmon Database

This topic describes how to create the gpperfmon database and enable the gpperfmon data collection agents. This task must be completed one time for the Greenplum Database system, before you install Greenplum Command Center.

When the data collection agents are enabled, their processes are started and stopped (using gpstart and gpstop) on the Greenplum segment hosts along with the Greenplum Database server processes.

Greenplum Database includes a gpperfmon_install utility that performs the following tasks:

  • Creates the Command Center database (gpperfmon).
  • Creates the Command Center superuser role (gpmon).
  • Configures Greenplum Database server to accept connections from the gpmon role (edits the pg_hba.conf and .pgpass files).
  • Sets the Command Center server configuration parameters in the Greenplum Database server postgresql.conf files.

The gpperfmon_install utility and the agents are part of the Greenplum Database software. The tasks in this topic can be performed before or after the Command Center software is installed.

Install the gpperfmon Database

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

    $ su - gpadmin
  2. Source the path file from the Greenplum Database installation directory:

    $ source /usr/local/greenplum-db/
  3. 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 changeme --port 5432

    The password you specify is saved in a .pgpass file in the gpadmin user’s home directory. See Changing the gpmon Password for steps to change the gpmon password.

  4. Restart Greenplum Database server. The gpperfmon data collection agents do not start until the database is restarted.

    $ gpstop -r
  5. Using the ps command, verify that the data collection process is running on the Greenplum master. For example:

    $ ps -ef | grep gpmmon
  6. Run the following command to verify that the gpmon user can authenticate and 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 -U gpmon gpperfmon -c 'SELECT * FROM system_now;'

The data collection agents are now running, and your Greenplum system now has a gpperfmon database installed. You can connect to it as follows:

$ psql gpperfmon

gpmon role Authentication

The gpperfmon_install utility adds entries for the gpmon role to the pg_hba.conf file, which allows the gpmon role to make a local connection to any database in the Greenplum cluster on the master host.

local    gpperfmon   gpmon         md5
host     all         gpmon    md5
host     all         gpmon         ::1/128         md5

These entries provide the gpmon role sufficient access to maintain query history in the gpperfmon database. For Greenplum Command Center, the gpmon user must also have host access from the host where the Command Center web server and backend run. This requires that you add an entry for the Command Center host.

  1. Edit the pg_hba.conf file.

    # vi $MASTER_DATA_DIRECTORY/pg_hba.conf
  2. Add the following line to allow the gpmon role to access the gpperfmon database from all hosts in the Greenplum Database cluster. Substitute the IP address of the master host for <cc-host-ip>.

    host     all         gpmon        <cc-host-ip>/32    md5

See Changing the gpmon Password for steps to change the gpmon user’s password.

Configuring a Standby Master Host (if enabled)

  1. Copy the $MASTER_DATA_DIRECTORY/pg_hba.conf file from your primary master host to the same directory on your standby master host. This ensures that the required connection options are also set on the standby master.
  2. Copy the .pgpass file from the gpadmin user’s home directory on your primary master host to the same directory on your standby master host. Set the permissions on the .pgpass file to 600 (for example: chmod 0600 ~/.pgpass).