GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.voltdb.com — 12.2. Database Replication in Action Documentation12.2. Database Replication in ActionThe previous section explains the principles behind database replication. The following sections provide step-by-step instructions for setting up and managing replication using VoltDB. All of the following examples use the same fictional servers to describe the replication process. The server used for the master cluster is called serverA; the server for the replica is serverB. 12.2.1. Starting ReplicationIt is easy to establish database replication with VoltDB. You can replicate any VoltDB database — there are no special requirements or configuration needed for the master database. It is also possible to begin replication of a new (empty) database or an existing database that already has content in it. The steps to start replication are:
If you are using the Enterprise Manager to manage your databases, you can start the master database (Step 1) as you would normally, using the create, restore, or recover action. There is also a replica option on the Start Database dialog for creating a replica database (Step 2). The DR agent must be started by hand. When the DR agent starts, it performs the following actions:
12.2.2. Stopping ReplicationIf, for any reason, you wish to stop replication of a database, all you need to do is stop the DR agent process or the replica database. If either the agent or the replica database is not capable of processing the stream of transactions, the master will continue to queue completed transactions until the queue is full. At which point the master will abandon replication, delete the queue, and resume normal operation. In other words, except for logging error messages explaining that replication has stopped, there is no outward change to the master cluster and no interruption of client activity. If you wish to shutdown replication in a more orderly fashion, you can:
12.2.3. Promoting the Replica When the Master Becomes UnavailableIf the master database becomes unreachable for whatever reason (such as catastrophic system or network failure) and you choose to “turn on” the replica as a live database in its place, you use the voltadmin promote command to promote the replica to a fully active (writable) database. Specifically:
When you invoke voltadmin promote, the replica exits read-only mode and becomes a fully operational VoltDB database. For example, the following Linux shell command uses voltadmin to promote the replica node serverB: $ voltadmin promote --host=serverB 12.2.4. Managing Database ReplicationDatabase replication runs silently in the background, providing security against unexpected disruptions. Ideally, the replica will never be needed. But it is there just in case and the replication process is designed to withstand normal operational glitches. However, there are some conditions that can interrupt replication and it is important to be able to recognize and be able to respond to those situations, in order to ensure ongoing protection. Both the master database and the DR agent maintain queues to handle fluctuations in the transmission of transactions. Network hiccups or a sudden increase of load on the master database can cause delays. Nodes on the master cluster may fail and rejoin (assuming K-safety). The queues help the replication process survive such interruptions. In the case of the master database, replication initially queues data in memory. If the pending data exceeds the
allocated queue size, data then overflows to disk in the directory If the problem persists for too long, it is possible for the queues to fill up, resulting in either the master or the DR agent (or both) canceling replication. When this happens, it is necessary to restart the replication process. The following sections explain how to monitor the replication process and how to respond to error conditions. 12.2.4.1. Monitoring the Replication ProcessThere are two ways to monitor the replication process:
The DR agent logs information about the ongoing transmissions with the master and the replica. It also reports any issues communicating with the master and continues to retry until communication is re-established. If the agent encounters a problem it cannot recover from, it logs the error and the process stops. In this situation, you must restart replication from the beginning. (See Section 12.2.4.2, “Restarting Replication if an Error Occurs” for details.) If you do not want the log messages displayed on the console, you can redirect them by providing an alternate Log4J configuration file. You specify the alternate configuration file with the environment variable LOG4J_CONFIG_PATH. For example, the following commands start the DR agent and specify an alternate log configuration file mylogconfig.xml in the current working directory: $ export LOG4J_CONFIG_PATH="mylogconfig.xml" $ dragent master serverA replica serverB In addition to the DR agent logs, you can query the master database to determine the current state of its replication queues using the @Statistics system procedure. The "DR" keyword returns information about the amount of replication data currently in memory (waiting to be sent to the agent). One VoltTable reports the amount of memory used for queuing transactions and another reports on the current status of any snapshots (if any) waiting to be sent. 12.2.4.2. Restarting Replication if an Error OccursIf an error does occur that causes replication to fail, you must restart replication from the beginning. In other words:
Note that, if the master is still running, it does not need to be stopped and restarted. However, both the DR agent and the replica database must be restarted if any condition causes replication to fail. Situations that will require restarting replication include the following:
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |