Installation Steps

GlueSync NoSQL to SQL for Couchbase Server

Prerequisites

In order to have GlueSync working on your Couchbase Server instance you will need to have:

  • valid user credentials with permissions of reading, writing to the target bucket

  • Couchbase eventing service deployed into your Couchbase Server cluster (please see chapter deploying Couchbase Eventing for more detailed information)

Basic configuration example

The NoSQL to SQL module can be customized by using a configuration file, in JSON format. The file name to use must be specified as parameter when launching the app, with the -f or --file tokens. The file must have the following structure:

{
  "sourceHost": "localhost",
  "sourcePort": "18091",
  "sourceName": "bucket-name",
  "sourceUsername": "bucket-user",
  "sourcePassword": "bucket-pwd",
  "sourceEntities": {
    "orders": {},
    "DocumentType2": {},
    "DocumentType3": {},
    "DocumentType4": {},
    "DocumentType5": {}
  },
  "sourceChangeRetention": 5,
  "copySourceEntitiesAtStartup": true,

  "targetHost": "127.0.0.1",
  "targetPort": "1433",
  "targetName": "db-name",
  "targetUsername": "db-user",
  "targetPassword": "db-pwd",

  "maxItemsCountPerTransaction": 100,
  "maxTransactionCountPerIteration": 100,

  "couchbase": {
    "certificatesPath": "/path/to/certs/dir",
    "timeoutSeconds": 60,
    "indexReplicaCount": 0,
    "eventing": {
      "baseUrl": "https://localhost",
      "metadataBucketName": "MetadataBucket"
    }
  }
}

The parameters that refer to a source are the parameters that describe the connection to the Couchbase Server instance.

  • sourceHost: the host where the instance is reachable from;

  • sourcePort: the port which the instance is reachable from;

  • sourceName: the name of the database in Couchbase Server instance;

  • sourceUsername: username of a privileged user in the instance;

  • sourcePassword: password of such user;

  • sourceEntities: document types that GlueSync is going to replicate to the target database.

The parameters that refer to a target are the parameters that describe the connection to the SQL instance.

  • targetHost: the host where the instance is reachable from;

  • targetPort: the port which the instance is reachable from;

  • targetName: the name of the target database in the SQL instance;

  • targetUsername: username of a privileged user in the instance;

  • targetPassword: password of such user.

Couchbase specific configurations are listed under the couchbase property:

  • certificatesPath (optional): the path to the certificates that need to be used when connecting to Couchbase Server. If omitted, no certificates are used;

  • timeoutSeconds (optional): number of seconds to set as timeout for operations involving communication with Couchbase server.

  • indexReplicaCount (optional default to 0): indicates the number of index replicas that will be generated by GlueSync. We suggest to size that number calculating it as number-of-index-node -1. For example 3 node index means a suggested replica to 2. For more details please see Couchbase doc.

  • eventing: an object that describe some specific features for the Couchbase Eventing service, listed below:

    • baseUrl: Couchbase Eventing service URL;

    • port (optional): Couchbase Eventing service port (defaults to 8096);

    • functionName (optional): use this field if you would like to customize the name of the eventing function described here (defaults to "gluesync_${configuration.sourceName}_generate_document_event");

    • metadataBucketName: name of the bucket designed to store metadata information;

    • isSyncGatewayPresent (optional): bool value used to specify if in your Couchbase deployment there is a Couchbase Sync Gateway linked to the source bucket (defaults to false);

    • helperBucketName (required only if isSyncGatewayPresent is set to true): name of helper bucket (needed only if you have a Couchbase Sync Gateway present into your deployment);

    • helperFunctionName (required only if isSyncGatewayPresent is set to true): use this field if you would like to customize the name of the eventing function described here (defaults to gluesync_${configuration.sourceName}_save_event_to_target);

    • workersNumber (optional): number of workers per node to process the events. If no value is specified (defaults to 3);

    • scriptTimeoutSeconds (optional): timeout in seconds for the Eventing functions execution (defaults to 60 seconds).

For more detailed configurations options please have a look at the section “Advanced configuration”.