Connect Data Visualization Tools
After configuring the metrics
database, you can connect data visualization tools such as Grafana to your cluster’s monitoring data. Grafana provides dashboards for advanced analytics and troubleshooting.
Note
If you may monitor multiple Source clusters, make sure to name each Source cluster to identify the cluster in the visualization tool. The Source cluster name can be set using the cluster_name
sync variable. (For more information, see Sync Variables Lists.) To perform this action, connect to the Master aggregator of the Source cluster and run the following SQL command: SET GLOBAL cluster_name='source_cluster_name';
Alternatively, you can run the following Toolbox command on a host where Toolbox is set up to manage the Source cluster: sdb-admin update-config --key cluster_name --value 'source_cluster_name'
Configure Grafana
Note: If you already have Grafana installed, you may skip to Add the Grafana Monitoring Data Source.
Install Grafana
If a Grafana instance is not already available, install the latest version of Grafana on the collecting Master Aggregator host.
Add the Grafana Monitoring Data Source
Note
For those SingleStoreDB instances that don’t run database queries as root
, this requires both admin privileges and SELECT
and EXECUTE
grants to the metrics
database as per GRANT.
For example:
GRANT SELECT, EXECUTE ON metrics.* TO <user>@%;
where <user>
is the user other than root
under which these queries will be run.
Connect to Grafana at
http://<grafana-hostname>:3000
and log in usingadmin
as the username andadmin
as the password.Add a “monitoring” MySQL data source with the following settings. The SingleStoreDB data source port is
3306
by default.Data source name:
monitoring
Data source type:
mysql
Data source host:
<metrics-cluster-master-aggregator-host>
Data source port:
3306
Database name:
metrics
User:
root
Password:
<secure-password-or-blank-if-none>
Alternatively, edit the
sample.yaml
file in the/etc/grafana/provisioning/datasources
directory and add the following content, substituting the values in angle brackets with your SingleStoreDB configuration.# # config file version apiVersion: 1 datasources: - name: monitoring type: mysql url: <metrics-cluster-master-aggregator-host>:<port> database: metrics user: root password: <secure-password-or-blank-if-none> isDefault: true version: 1
Restart the Grafana server.
sudo systemctl restart grafana-server
Connect the Grafana Dashboards
Note
You may need Editor privileges to create new Grafana dashboards.
Download the cluster monitoring dashboards from SingleStore.
Import the dashboards into Grafana. To import a dashboard, click the
+
icon in the side menu, and then click Import. From here you can upload a dashboard JSON file, paste a Grafana.com dashboard URL, or paste dashboard JSON text directly into the text area.Alternatively, edit the
sample.yaml
file in the/etc/grafana/provisioning/dashboards/
directory and add the following content.# # config file version apiVersion: 1 providers: - name: 'default' orgId: 1 folder: '' folderUid: '' type: file options: path: /var/lib/grafana/dashboards
Next, copy the dashboard JSON files to the
/var/lib/grafana/dashboards
directory and ensure that the dashboards are owned bygrafana:grafana
(viachown grafana:grafana *
).Restart the Grafana server.
sudo systemctl restart grafana-server
View Monitoring Data from Multiple Clusters (Optional)
You can view monitoring data from multiple source clusters in a single Grafana instance using the following steps:
Ensure that all cluster monitoring data is stored in a single database (on the
metrics
cluster). This will allow a single Grafana datasource to be configured.On each source cluster, enable the exporter process.
On the
metrics
cluster, run sdb-admin start-monitoring for each source cluster and store the monitoring data in the same database.Name each Source cluster to allow Grafana to identify the cluster. For more information, see Note.
Use the cluster tab in the Grafana UI to toggle between monitoring data from each source cluster.