#Taking Ubuntu as an example, other operating systems can search for installation methods themselves #step1: Install some necessary system tools sudo apt-get update sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common #step2: Install GPG certificate curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - #step3: Write software source information sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" #step4: Update and install Docker CE sudo apt-get -y update sudo apt-get -y install docker-ce #step5: Set Docker to start automatically upon startup sudo systemctl enable docker #step6: Verify if Docker installation is successful docker --version #Display version information, indicating successful installation
#Installation command curl -L "https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose #Verify if the installation was successful docker-compose --version #Displaying version information indicates successful installation
By default, Linux servers should already be installed. If not, you can use the following command to install them.
sudo apt-get install dmidecode
After installing dmidecode, search for the installation path: wherever dmidecode. Assuming the result is /usr/sbin/dmidecode, remember this path as it will be used in the later docker compose yml file.
You can contact business or technical support to obtain container images for IoTDB Enterprise Edition.
This section demonstrates how to deploy a standalone Docker version of 1C1D.
For example, the container image file name of IoTDB obtained here is: iotdb-enterprise-1.3.2-3-standalone-docker.tar.gz
Load image:
docker load -i iotdb-enterprise-1.3.2.3-standalone-docker.tar.gz
View image:
docker images
docker network create --driver=bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 iotdb
Here we take the example of consolidating the IoTDB installation directory and yml files in the/docker iotdb folder:
The file directory structure is:/docker-iotdb/iotdb, /docker-iotdb/docker-compose-standalone.yml
docker-iotdb: ├── iotdb #Iotdb installation directory │── docker-compose-standalone.yml #YML file for standalone Docker Composer
The complete docker-compose-standalone.yml content is as follows:
version: "3" services: iotdb-service: image: timecho/timechodb:2.0.2.1-standalone #The image used hostname: iotdb container_name: iotdb restart: always ports: - "6667:6667" environment: - cn_internal_address=iotdb - cn_internal_port=10710 - cn_consensus_port=10720 - cn_seed_config_node=iotdb:10710 - dn_rpc_address=iotdb - dn_internal_address=iotdb - dn_rpc_port=6667 - dn_internal_port=10730 - dn_mpp_data_exchange_port=10740 - dn_schema_region_consensus_port=10750 - dn_data_region_consensus_port=10760 - dn_seed_config_node=iotdb:10710 privileged: true volumes: - ./iotdb/activation:/iotdb/activation - ./iotdb/data:/iotdb/data - ./iotdb/logs:/iotdb/logs - /usr/sbin/dmidecode:/usr/sbin/dmidecode:ro - /dev/mem:/dev/mem:ro networks: iotdb: ipv4_address: 172.18.0.6 # Note: Some environments set an extremely high container nofile limit (~2^30 = 1073741824). # This can make the startup step "Checking whether the ports are already occupied..." appear to hang (lsof slow). # If you see that line for a long time, lower the nofile limit by uncommenting below: # ulimits: # nofile: # soft: 1048576 # hard: 1048576 networks: iotdb: external: true
Use the following command to start:
cd /docker-iotdb docker-compose -f docker-compose-standalone.yml up
Due to lack of activation, it is normal to exit directly upon initial startup. The initial startup is to obtain the machine code file for the subsequent activation process.
After the first startup, a system_info file will be generated in the physical machine directory /docker-iotdb/iotdb/activation, and this file will be copied to the Timecho staff.
Received the license file returned by the staff, copy the license file to the /docker iotdb/iotdb/activation folder.
docker-compose -f docker-compose-standalone.yml up -d
Viewing the log, the following words indicate successful startup
docker logs -f iotdb-datanode #View log command 2024-07-19 12:02:32,608 [main] INFO o.a.i.db.service.DataNode:231 - Congratulations, IoTDB DataNode is set up successfully. Now, enjoy yourself!
Enter the container to view the service running status and activation information
View the launched container
docker ps
Enter the container, log in to the database through CLI, and use the show cluster command to view the service status and activation status
docker exec -it iotdb /bin/bash #Entering the container ./start-cli.sh -h iotdb #Log in to the database IoTDB> show cluster #View status
You can see that all services are running and the activation status shows as activated.
If you want to directly modify the configuration file in the physical machine in the future, you can map the/conf folder in the container in three steps:
Step 1: Copy the/conf directory from the container to/docker-iotdb/iotdb/conf
docker cp iotdb:/iotdb/conf /docker-iotdb/iotdb/conf
Step 2: Add mappings in docker-compose-standalone.yml
volumes: - ./iotdb/conf:/iotdb/conf #Add mapping for this/conf folder - ./iotdb/activation:/iotdb/activation - ./iotdb/data:/iotdb/data - ./iotdb/logs:/iotdb/logs - /usr/sbin/dmidecode:/usr/sbin/dmidecode:ro - /dev/mem:/dev/mem:ro
Step 3: Restart IoTDB
docker-compose -f docker-compose-standalone.yml up -d
This section describes how to manually deploy an instance that includes 3 Config Nodes and 3 Data Nodes, commonly known as a 3C3D cluster.
Note: The cluster version currently only supports host and overlay networks, and does not support bridge networks.
Taking the host network as an example, we will demonstrate how to deploy a 3C3D cluster.
Assuming there are currently three Linux servers, the IP addresses and service role assignments are as follows:
| Node IP | Host Name | Service |
|---|---|---|
| 192.168.1.3 | iotdb-1 | ConfigNode、DataNode |
| 192.168.1.4 | iotdb-2 | ConfigNode、DataNode |
| 192.168.1.5 | iotdb-3 | ConfigNode、DataNode |
Configure the host names on three machines separately. To set the host names, configure /etc/hosts on the target server using the following command:
echo "192.168.1.3 iotdb-1" >> /etc/hosts echo "192.168.1.4 iotdb-2" >> /etc/hosts echo "192.168.1.5 iotdb-3" >> /etc/hosts
For example, the container image file name obtained for IoTDB is: iotdb-enterprise-1.3.23-standalone-docker.tar.gz
Execute the load image command on three servers separately:
docker load -i iotdb-enterprise-1.3.2.3-standalone-docker.tar.gz
View image:
docker images
Here we take the example of consolidating the IoTDB installation directory and yml files in the /docker-iotdb folder:
The file directory structure is:/docker-iotdb/iotdb, /docker-iotdb/confignode.yml,/docker-iotdb/datanode.yml
docker-iotdb: ├── confignode.yml #Yml file of confignode ├── datanode.yml #Yml file of datanode └── iotdb #IoTDB installation directory
On each server, two yml files need to be written, namely confignnode. yml and datanode. yml. The example of yml is as follows:
confignode.yml:
#confignode.yml version: "3" services: iotdb-confignode: image: iotdb-enterprise:1.3.2.3-standalone #The image used hostname: iotdb-1|iotdb-2|iotdb-3 #Choose from three options based on the actual situation container_name: iotdb-confignode command: ["bash", "-c", "entrypoint.sh confignode"] restart: always environment: - cn_internal_address=iotdb-1|iotdb-2|iotdb-3 #Choose from three options based on the actual situation - cn_internal_port=10710 - cn_consensus_port=10720 - cn_seed_config_node=iotdb-1:10710 #The default first node is the seed node - schema_replication_factor=3 #Number of metadata copies - data_replication_factor=2 #Number of data replicas privileged: true volumes: - ./iotdb/activation:/iotdb/activation - ./iotdb/data:/iotdb/data - ./iotdb/logs:/iotdb/logs - /usr/sbin/dmidecode:/usr/sbin/dmidecode:ro - /dev/mem:/dev/mem:ro network_mode: "host" #Using the host network # Note: Some environments set an extremely high container nofile limit (~2^30 = 1073741824). # This can make the startup step "Checking whether the ports are already occupied..." appear to hang (lsof slow). # If you see that line for a long time, lower the nofile limit by uncommenting below: # ulimits: # nofile: # soft: 1048576 # hard: 1048576
datanode.yml:
#datanode.yml version: "3" services: iotdb-datanode: image: iotdb-enterprise:1.3.2.3-standalone #The image used hostname: iotdb-1|iotdb-2|iotdb-3 #Choose from three options based on the actual situation container_name: iotdb-datanode command: ["bash", "-c", "entrypoint.sh datanode"] restart: always ports: - "6667:6667" privileged: true environment: - dn_rpc_address=iotdb-1|iotdb-2|iotdb-3 #Choose from three options based on the actual situation - dn_internal_address=iotdb-1|iotdb-2|iotdb-3 #Choose from three options based on the actual situation - dn_seed_config_node=iotdb-1:10710 #The default first node is the seed node - dn_rpc_port=6667 - dn_internal_port=10730 - dn_mpp_data_exchange_port=10740 - dn_schema_region_consensus_port=10750 - dn_data_region_consensus_port=10760 - schema_replication_factor=3 #Number of metadata copies - data_replication_factor=2 #Number of data replicas volumes: - ./iotdb/activation:/iotdb/activation - ./iotdb/data:/iotdb/data - ./iotdb/logs:/iotdb/logs - /usr/sbin/dmidecode:/usr/sbin/dmidecode:ro - /dev/mem:/dev/mem:ro network_mode: "host" #Using the host network # Note: Some environments set an extremely high container nofile limit (~2^30 = 1073741824). # This can make the startup step "Checking whether the ports are already occupied..." appear to hang (lsof slow). # If you see that line for a long time, lower the nofile limit by uncommenting below: # ulimits: # nofile: # soft: 1048576 # hard: 1048576
First, start configNodes on each of the three servers to obtain the machine code. Pay attention to the startup order, start the first iotdb-1 first, then start iotdb-2 and iotdb-3.
cd /docker-iotdb docker-compose -f confignode.yml up -d #Background startup
After starting three confignodes for the first time, a system_info file will be generated in each physical machine directory /docker-iotdb/iotdb/activation, and the system_info files of the three servers will be copied to the Timecho staff;
Put the three license files into the /docker iotdb/iotdb/activation folder of the corresponding Configurable Node node;
After the license is placed in the corresponding activation folder, confignode will be automatically activated without restarting confignode
Start datanodes on 3 servers separately
cd /docker-iotdb docker-compose -f datanode.yml up -d #Background startup
Viewing the logs, the following words indicate that the datanode has successfully started
docker logs -f iotdb-datanode #View log command 2024-07-20 16:50:48,937 [main] INFO o.a.i.db.service.DataNode:231 - Congratulations, IoTDB DataNode is set up successfully. Now, enjoy yourself!
Enter any container to view the service running status and activation information
View the launched container
docker ps
Enter the container, log in to the database through CLI, and use the show cluster command to view the service status and activation status
docker exec -it iotdb-datanode /bin/bash #Entering the container ./start-cli.sh -h iotdb-1 #Log in to the database IoTDB> show cluster #View status
You can see that all services are running and the activation status shows as activated.
If you want to directly modify the configuration file in the physical machine in the future, you can map the/conf folder in the container in three steps:
Step 1: Copy the /conf directory from the container to /docker-iotdb/iotdb/conf on each of the three servers
docker cp iotdb-confignode:/iotdb/conf /docker-iotdb/iotdb/conf or docker cp iotdb-datanode:/iotdb/conf /docker-iotdb/iotdb/conf
Step 2: Add /conf directory mapping in confignode.yml and datanode. yml on 3 servers
#confignode.yml volumes: - ./iotdb/conf:/iotdb/conf #Add mapping for this /conf folder - ./iotdb/activation:/iotdb/activation - ./iotdb/data:/iotdb/data - ./iotdb/logs:/iotdb/logs - /usr/sbin/dmidecode:/usr/sbin/dmidecode:ro - /dev/mem:/dev/mem:ro #datanode.yml volumes: - ./iotdb/conf:/iotdb/conf #Add mapping for this /conf folder - ./iotdb/activation:/iotdb/activation - ./iotdb/data:/iotdb/data - ./iotdb/logs:/iotdb/logs - /usr/sbin/dmidecode:/usr/sbin/dmidecode:ro - /dev/mem:/dev/mem:ro
Step 3: Restart IoTDB on 3 servers
cd /docker-iotdb docker-compose -f confignode.yml up -d docker-compose -f datanode.yml up -d