Enabling Workload Management in Greenplum Command Center

Enable Resource Groups in Greenplum Database

To use Greenplum Command Center workloads, you must first configure Greenplum Database to use resource groups (instead of resource queues, the default) to manage database resources.

This is a one-time configuration task for the Greenplum Database administrator.

  1. Enable cgroups (control groups) in the Linux operating system and add a cgroup configuration for Greenplum Database. See the “Prerequisite” section of Using Resource Groups in the Greenplum Database Administrator Guide.

  2. Enable resource groups in Greenplum Database by setting the gp_resource_manager server configuration parameter to "group".

    $ gpconfig -s gp_resource_manager
    $ gpconfig -c gp_resource_manager -v 'group'
    
  3. Restart the Greenplum Database system.

    $ gpstop
    $ gpstart
    

Enable Workload Management in Greenplum Command Center

After you have enabled resource groups in Greenplum Database, you can enable Workload Management in Greenplum Command Center.

  1. Log in to Greenplum Command Center as a user with admin permission and choose Admin> Workload Mgmt.

  2. Click the Enable Workloads button.

When you click Enable Workloads Greeplum Command Center performs the following steps:

  • Creates the gp_wlm extension in Greenplum Database.
  • Creates the Workload Manager user table and user-defined functions in the postgres database.
  • Enables managing workloads in the Greenplum Command Center user interface.

Once the extension is enabled, at the start of a transaction in any current or future database session, Greenplum Database calls into the workload management extension to evaluate assignment filters to determine the resource group. If no assignment filter is matched, the transaction is assigned to the current database users’ resource group.

Future Greenplum Command Center releases will allow you to create and manage resource groups and assignment conditions in the Command Center user interface. Until then, you create workload assignment filters by editing the JSON document the Workload Manager extension uses to assign transactions to workloads.

See Creating Workload Assignment Filters for instructions to create workload assignment filters in Greenplum Command Center.

Troubleshooting Workload Management

If you experience problems with workloads in Greenplum Command Center, review the following list to ensure prerequisites are met and all of the dependencies are properly configured.

  • Red Hat 6.x and 7.x and CentOS 6.x and 7.x are currently supported.
  • You must be running Greenplum Database version 5.7.0 or later.
  • Configure the Linux cgroups kernel feature on your hosts by following the instructions at “Prerequisite” in Using Resource Groups.
  • Make sure the /etc/cgconfig.d/gpdb.conf file contains three objects: perm, cpu, and cpuacct. If the document is incorrect and the gp_resource_manager configuration parameter is set to "group", Greenplum Database can hang at startup.

    group gpdb {
      perm {
        task {
          uid = gpadmin;
          gid = gpadmin;
        }
        admin {
          uid = gpadmin;
          gid = gpadmin;
        }
      }
      cpu {
      }
      cpuacct {
      }
    }
    
  • On Red Hat 7, make sure you run cgconfigparser -L /etc/cgconfig.d to parse changes to the /etc/cgconfig.d/gpdb.conf file. This command must also be set up to run at boot time.

  • Set the Greenplum Database gp_resource_manager server configuration parameter to "group".

    $ gpconfig -c gp_resource_manager -v "group"
    

    Verify by showing the value of the parameter:

    $ gpconfig -s gp_resource_manager
    Values on all segments are consistent
    GUC          : gp_resource_manager
    Master  value: group
    Segment value: group
    
  • After installing a Pivotal Greenplum Database distribution, the shared_preload_libraries configuration parameter contains the metrics collector and workload manager extension shared libraries. Make sure these libraries are still present:

    $ gpconfig -s shared_preload_libraries
    Values on all segments are consistent
    GUC          : shared_preload_libraries
    Master  value: $libdir/metrics_collector,$libdir/gp_wlm
    Segment value: $libdir/metrics_collector,$libdir/gp_wlm
    

    Check that the shared libraries exist at $GPHOME/lib/postgresql/metrics_collector.so and $GPHOME/lib/postgresql/gp_wlm.so. If the libraries do not exist, make sure you have installed the Pivotal Greenplum Database distribution. These extensions are not available in the Greenplum Database Open Source version.

    If the shared library files exist in the $GPHOME/lib/postgresql directory, but not in the shared_preload_libraries parameter, add them with the gpconfig command:

    $ gpconfig -c shared_preload_libraries -v '\$libdir/metrics_collector,\$libdir/gp_wlm'
    

    Note that adding the libraries to the shared_preload_libraries parameter does not enable the metrics_collector or gp_wlm extensions, but is a prerequisite for enabling them.

  • The gpmon user must be able to connect to databases from the Command Center host. Make sure to add a host entry like the following in the $MASTER_DATA_DIRECTORY/pg_hba.conf file.

    host   all   gpmon   <IP_of_host>/32   md5
    
  • Check whether the gp_wlm extension is installed. The extension is added when you click Enable Workloads in the Greenplum Command Center Admin> Workload Mgmt view.

    $ psql postgres
    \dx  
    postgres=# \dx
                       List of installed extensions
      Name  | Version | Schema |             Description
    --------+---------+--------+--------------------------------------
     gp_wlm | 0.1     | gpcc   | Greenplum Workload Manager Extension
    
  • Make sure the gpcc.workload_config table and functions are present in the postgres database:

    $ psql postgres
    postgres=# \d gpcc.*
      Table "gpcc.workload_config"
      Column  |  Type   | Modifiers
    ----------+---------+-----------
     dist_col | integer |
     config   | json    |
    Distributed by: (dist_col)
    postgres=# \df gpcc.*
        List of functions
     Schema |        Name         | Result data type | Argument data types  |  Type
    --------+---------------------+------------------+----------------------+-------
     gpcc   | get_workload_config | json             |                      | normal
     gpcc   | set_workload_config | boolean          | wlm_json_config json | normal
     (2 rows)
    

    If the gpcc.workload_config table or the functions are not present, dropping and recreating the gp_wlm extension will create them. Note that any assignment rules saved in the gpcc.workload_config table will have to be recreated in Command Center.

    $ psql postgres
    postgres=# DROP EXTENSION gp_wlm;
    DROP EXTENSION
    postgres=# CREATE EXTENSION gp_wlm;
    CREATE EXTENSION