Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python InfluxDB缺少标记值(putInfluxDB nifi处理器)_Python_Json_Apache Kafka_Apache Nifi_Influxdb - Fatal编程技术网

Python InfluxDB缺少标记值(putInfluxDB nifi处理器)

Python InfluxDB缺少标记值(putInfluxDB nifi处理器),python,json,apache-kafka,apache-nifi,influxdb,Python,Json,Apache Kafka,Apache Nifi,Influxdb,我是InfluxDB的新手,问题在于我必须通过Nifi在InfluxDB中插入python dict,我尝试了不同的方法,我总是得到相同的错误,告诉我缺少标记: 另一个例子: { "error":"unable to parse '[{ "measurement":"sensor", "time":1559630455, "tags":{"test_tag":"test"}, "fields":{} }]' : missing tag

我是InfluxDB的新手,问题在于我必须通过Nifi在InfluxDB中插入python dict,我尝试了不同的方法,我总是得到相同的错误,告诉我缺少标记:

另一个例子:

{
  "error":"unable to parse 
  '[{
    "measurement":"sensor",
    "time":1559630455,
    "tags":{"test_tag":"test"},
    "fields":{}
    }]'
    : missing tag value"
}
另一个:

org.influxdb.InfluxDBException: 
{
  "error":"unable to parse 
  '[{
    "measurement":"sensor",
    "time":1559631341,
    "tags":{},
    "fields":{}
    }]'
    : missing tag value"}
我的最后一次尝试遵循以下avro模式:

{
  "type": "record",
  "name": "preprocessed_value",
  "fields": [
    { "name": "measurement", "type": "string"  },
    { "name": "time", "type": "long"  },
    { "name": "tags", "type": { "type":"map", "values" : "string"}  },
    { 
      "name" : "fields" , 
      "type" : {
        "name" : "PythonDict",
        "type" : "record",
        "fields": [
          { "name": "id",                           "type": "int" },
          { "name": "date",                         "type": "long"  },
          { "name": "info",                         "type": "string"  },
          { "name": "aleatory_number",              "type": "long"  },
          { "name": "aleatory_number_square_root",  "type": "float" }
        ]
      } 
    }
  ]
}
同时使用标记和字段时,我也遇到了同样的错误:

org.influxdb.InfluxDBException: {"error":"unable to parse 
  '[{
    "measurement":"sensor",
    "time":1559720142,
    "tags":{"test_tag":"test"},
    "fields":{
      "id":3,
      "date":1559718332366,
      "info":"info sensor3",
      "aleatory_number":141969819,
      "aleatory_number_square_root":11915.108
      }
  }]': missing tag value"}
如果您试图插入测量“传感器”的记录(根据XDB术语的点)没有值或任何标记的值为空,您将得到此错误

我不确定,为什么你有几乎相似的标签和字段来测量。对于点,标记列是必需的数据,字段列是可选的

在influx cli上执行以下命令:

show tag keys from sensor;

这将列出测量中的所有标记列。确保在尝试插入新点时通过了所有这些标记。

在第一个示例中,所有标记都没有值。在第二个示例中,您正在编写一个没有字段的点;这也是不允许的

你的观点应该是:

{
    "measurement":"sensor",
    "time":1559630455,
    "tags":{"test_tag":"test"},
    "fields":{"some_field": 1}
}

看起来
传感器
标记没有在
字段
元素中指定的值。您可以检查NiFi中的流文件内容(暂停传入连接上的
xdb
处理器和列表队列以查看各个流文件值)以查看是否存在传感器值吗?首先,谢谢,但我遇到了相同的错误,删除了标记“sensor”,甚至删除了空数组作为“tags”,谢谢您的回答,我已经试过了,错误还在继续,你看到一些错误了吗?:{“错误”:“无法解析”[{“测量”:“传感器”,“时间”:1559630455,“标记”:{“测试”:“测试”},“字段”:{}}]':缺少标记值“}@engeligualada我已经编辑了答案,请按建议尝试谢谢,我已经尝试过了,但是我是如何在每次插入中得到错误的,度量还没有创建,因此没有标记显示@engeligualada您可以尝试使用influxql直接使用CLI插入一些数据吗。这将有助于我们孤立这个问题
{
    "measurement":"sensor",
    "time":1559630455,
    "tags":{"test_tag":"test"},
    "fields":{"some_field": 1}
}