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.
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
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:
CREATE USER grafanareader WITH PASSWORD 'password';
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:
GRANT SELECT ON MATERIALIZED VIEW mv_name TO grafanareader;
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.