Configure Grafana to read data from RisingWave
Grafana is an open-source analytics and visualization web application. It is well suited for time-series data as well as application and server monitoring.
This guide will go over how to add RisingWave as a data source in Grafana.
Prerequisites
Install and launch RisingWave
To install and start RisingWave locally, see the Get started guide. We recommend running RisingWave locally for testing purposes.
Connect to streaming sources. For details on connecting to a streaming source and what connectors are supported with RisingWave, see CREATE SOURCE.
Install and launch Grafana
To install Grafana locally, see the Install Grafana guide. Next, to start Grafana, follow the Sign in to Grafana step of the Build your first dashboard guide.
Establish a connection between RisingWave and Grafana
Add RisingWave as a data source
- Go to Configuration > Data source.
- Click the Add data source button.
- Select PostgreSQL from the list of supported databases.
- Fill in the PostgreSQL Connection fields like so:
NOTE
If both RisingWave and Grafana are started locally, the host domain can be either localhost:4566 or 127.0.0.1:4566.
If you are running Grafana Cloud, the host domain should be your computer’s public IP address.
- Click Save & test.
For this guide, we connected to RisingWave with the root
user. In production, it is recommended to use a dedicated read-only user when querying the database using Grafana.
To add a new read-only user, use the following SQL query:
Then, when adding RisingWave as a database, fill in the User and Password fields with the name and password of the new user created. For more details on creating a user, see the CREATE USER command.
To allow the read-only user to query from a materialized view, use the following SQL query:
See the GRANT command for more details.
Now that RisingWave is added as a database, you can start creating dashboards within Grafana using the data in RisingWave. For an extensive tutorial that covers how to create dashboards in Grafana with data queried from RisingWave, check out the Use RisingWave to monitor RisingWave metrics tutorial, which uses a demo cluster so you can easily try it out on your device.