Configure Monitoring with Toolbox

Note

Using Toolbox to configure cluster monitoring is the preferred and default method. Toolbox largely automates the monitoring configuration by using standard metrics database and pipeline DDLs and predefined values. To customize these DDLs and values, you may configure monitoring manually by using SQL.

Enable the Exporter Process

The memsql-exporter process (or simply “the exporter”) collects data about a running cluster.

Set the Exporter User

The exporter is typically owned by the database root user. To start the exporter as a database user other than root, run the following SQL statements and specify the desired database user for <exporter-user> and this user's password for <secure-password>.

Note: The database user that starts the exporter process can differ from the database user that starts the monitoring process.

CREATE USER '<exporter-user>' IDENTIFIED BY '<secure-password>';
GRANT CLUSTER, SHOW METADATA, SELECT, PROCESS ON *.* to '<exporter-user>'@'%';

Start the Exporter Process

Perform the following steps on the Source cluster's Master Aggregator.

Note that the exporter process is restarted when the exporter_port variable is set to any non-zero value, including the current value. The exporter_port variable can be set by running sdb-admin configure-monitoring --exporter-port <port>.

Run either of the following to start the exporter. This command starts the exporter using the specified database user and default port (9104). The exporter username and password are used to access the Source cluster. Refer to sdb-admin configure-monitoring for more information.

Note: If starting the exporter as a database user other than root, substitute the database user for root in the --exporter-user option and this user’s password for <secure-password> in the --exporter-password option.

HTTP Connections

On the Source cluster’s Master Aggregator, run the following command to start the exporter.

sdb-admin configure-monitoring \
--exporter-user root \
--exporter-password <secure-password>

HTTPS Connections

  1. Copy the server certificate and key to the Master Aggregator host of the Source cluster. This certificate will be used by the exporter process and must be readable by the user under which the nodes are running on the host (typically the memsql user).

  2. On the Source cluster's Master Aggregator, run the following command to start the exporter.

    sdb-admin configure-monitoring \
    --exporter-user root \
    --exporter-password <secure-password> \
    --exporter-use-https \
    --exporter-ssl-cert=/path/to/server-cert.pem \
    --exporter-ssl-key=/path/to/server-key.pem \
    --exporter-ssl-passphrase=<passphrase>

    Note: The --exporter-ssl-passphrase option should only be included if the server key has a passphrase.

    Refer to configure-monitoring for additional options, including --exporter-user and --exporter-password.

Stop the Exporter

You may stop the exporter at any time by running the following command on the Source cluster's Master Aggregator.

sdb-admin configure-monitoring --stop-exporter

Configure the metrics Database

The monitoring process configures the metrics database and starts monitoring the cluster.

Set the Monitoring User

Monitoring is typically owned by the database root user. To start monitoring as a database user other than root, run the following SQL statements and specify the desired database user for <monitoring-user> and this user's password for <secure-password>.

Note: The database user that starts the monitoring process can differ from the database user that starts the exporter process.

CREATE USER '<monitoring-user>' IDENTIFIED BY '<secure-password>';
GRANT SELECT, CREATE, INSERT, UPDATE, DELETE, EXECUTE, INDEX, ALTER, DROP, CREATE DATABASE, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE ON metrics.* to '<monitoring-user>'@'%';
GRANT CREATE PIPELINE, DROP PIPELINE, ALTER PIPELINE, START PIPELINE, SHOW PIPELINE ON metrics.* to '<monitoring-user>'@'%';

Start the Monitoring Process

The monitoring process configures the metrics database and starts monitoring the cluster.

The following command creates a database named metrics with a 10-day retention period for the data, and also creates the associated metrics and blobs pipelines. These pipelines are responsible for extracting data from the exporter and storing it in the metrics database.

The exporter-host value must be the Master Aggregator host in the Source cluster. The user and password are the credentials for the Metrics cluster. The variable retention-period defines the number of days that data is retained before being deleted. Refer to sdb-admin start-monitoring for more information.

Please note the following:

  • The database that is created to store monitoring data is named metrics by default. You may change the database name by updating the value of the --database-name option.

  • The IP address provided in the exporter-host argument must be resolvable by all hosts in the cluster. If the cluster you are monitoring has hosts that contain leaf nodes (as is common in a multi-host vs. single-host deployment), do not use localhost. Instead, provide the explicit IP address or hostname that the other hosts in the cluster can resolve.

  • This command must be run on the Metrics cluster.

  • By default, data from a Source cluster is collected every minute. This interval can be changed via the --batch-interval option in the sdb-admin start-monitoring command.

Note

For Metrics clusters running SingleStore 7.3.12 and earlier that are managed by Toolbox 1.11.7 and earlier, when a new Source cluster is monitored, the specified --retention-period applies to all existing Source clusters.

For Metrics clusters running SingleStore 7.3.13 and later that are managed with Toolbox 1.11.8 and later, a unique --retention-period can be specified for each Source cluster. Therefore, when a new Source cluster is monitored, the specified --retention-period only applies to that Source cluster.

Note: If starting the monitoring process as a database user other than root, substitute the database user for root in the --user option and this user’s password for <secure-password> in the --password option.

HTTP Connections

Run the following command to start monitoring.

sdb-admin start-monitoring \
--database-name metrics \
--exporter-host <exporter-hostname-or-IP-address> \
--user root \
--password <secure-password> \
--retention-period 10

HTTPS Connections

  1. Copy the CA certificate to the same file path on each host of the Metrics cluster.

    Alternatively, a directory containing multiple CA certificates can be provided, and this path must be the same on all hosts. This directory will be used by the monitoring pipelines and must be readable by the user under which the nodes are running on the host (typically the memsql user).

  2. Run the following command to start monitoring.

    sdb-admin start-monitoring \
    --database-name metrics \
    --exporter-host <exporter-hostname-or-IP-address> \
    --user root \
    --password <secure-password> \
    --retention-period 10 \
    --ssl-ca /path/to/ca-cert.pem --or--
    --ssl-capath /ca-directory/including/path

    Refer to start-monitoring for additional options.

Stop the Monitoring Process

You may stop the monitoring process at any time by running the following command.

Note: If stopping the monitoring process as a database user other than root, substitute the database user for root in the --user option and this user’s password for <secure-password> in the --password option.

sdb-admin stop-monitoring \
--exporter-host <exporter-hostname-or-IP-address> \
--user root \
--password <secure-password>

Last modified: September 13, 2024

Was this article helpful?