User Guide for GridDB Dockerfile sample

Revision: 4.3.2-9



1 Overview

1.1 Purpose of this document

This document explains how to use the GridDB Dockerfile sample.

1.2 Precautions

Make sure you can connect to the Internet. If you are behind a proxy, uncomment the proxy settings in the Dockerfiles.

2 GridDB Dockerfile sample

2.1 Overview

You can use GridDB Dockerfile sample to create GridDB server image and GridDB client image.

You can run GridDB server and GridDB client on docker hosts.

2.2 Architecture

GridDB Dockerfile sample includes two types of Dockerfile:

After building GridDB server and client image successfully, you can run these images to compose a GridDB cluster or you can push them in a container registry then you are able to pull them from other machines.

GridDB docker usage

2.3 Component of GridDB Dockerfile sample

2.4 Supported environment condition

GridDB Dockerfile sample has been confirmed to work in the following environments:

3 How to use GridDB Dockerfile sample on-premises

3.1 Build image

3.1.1 Build GridDB server image

Copy the following files to Docker_server\rpm directory:

$ ls rpm
griddb-client-4.2.0-linux.x86_64.rpm
griddb-server-4.2.0-linux.x86_64.rpm

Execute the following command in the Docker_server directory to build GridDB server image:

$ docker build -t griddb/griddb-server:4.2 -f Dockerfile_server .

3.1.2 Build GridDB client image

Copy the following files to Docker_client\rpm directory:

$ ls rpm
griddb-client-4.2.0-linux.x86_64.rpm
griddb-java_lib-4.2.0-linux.x86_64.rpm
griddb-webapi-4.2.0-linux.x86_64.rpm
griddb-newsql-4.2.0-linux.x86_64.rpm (GridDB AE only)

Copy the following files to Docker_client\3rd directory:

Execute the following command in the Docker_client directory to build GridDB client image:

$ docker build -t griddb/griddb-client:4.2 -f Dockerfile_client .

3.2 Run GridDB image

3.2.1 Run GridDB server image

Use the following command to start GridDB server container built in the previous section:

$ docker run -d --name <docker_container_name> \
    -e GRIDDB_CLUSTERNAME=<cluster_name> \
    -e GRIDDB_NODE_NUM=<node_number> \
    -e NOTIFICATION_ADDRESS=<notification_address> \
    griddb/griddb-server:4.2

The following environment variables need to be specified when starting GridDB server container:

Enviroment variable name Description Default value
GRIDDB_CLUSTERNAME cluster name myCluster
GRIDDB_NODE_NUM number of nodes of the cluster 1
NOTIFICATION_ADDRESS multicast address (MULTICAST mode) (*1)
NOTIFICATION_MEMBER list of IP addresses of nodes, separated by comma (FIXED_LIST mode) (*1)
NOTIFICATION_PROVIDER provider url (PROVIDER mode) (*1)
SERVICE_ADDRESS ip address of a node -

(*1) only specify one of them

3.2.2 Run GridDB client image

Use the following command to start GridDB client container built in the previous section:

$ docker run -d --name <docker_container_name> \
    -e GRIDDB_NODE=<node_ip> \
    -e GRIDDB_PORT=<node_operation_port> \
    griddb/griddb-client:4.2

The following environment variables need to be specified when starting GridDB client container:

Enviroment variable name Description Default value
GRIDDB_NODE IP address of a node (any node) -(required)
GRIDDB_PORT port of a node -(required)

3.3 Compose a GridDB cluster (on the same Docker host)

3.3.1 Single node

3.3.2 Multiple nodes

The following steps will start and compose a three-node GridDB cluster and GridDB home directory of each node is persisted. The client container will also run on the same docker host.

GridDB cluster on the same docker host

By using docker-compose.yml file, you can start multiple containers including client at once:

version: '3'
services:
    griddb1:
        container_name: myNode1
        image: griddb-server:4.2
        build:
            context: ./Docker_server
            dockerfile: Dockerfile_server
        env_file: .env
        networks:
            griddb_net:
                ipv4_address: ${IPADDR_NODE1}
        volumes:
            - "node1:/var/lib/gridstore/"
    griddb2:
        container_name: myNode2
        image: griddb-server:4.2
        env_file: .env
        networks:
            griddb_net:
                ipv4_address: ${IPADDR_NODE2}
        volumes:
            - "node2:/var/lib/gridstore/"
    griddb3:
        container_name: myNode3
        image: griddb-server:4.2
        env_file: .env
        networks:
            griddb_net:
                ipv4_address: ${IPADDR_NODE3}
        volumes:
            - "node3:/var/lib/gridstore/"
    client:
        container_name: client
        image: griddb-client:4.2
        build:
            context: ./Docker_client
            dockerfile: Dockerfile_client
        env_file: .env
        networks:
            griddb_net:
                ipv4_address: ${IPADDR_CLIENT}
        volumes:
            - "client:/var/lib/gridstore/log"
        depends_on:
            - "griddb1"
            - "griddb2"
            - "griddb3"
        ports:
            - 8080:8080
            - 8081:8081

volumes:
    node1:
    node2:
    node3:
    client:

networks:
    griddb_net:
        driver: bridge
        ipam:
            config:
                - subnet: ${SUBNET}

Define environment variable corresponding to the GridDB cluster connection method (FIXED_LIST, MULTICAST, PROVIDER).

The environment variables for starting container in section 3.2 and for above docker-compose are described in .env file:

Environment variable Description Example
GRIDDB_NODE_NUM number of nodes of the cluster 3
GRIDDB_CLUSTERNAME cluster name dockerCluster
NOTIFICATION_ADDRESS multicast address (MULTICAST mode) 239.0.0.1
NOTIFICATION_MEMBER list of IP addresses of nodes, separated by comma (FIXED_LIST mode) 172.18.0.2,172.18.0.3,172.18.0.4
NOTIFICATION_PROVIDER provider url (PROVIDER mode) http://providerhost/provider.json
GRIDDB_NODE IP address of a node (any node) 172.18.0.2
GRIDDB_PORT port of a node 10040
IPADDR_NODE1 IP address of myNode1 172.18.0.2
IPADDR_NODE2 IP address of myNode2 172.18.0.3
IPADDR_NODE3 IP address of myNode3 172.18.0.4
IPADDR_CLIENT IP address of client 172.18.0.5
SUBNET subnetwork of the cluster 172.18.0.0/24

3.4 Compose a GridDB cluster (multiple Docker hosts)

Starting multiple containers on the same docker host in previous section does not provide the full benefit of clustering in the following respects:

Building a GridDB cluster on multiple docker hosts offers these benefits.

3.4.1 MULTICAST method

When building cluster in MULTICAST mode, the network of container must be host mode

The following commands will build a three-node GridDB cluster on 3 docker hosts in MULTICAST method

GridDB cluster on multiple docker hosts (MULTICAST method)

On host1:

$ docker run --net=host \
    -e GRIDDB_NODE_NUM=3 \
    -e GRIDDB_CLUSTERNAME=dockerCluster \
    -e NOTIFICATION_ADDRESS=239.0.0.2 \
    -e SERVICE_ADDRESS=192.168.56.101 \
    --name myNode1 griddb/griddb-server:4.2

On host2:

$ docker run --net=host \
    -e GRIDDB_NODE_NUM=3 \
    -e GRIDDB_CLUSTERNAME=dockerCluster \
    -e NOTIFICATION_ADDRESS=239.0.0.2 \
    -e SERVICE_ADDRESS=192.168.56.102 \
    --name myNode2 griddb/griddb-server:4.2

On host3:

$ docker run --net=host \
    -e GRIDDB_NODE_NUM=3 \
    -e GRIDDB_CLUSTERNAME=dockerCluster \
    -e NOTIFICATION_ADDRESS=239.0.0.2 \
    -e SERVICE_ADDRESS=192.168.56.103 \
    --name myNode3 griddb/griddb-server:4.2

3.4.2 FIXED_LIST method

In FIXED_LIST method, you can use either macvlan or overlay network for containers.

The following commands will build a three-node GridDB cluster on 3 docker hosts in FIXED_LIST method using overlay network

GridDB cluster on multiple docker hosts (FIXED_LIST method)

3.4.3 PROVIDER method

PROVIDER method is the same as FIXED_LIST method

On docker host with overlay network, 3 ports: 10001, 20001 (when using NewSQL) and 10040 must be exposed.

The following commands will build a three-node GridDB cluster on 3 docker hosts in PROVIDER method using overlay network

Assume that the provider host is http : //192.168.56.104/provider.json and provides the following host information:

$ curl http://192.168.56.104/provider.json
[
  {
    "cluster": {"address": "10.0.1.4","port": 10010},
    "sync": {"address": "10.0.1.4","port": 10020},
    "system": {"address": "10.0.1.4","port": 10040},
    "transaction": {"address": "192.168.56.101","port": 10001},
    "sql": {"address": "192.168.56.101","port": 20001}
  },
  {
    "cluster": {"address": "10.0.1.5","port": 10010},
    "sync": {"address": "10.0.1.5","port": 10020},
    "system": {"address": "10.0.1.5","port": 10040},
    "transaction": {"address": "192.168.56.102","port": 10001},
    "sql": {"address": "192.168.56.102","port": 20001}
  },
  {
    "cluster": {"address": "10.0.1.6","port": 10010},
    "sync": {"address": "10.0.1.6","port": 10020},
    "system": {"address": "10.0.1.6","port": 10040},
    "transaction": {"address": "192.168.56.103","port": 10001},
    "sql": {"address": "192.168.56.103","port": 20001}
  }
]

4 How to use GridDB Dockerfile sample on Microsoft Azure service

4.1 Using Azure Container Registry (ACR)

Azure Container Registry (ACR) is a service of Microsoft Azure that provides a private docker registry for managing container images.

The following steps describe how to push and pull a GridDB docker image to the ACR.

4.1.1 Preparation

4.1.2 (Reference) Create an ACR

4.1.3 Push image to ACR

4.1.4 Pull image from the registry

4.2 Start a GridDB cluster on ACI

Azure Container Instance (ACI) is a service of Microsoft Azure that provides Docker container execution environment.

The following steps describe how to operate a GridDB container with Azure Container Instance (ACI).

On ACI, only PROVIDER method of the GridDB cluster is confirmed.

The following figure shows the system configuration of GridDB docker on Azure.

ACI上のGridDBクラスタ
GridDB cluster on ACI

A GridDB cluster consists of 3 nodes, each node belongs to a separated container group.

In order to configure a GridDB cluster in PROVIDER mode, a container for the provider host is required. In this document, httpd is used.

In addition, using a VM for reverse proxy (by nginx) to publish GridDB WebAPI and integrated operation management GUI (gs_admin) to outside the private network.

4.2.1 Preparation

4.2.2 Create the necessary resources

4.2.3 Start GridDB cluster

4.2.4 Start GridDB client

4.3 Start GridDB cluster on Azure VM

You can also build a GridDB cluster with Docker CE installed on Azure VM without using ACI

The following procedure describes how to operate the GridDB container with Docker CE on Azure VM.

4.3.1 Preparation

4.3.2 Create the necessary resources

4.3.3 Start GridDB cluster

4.3.4 Start GridDB client

5 Operations

5.1 Start a shell in a container

$ docker exec -it <node_name> bash

5.2 Check GridDB cluster status

$ docker exec -it <node_name> bash
$ su - gsadm
$ gs_stat -u admin/admin

5.3 Access to GridDB cluster

5.3.1 Access GridDB cluster in MULTICAST mode from docker host

5.3.2 Access from GridDB client outside Docker host

6 Trademark