Skip to content
lvca edited this page Dec 22, 2012 · 3 revisions

<wiki:toc max_depth="4" />

Before to start

Before to start the replication between two server nodes assure that both server are in the same Clustering. To know the cluster configuration type in a OrientDB console:

    > cluster status
    
    Cluster status:
    {"demo":{
        "nodes": [{
          "id": "192.168.1.101:2434", 
          "mode": "synch"
          }, {
          "id": "192.168.1.101:2435", 
          "mode": "synch"
          }]
      }
    }

If the remote server doesn't have yet the database you must copy it before to start the replication. To copy a database you can:

  • export and import it in the remote server
  • copy the database folder to the remote server (assure the server is not running)
  • make a hot-copy of the database

Main operations

Hot-copy a database

To execute a hot-copy across the network use the copy database console command. Syntax:

    > copy database <database-name> <server-name>:<server-port> <database-type>

Where:

  • <database-name> is the database name
  • <server-name>> remote server name as host or ip address
  • <server-port>> remote server port number
  • <database-type> is the database type between the supported ones: local, for persistent database, and memory for a volatile database

Example to copy the demo database to another server using it as a persistent (local) database:

    > copy database demo localhost:2435 local

Start the replication

Syntax:

    > replication start <database-name> <server-name>:<server-port>

Where:

  • <database-name> is the database name
  • <server-name>> remote server name as host or ip address
  • <server-port>> remote server port number

Example to start the replication against the database copied in the previous example:

    > replication start demo localhost:2435

Stop the replication

Syntax:

    > replication stop <database-name> <server-name>:<server-port>

Where:

  • <database-name> is the database name
  • <server-name>> remote server name as host or ip address
  • <server-port>> remote server port number

Example to stop the replication against the one started in the previous example:

    > replication stop demo localhost:2435

Align a database

Copies only the record changed to the target remote database. Syntax:

    > replication align <database-name> <server-name>:<server-port>

Where:

  • <database-name> is the database name
  • <server-name>> remote server name as host or ip address
  • <server-port>> remote server port number

Example to align the database replicated above:

    > replication align demo localhost:2435

Work with the Journal

Get the replication journal

To retrieve the replication journaluse this command. Syntax:

    > replication get journal <database-name> <server-name>:<server-port>

Where:

  • <database-name> is the database name
  • <server-name>> remote server name as host or ip address
  • <server-port>> remote server port number

Example to display the replication journal against the one started in the previous example:

    > replication get journal demo localhost:2435
    
    Replication journal for database 'demo'
    
    +-----------+--------+---------------+-------------------------+
    | SERIAL    | TYPE   | RECORD ID     | WHEN                    |
    +-----------+--------+---------------+-------------------------+
    | 0         | CREATE | #5:1470       | 2012-05-09 02:46:42.645 |
    +-----------+--------+---------------+-------------------------+

Reset the replication journal

This command is to reset the replication journal. Syntax:

    > replication reset journal <database-name> <server-name>:<server-port>

Where:

  • <database-name> is the database name
  • <server-name>> remote server name as host or ip address
  • <server-port>> remote server port number

Example to reset the replication against the one started in the previous example:

    > replication reset journal demo localhost:2435
    
    Reset replication journal for database 'demo': removed 342 entries.

Display replication conflicts

This command displays the replication conflicts against a database. The conflicts are related to the connected server where the command is fired. Syntax:

    > replication get conflicts <database-name>

Where:

  • <database-name> is the database name

Example to retrieve the replication conflicts:

    > replication get conflicts demo
    
Clone this wiki locally