Access Methods

TOC

Function Overview

Alauda Database for MySQL-MGR provides multiple ways to access MySQL-MGR clusters, supporting both internal and external cluster access. This section describes how to obtain appropriate connection addresses and establish connections to MySQL-MGR instances using the mysql client tool both inside and outside the cluster. For detailed connection examples of client libraries, please refer to How to Access MySQL-MGR Instances

Procedure

ClusterIP

CLI
Web Console
  1. Obtain the Service name: Based on the instance name, the corresponding Service names are ${name}-read-write and ${name}-read-only.
  2. Connect using the MySQL Client. For example, to access the read/write service:
mysql -h${instance_name}-read-write.${namespace} -P3306 -u${username} -p${password}
  1. View member roles:
select * from performance_schema.replication_group_members;

NodePort

CLI
Web Console
Confirm the deployed access mode

Ensure the field is configured as NodePort.

kubectl -n ${namespace} get mysql ${name} -o jsonpath='{.spec.mgr.router.svcRW.type}'
  1. Obtain the NodePort access port:
kubectl get svc -n ${namespace} ${name}-read-write -o jsonpath='{.spec.ports[0].nodePort}'
  1. Connect using the MySQL Client:
mysql -h${node_ip} -P${port} -u${username} -p${password}
  1. View member roles:
select * from performance_schema.replication_group_members;