Docker-based cluster deployment tutorial for time series database DolphinDB

Docker is an open source engine that can easily create a lightweight, portable, and self-sufficient container for any application. DolphinDB database provides a docker-based distributed cluster deployment package, which allows users to deploy DolphinDB distributed clusters conveniently and quickly.

The goal of this tutorial is to build a 5-node multi-machine cluster through 4 centos containers. The final built cluster is as follows:

When deploying a distributed cluster, you need to configure the network IPs and ports of the controller, agent, and data node respectively. The deployment package provided in this tutorial builds a virtual subnet between docker containers, and specifies four fixed IP addresses from 10.5.0.2. to 10.5.0.5 for the four containers. The configuration file containing this information has been built into the deployment package, and the user does not need to manually specify one by one. The built-in network IP and port allocation are as follows:

controller.cfg:

localSite=10.5.0.5:8888:master

agent1.cfg:

mode=agent
localSite=10.5.0.2:8710:P1-agent,agent
controllerSite=10.5.0.5:8888:master

cluster.nodes:

localSite,mode
10.5.0.2:8710:P1-agent,agent
10.5.0.2:8711:P1-node1,datanode
10.5.0.2:8712:P1-node2,datanode
10.5.0.3:8810:P2-agent,agent
10.5.0.3:8811:P2-node1,datanode
10.5.0.3:8812:P2-node2,datanode
10.5.0.4:8910:P3-agent,agent
10.5.0.4:8911:P3-node1,datanode

Since the UDP protocol cannot work normally in the docker virtual network environment, it is necessary to add the configuration item lanCluster=0 in agent.cfg and cluster.cfg, which has been added by default in the configuration file in the deployment package.

Before deploying the cluster, you need to set up the docker environment. For details, please refer to the docker installation tutorial and docker-compose installation tutorial .

1. Download and compile the DolphinDB docker cluster deployment package

Download the DolphinDB docker deployment package from https://github.com/dolphindb/Tutorials_CN/blob/master/docker/DolphinDB-Docker-Compose.zip .

Obtain an image file containing the latest version of DolphinDB server through the following steps:

cd ./DolphinDB-Docker-Compose/Dockerbuild
docker build -t ddb:latest ./

After the compilation is complete, use docker images to view:

$ docker images
REPOSITORY  TAG IMAGE ID  CREATED SIZE
ddb latest  4268ac618977  5 seconds ago 420MB

2. Replace the license file in the deployment package

The license file in the community version cannot support the deployment of 5 data nodes and 1 control node, so you need to apply for an enterprise version license that supports more than 6 nodes and put the enterprise version license file dolphindb.lic in the ./cfgfile directory.

3. Create the container required by the controller and agent, and start the container

The default startup script in the container will automatically start the control node and the agent node.

cd ./DolphinDB-Docker-Compose
docker-compose up -d

The output after execution is as follows:

$ docker-compose up -d
Creating network "20190121-dolphindb-docker-compose_dbnet" with driver "bridge"
Creating ddbcontroller ... done
Creating ddbagent2     ... done
Creating ddbagent3     ... done
Creating ddbagent1     ... done

4. View the cluster

Through the above steps, the creation, startup and initialization of the distributed cluster have been completed. Visit the address http://localhost:8888 to access the web page of cluster management. Start all data nodes in the Web, the final interface is as follows:

Guess you like

Origin blog.csdn.net/qq_41996852/article/details/110916447