FQDNs of MySQL® hosts
To connect to a host, you need its fully qualified domain name (FQDN). You can use the FQDN of a particular host in the cluster or a special FQDN always pointing to the current master host or the most recent replica.
Here is a host FQDN example:
rc1a-goh2a9tr********.mdb.yandexcloud.net
Getting a host FQDN
There are several ways to get a MySQL® host's FQDN:
-
Look up the FQDN in the management console:
- Navigate to the cluster page.
- Navigate to Hosts.
- Copy the Host FQDN column value.
-
In the management console
, copy the cluster connection command (it contains the host’s FQDN). To get this command, navigate to the cluster page and click Connect. -
Get the list of cluster hosts using the CLI or API.
Special FQDNs
Managed Service for MySQL® provides the following special FQDNs:
In multi-host clusters, special FQDNs may temporarily point to the old host, even if it has switched its role (e.g., from master to replica). If using a special FQDN which points to the current master, some write requests may fail if routed to the replica. This is because it takes time to update DNS records for special FQDNs. If your write request returns an error, repeat it later.
Warning
If automatic failover promotes a host without public access to master or most recent replica, you will not be able to connect to that host from the internet. To avoid this, enable public access for all cluster hosts.
Current master
An FQDN in c-<cluster_ID>.rw.mdb.yandexcloud.net format always points to the current master host in the cluster. You can get the cluster ID with the list of clusters in the folder.
When connecting to this FQDN, you can perform read and write operations.
Tip
To reduce latency and mitigate risks during master failovers, we recommend setting the master manually.
Most recent replica
An FQDN in c-<cluster_ID>.ro.mdb.yandexcloud.net format points to the replica that is most up-to-date with the current master. You can get the cluster ID with the list of clusters in the folder.
Specifics:
- When connecting to this FQDN, you can only perform read operations.
- If there are no active replicas in the cluster, you cannot connect to this FQDN as the respective DNS CNAME record will point to a
nullobject.
Aliases
With aliases, you can access the master, most recent replica, or each particular host of your Managed Service for MySQL® cluster using a stable, human-readable name no matter what their internal FQDNs are. Aliases are user-defined and function exactly like regular or special FQDNs.
Cluster alias
A cluster alias always points to the current master host in the Managed Service for MySQL® cluster. It has the following format:
c-<short_name>-my-<folder_ID>.rw.mdb.yandexcloud.net
Where <short_name> is a name set by the user when creating the alias.
A cluster alias must be unique within the folder. You can assign only one alias per cluster.
With cluster aliases, you can switch workloads from one cluster to another, e.g., after restoring from a backup. To do this, simply reassign the alias to the new cluster, no application-side updates required.
Warning
In multi-host clusters, special FQDNs may temporarily point to the old host, even if it has switched its role (e.g., from master to replica). If using a special FQDN which points to the current master, some write requests may fail if routed to the replica. This is because it takes time to update DNS records for special FQDNs. If your write request returns an error, repeat it later.
Host aliases
An alias pointing to a specific cluster host has the following format:
h-<host_short_name>-my-<folder_ID>.mdb.yandexcloud.net
Where <host_short_name> is a name set by the user when creating the host alias.
Each host alias must be unique within the folder. You can assign only one alias per host.