Way to get IoTDB binary files

IoTDB provides you three installation methods, you can refer to the following suggestions, choose one of them:

  • Installation from source code. If you need to modify the code yourself, you can use this method.
  • Installation from binary files. Download the binary files from the official website. This is the recommended method, in which you will get a binary released package which is out-of-the-box.
  • Using Docker:The path to the dockerfile is https://github.com/apache/iotdb/blob/master/docker/DockerfileDownload and Setup - 图1open in new window

Prerequisites

To use IoTDB, you need to have:

  1. Java >= 1.8 (Please make sure the environment path has been set)
  2. Maven >= 3.6 (Optional)
  3. Set the max open files num as 65535 to avoid “too many open files” problem.

Note: If you don’t have maven installed, you should replace ‘mvn’ in the following commands with ‘mvnw’ or ‘mvnw.cmd’.

Installation from binary files

You can download the binary file from: Download pageDownload and Setup - 图2open in new window

Installation from source code

You can get the released source code from https://iotdb.apache.org/Download/Download and Setup - 图3open in new window, or from the git repository https://github.com/apache/iotdb/tree/masterDownload and Setup - 图4open in new window You can download the source code from:

  1. git clone https://github.com/apache/iotdb.git

After that, go to the root path of IoTDB. If you want to build the version that we have released, you need to create and check out a new branch by command git checkout -b my_{project.version} v{project.version}. E.g., you want to build the version 0.12.4, you can execute this command to make it:

  1. > git checkout -b my_0.12.4 v0.12.4

Then you can execute this command to build the version that you want:

  1. > mvn clean package -DskipTests

Then the binary version (including both server and client) can be found at distribution/target/apache-iotdb-{project.version}-bin.zip

NOTE: Directories “thrift/target/generated-sources/thrift” and “antlr/target/generated-sources/antlr4” need to be added to sources roots to avoid compilation errors in IDE.

If you would like to build the IoTDB server, you can run the following command under the root path of iotdb:

  1. > mvn clean package -pl server -am -DskipTests

After build, the IoTDB server will be at the folder “server/target/iotdb-server-{project.version}”.

If you would like to build a module, you can execute command mvn clean package -pl {module.name} -am -DskipTests under the root path of IoTDB. If you need the jar with dependencies, you can add parameter -P get-jar-with-dependencies after the command. E.g., If you need the jar of jdbc with dependencies, you can execute this command:

  1. > mvn clean package -pl jdbc -am -DskipTests -P get-jar-with-dependencies

Then you can find it under the path {module.name}/target.

Installation by Docker

Apache IoTDB’ Docker image is released on https://hub.docker.com/r/apache/iotdbDownload and Setup - 图5open in new window Add environments of docker to update the configurations of Apache IoTDB.

Have a try

  1. # get IoTDB official image
  2. docker pull apache/iotdb:1.0.0-standalone
  3. # create docker bridge network
  4. docker network create --driver=bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 iotdb
  5. # create docker container
  6. docker run -d --name iotdb-service \
  7. --hostname iotdb-service \
  8. --network iotdb \
  9. --ip 172.18.0.6 \
  10. -p 6667:6667 \
  11. -e cn_internal_address=iotdb-service \
  12. -e cn_target_config_node_list=iotdb-service:22277 \
  13. -e dn_rpc_address=iotdb-service \
  14. -e dn_internal_address=iotdb-service \
  15. -e dn_target_config_node_list=iotdb-service:22277 \
  16. apache/iotdb:1.0.0-standalone
  17. # execute SQL
  18. docker exec -ti iotdb-service /iotdb/sbin/start-cli.sh -h iotdb-service

External access:

  1. # <IP Address/hostname> is the real IP or domain address rather than the one in docker network, could be 127.0.0.1 within the computer.
  2. $IOTDB_HOME/sbin/start-cli.sh -h <IP Address/hostname> -p 6667

Notice:The confignode service would fail when restarting this container if the IP Adress of the container has been changed.

  1. # docker-compose-1c1d.yml
  2. version: "3"
  3. services:
  4. iotdb-service:
  5. image: apache/iotdb:1.0.0-standalone
  6. hostname: iotdb-service
  7. container_name: iotdb-service
  8. ports:
  9. - "6667:6667"
  10. environment:
  11. - cn_internal_address=iotdb-service
  12. - cn_target_config_node_list=iotdb-service:22277
  13. - dn_rpc_address=iotdb-service
  14. - dn_internal_address=iotdb-service
  15. - dn_target_config_node_list=iotdb-service:22277
  16. volumes:
  17. - ./data:/iotdb/data
  18. - ./logs:/iotdb/logs
  19. networks:
  20. iotdb:
  21. ipv4_address: 172.18.0.6
  22. networks:
  23. iotdb:
  24. external: true

deploy cluster

Until now, we support host and overlay networks but haven’t supported bridge networks on multiple computers. Overlay networks see 1C2DDownload and Setup - 图6open in new window and here are the configurations and operation steps to start an IoTDB cluster with docker using host networks。

Suppose that there are three computers of iotdb-1, iotdb-2 and iotdb-3. We called them nodes. Here is the docker-compose file of iotdb-2, as the sample:

  1. version: "3"
  2. services:
  3. iotdb-confignode:
  4. image: apache/iotdb:1.0.0-confignode
  5. container_name: iotdb-confignode
  6. ports:
  7. - "22277:22277"
  8. - "22278:22278"
  9. environment:
  10. - cn_internal_address=iotdb-2
  11. - cn_target_config_node_list=iotdb-1:22277
  12. - schema_replication_factor=3
  13. - schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
  14. - config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
  15. - data_replication_factor=3
  16. - data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensus
  17. volumes:
  18. - /etc/hosts:/etc/hosts:ro
  19. - ./data/confignode:/iotdb/data
  20. - ./logs/confignode:/iotdb/logs
  21. network_mode: "host"
  22. iotdb-datanode:
  23. image: apache/iotdb:1.0.0-datanode
  24. container_name: iotdb-datanode
  25. ports:
  26. - "6667:6667"
  27. - "8777:8777"
  28. - "9003:9003"
  29. - "50010:50010"
  30. - "40010:40010"
  31. environment:
  32. - dn_rpc_address=iotdb-2
  33. - dn_internal_address=iotdb-2
  34. - dn_target_config_node_list=iotdb-1:22277
  35. - data_replication_factor=3
  36. - data_region_consensus_protocol_class=org.apache.iotdb.consensus.iot.IoTConsensus
  37. - schema_replication_factor=3
  38. - schema_region_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
  39. - config_node_consensus_protocol_class=org.apache.iotdb.consensus.ratis.RatisConsensus
  40. volumes:
  41. - /etc/hosts:/etc/hosts:ro
  42. - ./data/datanode:/iotdb/data/
  43. - ./logs/datanode:/iotdb/logs/
  44. network_mode: "host"

Notice:

  1. The dn_target_config_node_list of three nodes must the same and it is the first starting node of iotdb-1 with the cn_internal_port of 22277。
  2. In this docker-compose file,iotdb-2 should be replace with the real IP or hostname of each node to generate docker compose files in the other nodes.
  3. The services would talk with each other, so they need map the /etc/hosts file or add the extra_hosts to the docker compose file.
  4. We must start the IoTDB services of iotdb-1 first at the first time of starting.
  5. Stop and remove all the IoTDB services and clean up the data and logs directories of the 3 nodes,then start the cluster again.