7.12.15. Deploying a Connector through Docker

Note

Tungsten Connector is available to deploy as a Docker Image from v7.0.3 onwards.

Providing you have a license to use Tungsten Clustering, you will be able to download the docker image from the download portal of the Continuent Website.

The image is available as a gzipped tar ball, and the following steps outline how to import and use the image

Step 1 : Download the files

Once downloaded, you will need to uncompress the file and import it into docker. The following syntax can be used as an example:

shell> tar zxvf tungsten-connector-docker-7.1.4-10.tar.gz

This will result in a number of files/folders available in the tungsten-connector-docker-7.1.4-10 directry, within the path where you extracted the tar package, for example:

shell> ls -lh
total 1048848
-rw-r--r--@ 1 cssi  staff   1.3K May 24 12:16 README.txt
drwxr-xr-x@ 5 cssi  staff   160B May 24 11:45 conf/
-rw-r--r--@ 1 cssi  staff   887B May 24 12:07 docker-compose.yml
drwxr-xr-x@ 3 cssi  staff    96B May 24 11:54 security/
-rw-------@ 1 cssi  staff   499M May 24 12:38 tungsten-connector-docker-image-7.0.3-135.tar.gz

You will find a README.txt within the root folder, and also within the security folder, these files contain the same examples and steps as outlined on this page.

Step 2 : Configure the Connector

Before launching the connector, you will need to apply a number of configuration changes so that the Connector can communicate with your cluster and act in the desired mode based on your needs.

Modify the docker-compose.yml file

The file supplied looks like the following:

version: "3.9"
services:
  connector:
    ports:
      # connector listen port
      - 3306:3306
      # connector REST API listen port
      - 8096:8096
    environment:
      CONNECTOR_DATASERVICES: "alpha:db1,db2,db3"
      CONNECTOR_NAME: "connector"
    extra_hosts:
      - "db1:192.168.30.81"
      - "db2:192.168.30.82"
      - "db3:192.168.30.83"
    volumes:
      - ./conf/connector.properties:/opt/continuent/tungsten-connector/conf/connector.properties
      # if bridgeMode=OFF the next line is needed, please uncomment it
      #- ./conf/user.map:/opt/continuent/tungsten-connector/conf/user.map
      # if SSL is configured the following two lines are needed, please uncomment them
      #- ./conf/security.properties:/opt/continuent/cluster-home/conf/security.properties
      #- ./security:/opt/continuent/share
    image: "tungsten-connector:latest"
    restart: always

In this file you need to define your cluster nodes and cluster service, along with enabling various connector mode and security options. The following changes are mandatory:

  • Change the definition of CONNECTOR_DATASERVICES, listing your existing clusters (See below for examples).

  • Change the definition of CONNECTOR_NAME should you wish to rename the connector service (This is the name shown in cctrl)

  • Define the hosts/IP addresses with extra_hosts if your docker environment does not resolve the hostnames

  • By default, the connector will be running in Bridge Mode, Therefore, if enabling Proxy mode, uncomment the following user.map line within volumes

    - ./conf/user.map:/opt/continuent/tungsten-connector/conf/user.map

  • If enabling SSL, uncomment the following two security related lines within volumes

    - ./conf/security.properties:/opt/continuent/cluster-home/conf/security.properties
    - ./security:/opt/continuent/share

The CONNECTOR_DATASERVICES property will need defining slightly differently depending upon your topology, the example syntax below can be used

  • Single Cluster

    CONNECTOR_DATASERVICES="alpha:db1,db2,db3"

  • Composite Active/Passive Cluster

    CONNECTOR_DATASERVICES="alpha:db1,db2,db3\nbeta:db4,db5,db6"

  • Composite Active/Active Cluster

    CONNECTOR_DATASERVICES="alpha:db1,db2,db3\nbeta:db4,db5,db6\nalpha_from_beta:db1,db2,db3\nbeta_from_alpha:db4,db5,db6"

Proxy Mode Setup

By default, the connector will run in Bridge mode. If you wish to change this to Proxy mode, follow the following steps:

  • Uncomment the following user.map line in the docker-compose.yml file:

    - ./conf/user.map:/opt/continuent/tungsten-connector/conf/user.map

  • Edit the conf/user.map file and add every user required to the file

    Single Cluster Example:

    app_user secret alpha

    Composite Active Passive Example:

    app_user secret global alpha

    Composite Active/Active Example:

    app_user secret global alpha,beta:beta,alpha

  • Change the bridgeMode settings in the conf/connector.properties to:

    bridgeMode=OFF

Enabling Smartscale

To specifically enable Smartscale, within the conf/connector.properties file, change the useSmartScale property to true

SSL Setup

By default, SSL will be disabled. To enable it, follow these steps:

  • Uncomment the following lines in the docker-compose.yml file:

    - ./conf/security.properties:/opt/continuent/cluster-home/conf/security.properties
    - ./security:/opt/continuent/share

  • In the conf/connector.properties change the following properties to true:

    ssl.capable=true
    jdbc.driver.options=useSSL=true
    api.useSsl=true

  • From a running Tungsten Cluster copy the following files from /opt/continuent/share folder to the security/ folder:

    passwords.store
    tungsten_keystore.jks
    tungsten_truststore.ts
    tungsten_connector_keystore.jks
    tungsten_connector_truststore.ts

Step 3 : Import the Docker image

Use the following command to import the image into docker:

docker load --input tungsten-connector-docker-image-7.0.3-135.tar.gz

Step 4 : Launch the connector

Once the configuration has been applied and the image imported, you can then launch the connector using the following syntax:

docker compose up -d