SAP Sybase SQL Anywhere, on-demand edition Tenant Mirroring
Module 12 - Tenant Mirroring
In this module, you will learn about configuring tenant read-only scale-out systems and high availability systems in the SAP Sybase SQL Anywhere, on-demand edition cloud. Read-only scale-out distributes the read-only load on a database over multiple servers to improve performance, while high availability ensures your database is still available even if one server fails for any reason.
Your cloud should have the basic architecture set up with at least a few tenant databases active and running.
Tenant Read-Only Scale-Out Systems
Read-only scale-out allows you to offload reporting or other operations that require read-only access to the database to read-only scale-out database copies. A tenant read-only scale-out system includes a read-write database and its scale-out database copies.
By default, the first database added to the cloud is the only read-write database in the read-only scale-out system. All subsequent copies of the database are read-only copies.
Read-only scale-out creates multiple instances of the database, allowing for connections requesting reading access to be distributed among different database copies on different cloud servers, reducing the load on a single server. This ability to scale out databases allows for more client connections to be made without impeding servers. This is useful for databases that have a lot of load and have a significant proportion of connections that are only doing read-only queries.
Adding Scale-Out Database Copies
To set up a read-only scale-out system, you will first need to add a database to the server. To create scale-out database copies for that database:
- On the cloud’s Overview panel, click Databases in the left hand navigation pane and click the database that you want to create a scale-out database copy for.
- In that database’s Overview panel, click Mirror and Scale-out in the left hand navigation pane and then click Create.
- Select the database to copy and the cloud server the scale-out database copy will reside on. In this example, demo is currently residing on the MYCLOUD-1#1 server and the scale-out database copy will be added to the MYCLOUD-2#1 server.
- After running the task, you should see its status in the Events tab. After the task completes, navigate to the Overview panel for the database you just copied. You will see the menu Database Copies. Click on it to expand the menu and you will see the scale-out database copy with its status, and the cloud server and host where it is located.
- To test connection to the scale-out database copy, use the dbping utility that was introduced in an earlier module. Recall that if scale-out database copies of a database exist, then the NodeType READONLY is equivalent to COPY. The dbping utility can be run in the command prompt or terminal with:
dbping -d -c "host=mycloud-2;dbn=demo;uid=dba;pwd=sql"
This should return with a connection to the read-write database. In this example, it is located on MYCLOUD-1#1. Now adding a NodeType of COPY, the connection will connect to the scale-out database copy on server MYCLOUD-2#1.
dbping -d -c "host=mycloud-2;dbn=demo;uid=dba;pwd=sql;nodetype=copy"
Deleting Scale-Out Database Copies
To delete scale-out database copies:
- Navigate to the Mirror and Scale-out panel of the tenant database you want to delete a scale-out database copy for.
- In the Scale-out Database Copies menu, check the checkbox beside the scale-out database copy you want to delete. Click Stop to stop the copy, and then Delete once the copy has stopped successfully.
- For other actions you can perform with your read-only scale out system, such as moving the read-write database or removing the configuration, refer to the documentation at http://dcx.sybase.com/index.html#cloud100/en/dbcloud/tenant-read-only-scale-out.html.
Tenant Mirroring Systems
A tenant mirroring provides high availability for the tenant databases in the cloud. The tenant mirroring system consists of three cloud servers running on three separate hosts. Two of the cloud servers act as tenant partners and the third cloud server acts as the tenant arbiter.
While both tenant partners run a copy of the database, only the primary partner runs a read-write copy. The other tenant partner, the mirror partner, runs a read-only copy of the database. The arbiter server does not run any database copies. Instead, the arbiter server determines which of the tenant partners act as the primary partner. If the primary partner becomes unavailable for whatever reason, the arbiter directs the mirror partner to assume the role of the primary.
The mirroring system can help reduce downtime of databases. When maintenance takes place on servers or if issues arise with a server, the partner can take over as the primary without requiring any interaction from cloud administrators and with minimal downtime. Any connections to a primary server that has stopped will be dropped, but new connections to the database will be automatically directed to the new primary.
To set up the mirroring configuration, ensure that you have three cloud servers running on separate hosts. To create your first tenant partner, simply add a database to a cloud server. This cloud server is automatically assigned as a tenant partner. Next you will need to set the arbiter server and the second tenant partner.
Setting Up Mirroring
To set mirroring:
- On the cloud’s Overview panel, click the Configure high availability link.
- Select the Partner 2 server and then select the Arbiter server. Finally, click Finish.
Setting Up Database Mirroring
- Navigate to the Mirror and Scale-out tab of the database for which you wish to set up mirroring. Click Start mirroring.
- Select the Mirror server and Arbiter server then click Finish.
Scaling and High Availability
Configuring your tenant databases with both the read-only scale-out and high availability systems provides the optimal setup for your databases. To use both configuration systems, first set up a high availability system. After the high availability system is set up, you can add copy nodes to your servers as needed. This will allow you to scale out your databases to accommodate more connections when required, while having a mirror server available at any time to reduce downtime.
For other actions you can perform with your high availability system, such as initiating failovers, moving tenant partners or removing the configuration, refer to the documentation at http://dcx.sybase.com/index.html#cloud100/en/dbcloud/tenant-high-availability.html.