Skip to content

Commit 34bf272

Browse files
committed
Add user create
1 parent a7e4355 commit 34bf272

File tree

1 file changed

+44
-21
lines changed

1 file changed

+44
-21
lines changed

samples/speedystore/README.md

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ The diagram below, taken from the [SingleStore documentation](https://docs.singl
1515
![Overview of SingleStore Monitoring Process ](images/cluster_monitoring_hl_architecture-mfjdOm.webp)
1616

1717
### Overview of Process
18-
* SingleStore
19-
* Configure the SingleStore pipeline and metrics database
20-
* Configure the "monitoring user"
21-
* Grafana
22-
* Configure the Grafana Datasource
23-
* Import the SingleStore Dashboards into Grafana
18+
* Configure SingleStore
19+
* Create the SingleStore pipeline and metrics database
20+
* Create the "S2MonitorUser"
21+
* Configure Grafana
22+
* Create the Datasource
23+
* Import the SingleStore Dashboards
2424

25-
### Configure the SingleStore pipeline and metrics database
25+
### Create the SingleStore pipeline and metrics database
2626

2727
The SingleStore Toolbox is used to deploy, administer, and manage a SingleStore cluster. We will use the `sdb-admin start-monitoring-kube` command to configure and start the monitoring. It has a number of flags to control its operations. See the [SingleStore documentation](https://docs.singlestore.com/db/v8.9/reference/singlestore-tools-reference/sdb-admin-commands/start-monitoring-kube/) for more information.
2828

29-
3029
To configure and start the monitoring, including the metrics database, we will (eventually) submit the following command:
3130

3231
`sdb-admin start-monitoring-kube --cluster-name sas-singlestore-cluster --namespace $VIYA_NS --user root --password $ROOT_PWD --exporter-host $CLUSTER_MASTER_IP`
@@ -49,11 +48,11 @@ The default name for the SingleStore cluster in a SAS SpeedyStore deployment is:
4948
If the cluster name is different than the default, be sure to use the correct value in subsequent commands.
5049

5150
#### The `user` and `password` parameters
52-
A core part of the monitoring is the exporter process which collects the metric data from the cluster. The exporter process is typically run as the SingleStore 'root' user due to the permissions required. In addition, we will need the password for the SingleStore 'root' user.
51+
A core part of the monitoring is the exporter process which collects the metric data from the cluster. The exporter process is typically run as the SingleStore 'root' user due to the permissions required.
5352

5453
NOTE: It is possible to run the process as another user but the user must have the low level permissions needed to create and control the metrics database and pipelines. Setting up an alternate user is out-of-scope for this sample and we will use the 'root' user.
5554

56-
You can use the following command to get the password for the 'root' user:
55+
In addition, we will need the password for the SingleStore 'root' user. You can use the following command to get the password for the 'root' user:
5756

5857
`ROOT_PWD=$(kubectl -n ${VIYA_NS} get secret sas-singlestore-cluster -o yaml | grep "ROOT_PASSWORD"|awk '{print $2}'|base64 -d --wrap=0)`
5958

@@ -64,29 +63,52 @@ You can obtain the IP address for the Master node by submitting the following co
6463

6564
`CLUSTER_MASTER_IP=$(kubectl -n ${VIYA_NS} get pods -o wide | grep 'node-sas-singlestore-cluster-master-0' | awk '{print $6}')`
6665

66+
#### Disabling interactive mode
67+
By default, the `sdb-admin start-monitoring-kube` command will display some information and ask the user if they would like to continue. To skip this prompt and have the configuration continue automatically, we will incle the `--yes` parameter.
68+
6769
#### Accessing the Kubernetess Cluster
68-
The `sb-admin` command needs to access the Kubernetes cluster on which SAS Viya and SingleStore are running. It does this through a Kubernetes configuration file. By default, the command will use the file identified in the `KUBECONFIG` environment variable or the `~/.kube/config` file are used to discover the cluster. Alternatively, the `--config-file` option can be used to specify the kube config.
70+
The `sb-admin` command needs to access the Kubernetes cluster on which SAS Viya and SingleStore are running. It does this through a Kubernetes configuration file. By default, the command will use the file identified in the `KUBECONFIG` environment variable or the `~/.kube/config` file are used to discover the cluster. Alternatively, the `--config-file` option can be used to specify the kube config file.
6971

7072
#### Run the `sb-admin start-monitoring-kube` command
7173
After setting all of the required parameters, submit the following command to configure and start the monitoring, including the metrics database:
7274

73-
`sdb-admin start-monitoring-kube --cluster-name sas-singlestore-cluster --namespace $VIYA_NS --user root --password $ROOT_PWD --exporter-host $CLUSTER_MASTER_IP`
75+
`sdb-admin start-monitoring-kube --cluster-name sas-singlestore-cluster --namespace $VIYA_NS --user root --password $ROOT_PWD --exporter-host $CLUSTER_MASTER_IP --yes`
76+
77+
After running the command, you should see output similar to the following:
78+
79+
```
80+
✓ Successfully discovered resources
81+
Toolbox will perform the following actions:
82+
· create a database metrics with tables and procedures for monitoring
83+
· set retention period to 7 days for 192.168.0.164:9104
84+
· set purge frequency to 60 minutes for 192.168.0.164:9104
85+
· set purge log retention period to 365 days
86+
87+
Would you like to continue? [Y/n]:
88+
Automatically selected yes, non-interactive mode enabled
89+
90+
Operation completed successfully
91+
```
7492

75-
After running the command, the exporter process, the pipeline and the metrics database are created. To confirm this, you can use the SingleStore Studio. For example, in the screenshot below, you can see the newly created **'metrics'** database:
93+
Once completed, the exporter process, the pipeline and the metrics database have been created. To confirm this, you can use the SingleStore Studio. For example, in the screenshot below, you can see the newly created **'metrics'** database:
7694
![Screenshot showing SingleStore Studio with the 'metrics' database highlighted](images/02_MG_202508_metrics-database.png)
7795

78-
### Configure the "monitoring user"
79-
Grafana will need to connect to the 'metrics' database and you should create a specific user to be used for that purpose. While the permissions required by this user to pull metrics from the database are fairly limited, it can be helpful to grant additional permissions so the user can be used to manage the metrics database, pipelines and the exporter process.
96+
### Create the "S2MonitorUser"
97+
You need to create a specific user that Grafana can use to connect to the 'metrics' database. While the permissions required by this user to pull metrics from the database are fairly limited, it can be helpful to grant additional permissions so this same user can be used to manage the metrics database, pipelines and the exporter process.
8098

81-
For example, you might grant the following permissions:
99+
After logging into SingleStore with the admin user, you can submit `CREATE USER` and `GRANT` commands to create the user and grant the user the desired permissions.
82100

83-
`GRANT CLUSTER, SHOW METADATA, SELECT, PROCESS ON *.* to '{S2MonitorUser}'@'%';`
101+
For example, the following command creates a user called `S2MonitorUser` and assigns it a password:
84102

85-
`GRANT SELECT, CREATE, INSERT, UPDATE, DELETE, EXECUTE, INDEX, ALTER, DROP, CREATE DATABASE, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, CREATE PIPELINE, DROP PIPELINE, ALTER PIPELINE, START PIPELINE, SHOW PIPELINE ON metrics.* to '{S2MonitorUser}'@'%';`
103+
`CREATE USER S2MonitorUser IDENTIFIED BY 'password123' REQUIRE NONE;`
86104

87-
Alternatively, you might GRANT the "monitoring user" minimal permissions, and create a second user ("monitoring administrator") to manage the metrics database, pipelines and the exporter process.
105+
Then you might grant the following permissions:
106+
107+
`GRANT CLUSTER, SHOW METADATA, SELECT, PROCESS ON *.* to 'S2MonitorUser'@'%';`
88108

89-
|**TO DO: Where do you submit those commands? SingleStore CLI?**
109+
`GRANT SELECT, CREATE, INSERT, UPDATE, DELETE, EXECUTE, INDEX, ALTER, DROP, CREATE DATABASE, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, CREATE PIPELINE, DROP PIPELINE, ALTER PIPELINE, START PIPELINE, SHOW PIPELINE ON metrics.* to 'S2MonitorUser'@'%';`
110+
111+
Alternatively, you might GRANT the "monitoring user" minimal permissions, and create a second user ("monitoring administrator") to manage the metrics database, pipelines and the exporter process.
90112

91113
|**TO DO: Does the first GRANT statement only grant the _minimal_ permissions needed to pull metirics? And the 2nd grants the extended permissions needed to be an administrator?**
92114

@@ -105,6 +127,8 @@ to:
105127

106128
`url: svc-sas-singlestore-cluster-ddl.myviya.svc.cluster.local:3306`
107129

130+
|**TO DO**: Is the service-name always _name_of_singlestore_cluster_ + "-dll"
131+
108132
If the name of the SingleStore cluster is not ***sas-singlestore-cluster***, you will need to update that portion of the ***url*** field in the file as well.
109133

110134
Copy the file to some location, update the necessary information and save your changes. We suggest copying the file into your `$USER_DIR/monitoring` sub-directory, i.e. the same directory used for any other customizations related to the metric monitoring components you have made to your deployment of SAS Viya Monitoring.
@@ -119,7 +143,6 @@ You can use the following command to apply the necessary label:
119143

120144
`kubectl -n $VIYA_NS label secret grafana-metrics-connection "grafana_datasource=1"`
121145

122-
|**TO DO**: Is the service-name always _name_of_singlestore_cluster_ + "-dll"
123146

124147
### Import the SingleStore Dashboards into Grafana
125148
To import the SingleStore dashboards into Grafana, you can use the `deploy_dashboards.sh` script found in the `monitoring/bin` sub-directory of this repository.

0 commit comments

Comments
 (0)