IoTDB是适用于物联网领域的时序数据库,以下为3台机器构成的集群版安装步骤,数据的验证过程
前置条件
•机器上已经安装有JDK环境,Java >= 1.8
•执行sudo ulimit -n 65535,设置文件最大句柄数
•下载安装包apache-iotdb-1.0.0-all-bin.zip 下载地址:https://iotdb.apache.org/Download/
安装步骤
第一步 确认搭建环境
集群至少由3台机器组成,这里为了后续运维方便,采用域名代替ip来标识集群的节点,在三台机器的/etc/hosts里均配置域名映射
10.1.100.116 test.local0
10.1.100.117 test.local1
10.1.100.118 test.local2
第二步 上传&解压
将压缩包上传到所有机器,解压到同一个目录,例如/hsc/iotdb/apache-iotdb-1.0.0-all-bin
第三步 修改通用配置
安装包解压后,由confignode和datanode组成,搭建集群版时数量可以灵活配置,现在这里按照3c3d进行配置。配置文件中通用的部分,通过iotdb-common.properties配置,启动后这些配置会写入二进制文件不可修改,重启也不能修改。如果确实需要修改,则要删除所有数据恢复初始状态后重启。在iotdb-common.properties文件中,设置schema副本数3,data副本数2。如果没有容灾要求和性能要求,只是体验一下,也可以使用默认的单副本配置。在所有机器上设置为相同的配置
schema_replication_factor=3
data_replication_factor=2
第四步 修改confignode配置
修改文件iotdb-confignode.properties,根据每台机器部署情况,设置为对应的值。已知10.1.100.116机器为第1个启动的confignode
| 10.1.100.116 test.local0 | 10.1.100.117 test.local1 | 10.1.100.118 test.local2 | |
|---|---|---|---|
| cn_internal_address | test.local0 | test.local1 | test.local2 |
| cn_target_config_node_list | test.local0:10710 | test.local0:10710 | test.local0:10710 |
第五步 修改datanode配置
修改文件iotdb-datanode.properties 根据每台机器部署情况,设置为对应的值
| 10.1.100.116 test.local0 | 10.1.100.117 test.local1 | 10.1.100.118 test.local2 | |
|---|---|---|---|
| dn_rpc_address | test.local0 | test.local1 | test.local2 |
| dn_internal_address | test.local0 | test.local1 | test.local2 |
| dn_target_config_node_list | test.local0:10710 | test.local0:10710 | test.local0:10710 |
第六步 启动
当所有机器的配置文件,都修改完成后,就可以启动了。
•必须先启动第一个confignode。在10.1.100.116机器对应目录下执行nohup ./sbin/start-confignode.sh >/dev/null 2>&1 & 用jps命令查看,预期能看到ConfigNode的进程起来了,也可以在logs目录的日志文件log_confignode_all.log查看启动情况。
•10.1.100.116继续执行 nohup ./sbin/start-datanode.sh >/dev/null 2>&1 &
•10.1.100.117 nohup ./sbin/start-confignode.sh >/dev/null 2>&1 & 以及nohup ./sbin/start-datanode.sh >/dev/null 2>&1 &
•10.1.100.118 nohup ./sbin/start-confignode.sh >/dev/null 2>&1 & 以及nohup ./sbin/start-datanode.sh >/dev/null 2>&1 &
效果体验
在任意一台机器目录下,./sbin/start-cli.sh -h 10.1.100.116 预期能进入命令行界面
执行show cluster,看到了3c3d的集群版
执行数据操作,insert into root.test.g_1.d_0 (time, s_0)values(now(), false) 再select * from root.test.g_1.d_0
数据写入和查询正常









网友评论