There are multiple ways to connect to a MySQL-MGR instance when accessing it from a business application. This section describes how to choose a connection address to access the MySQL-MGR instance and provides examples for demonstration.
Access Method | Applicable Scenarios |
---|---|
Access within the Cluster | In single-master or multi-master mode, applications within the cluster access the MGR instance through the port exposed by the SVC. |
Access from outside the Cluster | In single-master or multi-master mode, applications outside the cluster access the MGR instance through the NodePort port. |
The example demonstrates programs using JDBC and GORM clients. Please refer to the corresponding framework documentation for other clients.
When using the code, please modify the relevant variables to your actual values. The variable descriptions are as follows:
Variable | Description |
---|---|
host | The IP or SVC name of the host for the corresponding access method |
port | The port number for the corresponding access method |
user | The username for MySQL-MGR |
password | The actual password for the MySQL-MGR user |
database | The name of the database to be accessed |
Cluster Internal Access
External Access to the Cluster - via NodePort
Cluster Internal Access
External Access to the Cluster - via NodePort