SingleStore DB

Configure the Connection

The Studio State File (studio.hcl) is a text file that stores the list of clusters known to Studio. This file can be modified to also provide the location of your monitoring data.

For package-based deployments on SingleStore DB, this file resides in /var/lib/memsql-studio/studio.hcl by default. For tarball-based deployment, it resides in state/studio.hcl.

See an example state file.

Local Monitoring Database
  1. On the host where Studio is installed, locate the studio.hcl state file.

  2. To configure the monitoring database’s location associated with your cluster, locate the newly added information in the state file under monitoring and add the following settings.

Setting

Description

Default

Requirements

isLocal

Dictates whether the monitoring database lives in the same cluster or a different cluster. If false, you must specify the host and port.

Default: true

Required

hostname

The hostname of the master aggregator of your metrics cluster.

Default: n/a

Only required if isLocal = False

port

The port of the Master Aggregator of your metrics cluster.

Default: n/a

Only required if isLocal = False

reuseCredentials

Dictates whether the same credentials should be used to access the source and metrics cluster. If false, you must specify username and password.

Default: true

Required

username

The username to login to your metrics cluster.

Default: n/a

Only required if reuseCredentials = false

password

The password to login to your metrics cluster.

Default: n/a

Only required if reuseCredentials = false

monitoringDatabaseName

The database name that holds your monitoring data.

Default: metrics

Required

monitoringClusterName

If your metrics database is holding multiple clusters’ monitoring information, you can differentiate the cluster data you want to surface in Studio. This name must match the variable cluster_name in the SingleStore DB engine.

Default: memsql_cluster

Only required if you have multiple source clusters’ data in your metrics database, or if cluster_name is different than the default.

For example, the following state file uses a portion of the above settings to demonstrate how to use the same credentials for a local metrics database as the Source.

studio.hcl

version = 1

cluster "localhost" {
  name                = localhost
  description         = ""
  hostname            = "127.0.0.1"
  port                = 3306
  profile             = "DEVELOPMENT"
  websocket           = false 
  monitoring          = {
    isLocal = true
    reuseCredentials = true
    monitoringDatabaseName = "metrics" 
  }
} 
Remote Monitoring Database

You must update the flag isLocal to false to connect your Studio instance to a remote monitoring database associated with a given cluster. Additionally, you must provide hostname and port information about where your monitoring database is located.

Below is an example state file that demonstrates how to add a hostname and a port when specifying a non-local monitoring database.

version = 1

cluster "localhost" {
  name                = localhost
  description         = ""
  hostname            = "127.0.0.1"
  port                = 3306
  profile             = "DEVELOPMENT"
  websocket           = false 
  monitoring          = {
    isLocal = false
    hostname = “127.0.0.1”
    port = 1000
    reuseCredentials = true
    monitoringDatabaseName = "metrics" 
  }
}
More Configuration Options

Whether you have a remote or local monitoring database, Studio can be configured to use different credentials to access your monitoring data.

Studio attempts to reuse credentials by default, assuming that your source cluster (monitored cluster) has the same credentials as your metrics database or cluster (monitoring cluster).

To use different credentials to access the monitoring data, set reuseCredentials to false. Additionally, you must provide those credentials by specifying the following settings. See Additional Connection Examples for more information.

Restart Studio

Once the studio.hcl file has been configured, restart Studio.

sudo systemctl restart singlestoredb-studio
Confirm the Connection

In Studio, navigate to the Activity Resource Usage Page in the left-hand column and confirm that data from the last hour is displayed. If so, your connection is correctly configured.