Read replica

[Update: January 31, 2019]

1. Overview

Specializing in reading and enabling high speed reference, read replica is a function for creating a read-only database server which uses the appliance Database as the master. By using read replica as the connection destination at the SQL client, processing in which complex queries are applied to large amounts of data (for example, numerical and causal data analysis) can be performed without burdening the master database.

2. Specifications

Specifications for the read replica function are as follows.

DB engine supporting master PostgreSQL 10 and later, MariaDB 10.2 and later
Number of read replica that can be created per master server Maximum of 3
Promotion function to master ×
Backing up read replica ×
Resource monitor It is possible to confirm the synchronization lag time with the master
Synchronization method Asynchronous replication *A synchronization lag of anywhere between a few seconds up to a couple of minutes occurs from updating master server data.

Note

Only databases that were created using the database appliance can function as databases for the master server. Database servers constructed by the customer cannot be set as the master.

Fees

The price is in keeping with standard database appliances. (The same plan as for the connection destination database appliance will be automatically applied. For further details, please refer to SAKURA Cloud database appliance .

3. Usage procedures

Confirmation and settings for the master database

Before creating read replica, confirm settings to enable replication at the master database appli-ance.

Select the database to be confirmed and then select the Settings Information tab. If Val-id is displayed for the Replication item, use as the read replica master is possible without chang-ing settings. Invalid indicates it will be necessary to change the activation status by selecting Change Database at the top-right of the screen.

Note

Database settings can only be changed when the database is stopped. If the database is operating, please shut it down from the power operation menu. We recommend acquiring a backup of the database before changing settings.

Select Activate for Replication at the Change Database screen. In the Replica User Password field enter the password used to connect the read replica database. Click Update on the bottom-right.

Note

When replication is deactivated (for example, when changing to a configuration that does not perform replication), the replication user will be deleted and it will no longer be possi-ble to connect from the read replica database.

Create read replica database

Even when creating a read replica, settings are performed at the same creation screen as with normal database appliances. Select and enter the following items for the read replica.

  • Select Activate for the Replication item.
  • Use the Role Selection radio button to select Read Replica. (When Master is selected, a standard database appliance is created with a status in which replication has already been acti-vated.)
  • From the Master DB popup menu, select the database appliance to be set as the master. (A disabled master read replica will not be displayed in the selection menu). Please enable by following the procedures listed in the previous section.)
  • The plan and database displayed in the Database Plan item are automatically set ac-cording to the specifications of the selected master database. As the read replica requires the same specifications as the master, it is not possible to change this item.
  • In the user settings item Replica User Password, enter the password* to connect to the master. [*Enter the password that was set when activating master replication.]
  • Similar to when creating a standard database appliance, for the Network item select the switch to which you want to connect and specify settings such as the IP address assigned to the database server. (The port number set for the selected read replica is entered automatically and cannot be changed.)
  • A Source Network input form is displayed when you select Restrict Source IP Ad-dress. The source network permitting access to the database can be set by entering an arbitrary IP address and IP address block.

From the Read Replica tab at the master, confirm the read replica that is currently con-nected.

4. How to use

After creation, when the read replica is started synchronization with the master occurs automatically. Replication status with the master after startup can be confirmed from the follow-ing information.

Note

Arbitrarily timed manual re-synchronization from the control panel is not possible. Likewise, automatic re-synchronization will not occur even when synchronization is not possible due to the master shutting down or the inability to write data as a consequence of network mal-function and/or insufficient disk capacity. In such situations, please stop the read replica and re-synchronize via startup operation. There are also circumstances where the read replica status is not normalized as the master was stopped/off during synchronization of the read replica. If this occurs, turn on power for the master, stop and then restart the replica.

Log

Information such as the startup status of the service daemon operating in the appliance can be confirmed from the Log tab.

Attention

As the master database log is also copied through the replication operation, there are cases in which a master log prior to read replica creation data will be shown.

Activity graph

As with a standard database appliance network traffic and disk usage amount as well as the synchronization lag time with the master can be gauged with the activity graph.

When using the read replica function, a reserved area (binlog) for replication is required on the master side. Usage of this area can be confirmed through the disk size on the activity graph.

Warning

MariaDB requires at least 1GB. When 1GB is exceeded, a binlog of approximately 40% of the database will be required. If there is insufficient area inside the disk to secure the binlog, the operation may be compromised. Please bear this in mind.

Change Database button

To change restriction settings for the source network select the Change Database button at the top of the screen.

Current settings value can be confirmed from the Settings Information tab.

5. Cautions

  • When a read replica is connected to the master database appliance, it is neither possible to clear replication settings nor to delete the database. Please perform these operations after clearing all read replica connections.
  • By activating master replication settings and using the password set for the user “repli-ca”, connection will also be possible from locations other than the read replica, created as the appliance. Please use with caution to security.
  • Read replica can only be created in the same zone. It is not possible to create while tar-geting a database (appliance) of another zone using bridge connection, etc.