简体   繁体   English

KairosDB中的批量插入数据

[英]Bulk insert Data in KairosDB

In this link it is given that we can import data in KairosDB as: this link 在这个环节是因为我们可以在KairosDB作为导入数据: 此链接

>bin/kairosdb.sh import -f export.txt
If you happened to compress the export you can pipe it back into the system like this:

>gzip -dc export.gz | bin/kairosdb.sh import

I am not sure what should be the format of export.txt file 我不确定export.txt文件的格式是什么

I have a file(export.txt) like: 我有一个文件(export.txt),例如:

Building_id,building_type,meter_type,unit,timestamp,value
1,Elementary School,temperature,F,1359695700,34.85
2,Park,temperature,F,1359695700,0
3,Industrial,temperature,F,1359695700,0.07
4,Recreation Center,temperature,F,1359695700,0
5,Park,temperature,F,1359695700,2.2
6,Community Center,temperature,F,1359695700,31.41
7,Office,temperature,F,1359695700,0
8,Elementary School,temperature,F,1359695700,10.88
9,Elementary School,temperature,F,1359695700,42.27
.
.

And I want to bulk insert this data into kairosDB, how can I do this. 我想将此数据批量插入kairosDB中,该怎么做。

the import/export features use a JSON format a bit similar to the format sent to push data via REST API (cf http://kairosdb.github.io/kairosdocs/restapi/AddDataPoints.html ). 导入/导出功能使用的JSON格式有点类似于通过REST API发送的用于推送数据的格式(请参见http://kairosdb.github.io/kairosdocs/restapi/AddDataPoints.html )。 One JSON document per line. 每行一个JSON文档。

{
    "name": "kairosdb.jvm.free_memory",
    "tags": {
        "host": "TTES"
    },
    "datapoints": [
        [
            1438184280003,
            850322752
        ],        
        [
            1438184281003,
            850322753
        ]

]
}

AFAIK the import command was designed to import data previously dumped using export commands, not for populating the database with new data (you may prefer to use the telnet or REST interfaces for that). AFAIK import命令旨在导入以前使用导出命令转储的数据,而不是用于向数据库填充新数据(您可能更喜欢使用telnet或REST接口)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM