This topic describes how to connect to AnalyticDB for PostgreSQL in Grafana to perform visual analytics.
Prerequisites
You have purchased an AnalyticDB for PostgreSQL instance and the instance contains data. For more information, see Product Overview.
You have created a Grafana service. You can quickly create a Grafana service on Alibaba Cloud. For more information, see Quickly get started with Managed Service for Grafana.
Procedure
Grafana 9.x
-
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
On the Workspace Management page, click the name of the target workspace to open the Workspace Information page.
In the Basic Information section, copy the Public IP address of Grafana and add it to the whitelist of the AnalyticDB for PostgreSQL instance. This allows Grafana to access the AnalyticDB for PostgreSQL instance. For more information, see Configure a whitelist.
On the Workspace Management page, click the URL in the Endpoint URL column for the target workspace to open Grafana.
NoteTo log on to Grafana, use the Admin account and the password that you set when you created the workspace.
In the navigation pane on the left, click the
icon.On the Configuration page, click Add data source. In the search box, search for and click PostgreSQL. Then, enter the connection information. The following table describes the parameters.
Parameter
Description
Name
The name of the data source.
Host
The endpoint of the AnalyticDB for PostgreSQL instance. The format is
<host>:<port>. For example,gp-bp10vkbe1x1v3h****-master.gpdb.rds.aliyuncs.com:5432.Database
The name of the AnalyticDB for PostgreSQL database.
User
The database account of AnalyticDB for PostgreSQL.
Password
The password of the AnalyticDB for PostgreSQL database account.
TLS/SSL Mode
Select disable, or configure this parameter as needed.
Version
Set the PostgreSQL version to 9.4.
More parameters
For more information about other parameters, see the open source Grafana documentation.
At the bottom of the page, click Save & Test.
NoteIf the message
Database Connection OKappears, the connection is successful.You can perform data analytics in Grafana. For more information about data analytics, see the open source Grafana documentation.
Grafana 10.x
-
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
On the Workspace Management page, click the name of the target workspace to open the Workspace Information page.
In the Basic Information section, copy the Public IP address of Grafana and add it to the whitelist of the AnalyticDB for PostgreSQL instance. This allows Grafana to access the AnalyticDB for PostgreSQL instance. For more information, see Configure a whitelist.
On the Workspace Management page, click the URL in the Endpoint URL column for the target workspace to open Grafana.
NoteTo log on to Grafana, use the Admin account and the password that you set when you created the workspace.
On the Grafana home page, click the
icon in the upper-left corner.In the navigation pane on the left, click Connections, and then click Add new connection.
In the search box, search for and click PostgreSQL.
On the PostgreSQL page, on the Overview tab, click Create a PostgreSQL data source and enter the connection information. The following table describes the parameters.
Parameter
Description
Name
The name of the data source.
Host
The endpoint of the AnalyticDB for PostgreSQL instance. The format is
<host>:<port>. For example,gp-bp10vkbe1x1v3h****-master.gpdb.rds.aliyuncs.com:5432.Database
The name of the AnalyticDB for PostgreSQL database.
User
The database account of AnalyticDB for PostgreSQL.
Password
The password of the AnalyticDB for PostgreSQL database account.
TLS/SSL Mode
Select disable, or configure this parameter as needed.
Version
Set the PostgreSQL version to 9.4.
More parameters
For more information about other parameters, see the open source Grafana documentation.
At the bottom of the page, click Save & Test.
NoteIf the message
Database Connection OKappears, the connection is successful.You can perform data analytics in Grafana. For more information about data analytics, see the open source Grafana documentation.