Create databases where you need them.
Data replication allows data to be copied between running instances of the DBLX server. Data replication can be used for a myriad of different purposes, such as:
Replication of data is executed between server instances.
For the following examples, we will assume there are two database servers named
DBServerB. Bob will be our user who is connected to DBServerA via a SQL client.
Bob would like to replicate the Widget table from DBServerB to DBServerA.
Before proceeding, the following prerequisites are assumed:
Once Bob is connected to DBServerA with a client, he can issue the following replication command:
replicate Widget from 18.104.22.168:7169 using userBob b3llz
The replication command Bob issued is defined as follows:
Replicate the database table DBServerB.Widget to DBServerA. DBServerB is at I.P. address 22.214.171.124, port 7169, and a valid DBLX login for DBServerB is userBob/b3lls.
When using replication it is important to know the state of the local and remote databases before copying data all over the place.
When Bob replicated the Widget table, he knew the table existed in DBServerB and did not exist in DBServerA.
To get the table to DBServerA, Bob connected his DBLX client to DBServerA and issued the query to replicate the table FROM DBServerB.
Keep in mind that when running a replication query you need to connect to the server you want the data replicated TO.
Replication can be configured to pull whatever data you want.
The format of the SQL to execute table replication is the following:
replicate tableName [as (newTableName|query)] from serverOrIp[:portnum] using username password
tableName: The table name on the remote server to replicate.
as newTableName: Optional. The table name to create on the local server. If using newTableName, then a query cannot be used. If newTableName is omitted, then it is assumed that the table tableName should be created on the local database if it does not exist.
as query: Optional. A sql query to identify the records on the remote server that should be replicated to the local server. If using a query, then a newTableName cannot be used. Replication will attempt to merge data based on the column name. If the query 'SELECT * FROM SomeTable' returns the same column names as the local table (tableName), then the data from the remote server will be inserted into the table tableName on the local server. If the table tableName on the local server does not exist, it will be created and populated with the result of the query.
from serverOrIp: The server name or I.P. address of the remote DBLX server to replicate data FROM.
from serverOrIp:portNum: Optional. The server name or I.P. address and port number of the remote DBLX server to replicate data FROM. The port number is optional. If the port number is omitted, replication will use the default DLBX port of 7169.
using username password: The username and password needed to access the remote DBLX server. This user account should already be created on the remote server and the user should have SELECT permissions.
Some replication examples are provided below:
replicate tableName as (newTableName) from myServer using tinaw g00bits
Will replicate the table tableName from the remote server
myServer to the local server with the table name
newTableName. If the table
newTableName does not exist, it will be created. If newTableName does exist and has the same columns as the table tableName, then the data from the remote server will be inserted into newTableName.
If the table newTableName does exist and does not have the same columns as the table tableName, then no data will be replicated and the client will be provided with an error message.
replicate tableName as (SELECT * FROM otherTable WHERE value = 'something') from happyServer using m0nkey t1bble
Replicates the records returned from a SELECT query on the remote server
happyServer to the local database. Assumes the columns in the SELECT query are the same as the columns in the local table
tableName. If the table
tableName does not exist, it will be created. If tableName does exists then the data returned from the SELECT query will be inserted into that table.
Limitations and Known Issues