1、Dockerfile
https://github.com/apache/iotdb/tree/master/docker/src/main
https://downloads.apache.org/iotdb/0.12.6/
########Dockerfile内容如下############
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
FROM openjdk:11-jre-slim
RUN apt update \
# procps is for `free` command
&& apt install wget unzip lsof procps -y \
&& wget https://downloads.apache.org/iotdb/0.12.6/apache-iotdb-0.12.6-server-bin.zip \
# if you are in China, use the following URL
#&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.12.6/apache-iotdb-0.12.6-server-bin.zip \
&& unzip apache-iotdb-0.12.6-server-bin.zip \
&& rm apache-iotdb-0.12.6-server-bin.zip \
&& mv apache-iotdb-0.12.6-server-bin /iotdb \
&& apt remove wget unzip -y \
&& apt autoremove -y \
&& apt purge --auto-remove -y \
&& apt clean -y
# rpc port
EXPOSE 6667
# JMX port
EXPOSE 31999
# sync port
EXPOSE 5555
# monitor port
EXPOSE 8181
VOLUME /iotdb/data
VOLUME /iotdb/logs
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
ENTRYPOINT ["/iotdb/sbin/start-server.sh"]
生成镜像build
docker build -t iotdb:0.12.6 .
生成运行iotdb容器,并且把数据目录和日志目录挂载到~/iotdb-0.12.6下
docker run --name iotdb -p 6667:6667 -v /home/boring/iotdb-0.12.6/data:/iotdb/data -v /home/boring/iotdb-0.12.6/logs:/iotdb/logs -d iotdb:0.12.6 /iotdb/bin/start-server.sh
1.进入容器
docker exec -it iotdb bash
2.使用命令行工具连接
参考https://www.yinyubo.cn/?p=724
ApacheIoTDB-Server的部署方式
ApacheIoTDB提供了三种部署方式:源码部署,二进制程序部署,Docker部署
因为我的电脑是Ubuntu的,不兼容ApacheIoTDB,所以我采用了docker方式进行部署(docker是用debian的java镜像)
部署服务端
1.在ubuntu机器上创建目录~/iotdb-0.11.2
2.复制官方网站的dockerfile到本地:https://github.com/apache/iotdb/blob/master/docker/src/main/Dockerfile-0.11.2
3.输入以下命令制作镜像,确认docker 镜像生成成功
docker build -t iotdb:0.11.2 .
4.输入以下命令,运行iotdb,并且把数据目录和日志目录挂载到~/iotdb-0.11.2下
docker run --name iotdb -p 6667:6667 -v /home/boring/iotdb-0.11.2/data:/iotdb/data -v /home/boring/iotdb-0.11.2/logs:/iotdb/logs -d iotdb:0.11.2 /iotdb/bin/start-server.sh
在容器中用命令行工具进行测试
1.进入容器
docker exec -it iotdb bash
2.使用命令行工具连接
/iotdb/sbin/start-cli.sh -h 127.0.0.1 -p 6667 -u root -pw root
3.确认界面出现如下返回
---------------------
Starting IoTDB Cli
---------------------
_____ _________ ______ ______
|_ _| | _ _ ||_ _ `.|_ _ \
| | .--.|_/ | | \_| | | `. \ | |_) |
| | / .'`\ \ | | | | | | | __'.
_| |_| \__. | _| |_ _| |_.' /_| |__) |
|_____|'.__.' |_____| |______.'|_______/ version 0.11.2
IoTDB> login successfully
IoTDB>