This document describes how to use a client other than psql to connect to YMatrix and query. Two ways of high availability and non-high availability connection will be given.
The high availability mentioned in this article refers to YMatrix's [automatic failure transfer mechanism] (/doc/5.1/maintain/crash_recover). After the master node (Master) fails, the master node standby node (Standby) provides services to the outside.
High Availability Connection refers to the program automatically connecting to the node after the failover after YMatrix fails.
High Available Connection Strings (Connection URLs/DSN) provides a standardized format that can be used in different applications without re-entering the complete connection information.
It usually consists of multiple fields, each representing different connection information, for example:
postgres://username:password@master_ip:master_port,standby_ip:standby_port/database
in:
username
and password
are the username and password for logging in to the database, respectively.master_ip:master_port
and standby_ip:standby_port
are the connection information for Master and Standby.database
represents the name of the database to be connected.Click the link in the table to download and install the DBeaver Community Edition or DBeaver Enterprise Edition installation package.
| Operating System | CPU Architecture | Client Version |
|--|--|--|--|
| Mac | x86_64 | 23.0.2 |
| Mac | AArch64 | 23.0.2 |
| Linux
Linux(nojdk) | x86_64 | 23.0.2 |
| Linux(nojdk) | AArch64 | 23.0.2 |
| Windows | x86_64 | 23.0.2 |
| Operating System | CPU Architecture | Client Version | |--|--|--|--| | Mac | x86_64 | 24.0 | | Mac | AArch64 | 24.0 | | Linux | x86_64 | 24.0 | | Windows | x86_64 | 24.0 |
The documentation example installation environment is as follows:
Open the DBeaver client.
Create a sample database. (Optional)
Click on the top menu bar: File - New.
Select Create New Database Connection.
Select PsotgreSQL.
Download related drivers.
When making connection settings, you can choose to connect to YMatrix in [Enable High Availability] (/doc/5.1/maintain/crash_recover), or not:
High Availability Connection:
Select Connect by URL
. Enter jdbc:postgresql://<master_ip>:<master_port>,<standby_ip>:<standby_port>/<database>
in the URL string (the content in < > needs to be replaced). Enter the database administrator user name mxadmin and the administrator password set when initializing YMatrix to complete the connection settings.
Non-high availability connection:
Select Connect by Host
. Enter the master node (Master) IP, port number, database administrator user name mxadmin, and the administrator password set when initializing YMatrix to complete the connection settings.
The connection was successful.
Create a new SQL editor.
Write the SQL statement and click Run.
Click the link in the table to download and install the DbVisualizer installation package. | Operating System | CPU Architecture | Client Version |
---|---|---|---|
Mac | x86_64 | 23.1 | |
Mac | AArch64 | 23.1 | |
Linux | x86_64 | 23.1 | |
Windows | x86_64 | 23.1 | |
Windows | AArch64 | 23.1 |
The documentation example installation environment is as follows:
Open the DbVisualizer client.
Create a PostgreSQL connection.
When making connection settings, you can choose to connect to YMatrix in [Enable High Availability] (/doc/5.1/maintain/crash_recover), or not:
High Availability Connection:
First, select Settings Format
as Database URL
.
Enter
jdbc:postgresql://<master_ip>:<master_port>,<standby_ip>:<standby_port>/<database>
in Database URL
(the content in < > needs to be replaced). Enter the database administrator user name mxadmin and the administrator password set when initializing YMatrix to complete the connection settings.
Click
Connect
and the connection is successful.
Non-high availability connection:
Enter the master node (Master) IP, port number, database administrator user name mxadmin, and the administrator password set when initializing YMatrix to complete the connection settings.
Test network connectivity.
The connection was successful.
Create a SQL editor.
Write SQL and run successfully.
Click the link in the table to download and install the Datagrip installation package.
| Operating System | CPU Architecture | Client Version | |--|--|--|--| | Mac | x86_64 | 2023.1.1 | | Mac | AArch64 | 2023.1.1 | | Linux | x86_64 | 2023.1.1 | | Linux | AArch64 | 2023.1.1 | | Windows | x86_64 | 2023.1.1 | | Windows | AArch64 | 2023.1.1 |
The documentation example installation environment is as follows:
Open the Datagrip client.
Create a new project.
Select the PostgreSQL data source.
When making connection settings, you can choose to connect to YMatrix in [Enable High Availability] (/doc/5.1/maintain/crash_recover), or not:
High Availability Connection:
Enter jdbc:postgresql://<master_ip>:<master_port>,<standby_ip>:<standby_port>/<database>
in URL
(the content in < > needs to be replaced). Enter the master node (Master) IP, port number, database administrator user name mxadmin, and the administrator password set when initializing YMatrix to complete the connection settings.
Non-high availability connection:
Only fill in other connection information, and do not modify the URL
.
The connection is successful, write SQL and run successfully.
Notes!
pgAdmin does not support high availability connections.Click the link in the table to download the installation package for installing pgAdmin or view the download path for pgAdmin.
| Operating System | CPU Architecture | Client Version | |--|--|--|--| | Mac | x86_64 | 7.8 | | Mac | AArch64 | 7.8 | | Linux | x86_64 | 7.8 | | Windows | x86_64 | 7.8 |
The documentation example installation environment is as follows:
Open the pgAdmin client and set the pgAdmin password.
Click Add New Server.
Enter the master node (Master) IP, port number, database administrator user name mxadmin, and the administrator password set when initializing YMatrix to complete the connection settings.
The connection was successful.
Option any database node in the left structure tree, and then click the menu "Tools" -> "Query Tools" to open the query editor.
Write SQL statement and click Run.
Notes!
Navicat does not support highly available connections.
Click Navicat to download and install the Navicat for PostgreSQL client installation package for the corresponding operating system.
The documentation example installation environment is as follows:
Open the Navicat client.
Create a PostgreSQL connection.
Enter the master node (Master) IP, port number, database administrator user name mxadmin, and the administrator password set when initializing YMatrix to complete the connection settings.
Click Test Connection.
The test is successful, click Save connection.
Create a new query.
Write the SQL statement and click Run.
Run successfully.