Skip to content

Replicating across networks

Usually both parts of SQDR run on one server, the Stelo VM, close to the source databases (see What you install where). When the destination is in another network (another site, a customer's data center, a cloud), you can split them: this page explains where to put each part, and how to let them reach each other through firewalls with as few open ports as possible, and encrypted.

The parts, and what connects to what

Part Connects to
The source database Nothing: the others connect to it.
Stelo Capture (the Capture Agents, with their staging databases in Db2 for LUW) The source, to read its log.
SQDR (the Replicator Service, with its control database) The source, for baselines and to read where its Capture Agent's staging database is; the staging database, for the changes; the destination; its control database.
The destination database Nothing: the Replicator Service connects to it.

The Replicator Service reaches the staging database with the connection string the Capture Agent publishes on the source (its clientODBCString, by default naming the Stelo Capture server and Db2's port 50000). So that name and port must be reachable from wherever the Replicator Service runs.

Where to put the Replicator Service

Do: keep the Capture Agents next to the source. Put the Replicator Service on the Stelo VM when the destination is reachable over a fast network; put it next to the destination (on the destination's server or network) when the destination is across a WAN.

Why: the Replicator Service applies changes statement by statement and waits for each round trip to the destination, so a slow link to the destination slows down every group. Reading the staged changes in bulk over the WAN is cheaper.

Push: the Replicator Service on your side Pull: the Replicator Service at the destination
Installed at the destination's site Nothing. The Replicator Service, its ODBC drivers and licenses, and optionally its control database.
Ports opened At the destination's site, only the destination database's port, from your site. No port into your site. Into your site, from the destination's site only: the source's port (baselines) and Db2's port on the Stelo VM (the staged changes, and the control database if it stays on your side). No port into the destination's site.
Performance Limited by the WAN round trip to the destination. Better: the Replicator Service is next to (or on) the destination.
Administration Everything stays on your side. You manage a Replicator Service at the other site. With its control database on your side, you keep its configuration and status in your own database.

Reach servers behind a firewall with port forwarding

To expose the source and the Stelo VM to another site without exposing them directly, forward the ports through a Windows server in your network (a proxy), with Windows' port proxy, and let the other site reach only that server:

netsh interface portproxy add v4tov4 listenport=50448 connectaddress=<Stelo VM address> connectport=50448 protocol=tcp
netsh interface portproxy add v4tov4 listenport=1433 connectaddress=<source address> connectport=1433 protocol=tcp

Then:

  1. In your firewall, allow these ports from the other site's address only.
  2. On the Replicator Service's server at the other site, make the host name in the agent's published connection string resolve to the address it can reach (your firewall or the proxy): add a line to C:\Windows\System32\drivers\etc\hosts (edit it as an administrator), for example <firewall address> mysqdrplus.mydomain.com. Alternatively, set the agent's clientODBCString to a name that works from both sides.
  3. Create the source in the Data Replicator Manager with the proxy's name and port.

On Linux, iptables does the same port forwarding.

Encrypt the connection to the staging database

When the Replicator Service reads the staged changes over a network you don't control, encrypt that connection:

  1. Set up TLS on Db2 for LUW on the Stelo VM, on its own port (for example 50448), and export the certificate authority's certificate if the Replicator Service's computer doesn't already trust it. See Encrypt connections to the staging databases.
  2. Change the connection string the Capture Agent publishes: on the agent's Configuration tab, add or change clientODBCString, with the TLS port and Netlib=SQSSL.DLL. For example, change

    DRIVER={StarSQL 32};HostName=mysqdrplus.mydomain.com;Port=50000;Server=SQDRP0;PkgColId=STARSQL
    

    to

    DRIVER={StarSQL 32};HostName=mysqdrplus.mydomain.com;Port=50448;Server=SQDRP0;PkgColId=STARSQL;Netlib=SQSSL.DLL
    

    Saving restarts the agent, which publishes the new string on the source.

  3. In the Data Replicator Manager, on the Advanced tab of each incremental source that uses the agent, click Refresh in Incremental Replication, so the Replicator Service reads the new string (see Source properties).

See also SSL/TLS.

Set up many sites from one template

When you replicate the same tables to many destinations (for example one per customer), prepare the subscriptions once and import them at each site:

  1. Choose the tables. Optionally, publish only those tables on the source's Capture Agent, from a list (see Importing a list of tables), with requirePublication on, so the Data Replicator Manager offers only them.
  2. Build a template group on a Replicator Service on your side: an incremental group from the source to a local destination, with the schedule On demand (it never needs to run). Insert the members, with the destination options you want for every site. Split them into several groups if you like (for example the history tables apart).
  3. Export each group's members (see Export and import), and replace the template's destination database name in the JSON files with each site's.
  4. At each site: create the source and the destination, and the incremental groups with the schedule On demand; pause the source; Import Subscriptions into each group from the JSON file; then resume the source and set the groups' schedule, so the baselines start. Large imports go faster in several Data Replicator Manager windows, one group each.

The same files, exported again, carry later changes (new tables) to every site. PowerShell can do the export and import for many groups (see PowerShell).

An Informix source in another network

For an Informix source that the Replicator Service can't reach directly, use the IBM Informix ODBC driver or the SQDR bundled Informix driver, forward the Informix port (for example 9088) through a proxy as above, and allow it in the firewall. For encryption, set up TLS on the Informix server and its ODBC client and forward that port instead. See Informix.