MySQL is an open source, object-relational database built with speed and reliability in mind. Its large and active developer community has created many third-party applications, tools, and libraries that expand MySQL’s functionality.
Read-only nodes are replicas of a cluster’s primary node located in additional geographical regions. Using read-only nodes reduces latency for users connecting from those regions.
Communication between primary and read-only nodes is SSL-encrypted and sent over the public network.
Note
Read-only nodes differ from standby nodes, which are exact copies of the primary node that are automatically moved into place in the event of a primary node failure.
Create a Read-Only Node Using the CLI
Note
To create a read-only node using doctl, you need to provide values --region and --size flags, which specify the node’s datacenter and its configuration (number of CPUs, amount of RAM, and hard disk space). Use the doctl databases options regions and doctl databases options slugs commands, respectively, to get a list of available values.
How to Create a Read-Only Node Using the DigitalOcean CLI
To create a read-only node using the API, you need to provide values for the region and size fields, which specify the new node’s datacenter and its configuration (number of CPUs, amount of RAM, and hard disk space). Use the /v2/databases/options endpoint to get a list of available values.
How to Create a Read-Only Node Using the DigitalOcean API
To add a read-only node, click on the name of the cluster to go to its Overview. At the bottom of the page, click the Add a read-only node link to go to the read-only node creation page.
Select the size, which must be equal to or larger than the primary node, then select the datacenter and name the node. When you’re done, click Create a read-only node to provision the node.
Like primary nodes, you can limit access to a read-only nodes to trusted sources and access read-only nodes using a command-line client and the connection string in the node’s Overview page.
Promote a Read-Only Node to Become a Primary Node
You can promote an existing read-only node to become the primary node of a new database cluster, essentially creating a fork or replica of its former database cluster. However, these two clusters are independent and do not remain in sync, so any changes you make to one are not copied to the other.
You can also promote a read-only node to create a new database cluster in a different datacenter region. This option can help you maintain uptime if a cluster is experiencing issues in another region.
How to Promote a Read-Only Node Using the DigitalOcean CLI