我正在尝试在InfluxDB 0.9版中使用JSON输入点。我在浏览器上运行localhost:8083。它使我能够创建一个数据库,但是当我尝试使用JSON输入这些点时,它会发生“内部服务器错误”。我试图用Influx DB的Python API来做同样的事情。InfluxDB中使用JSON输入点时发生内部服务器错误
from influxdb import InfluxDBClient
json_body = [
{
"name": "cpu_load_short",
"tags": {
"host": "server01",
"region": "us-west"
},
"timestamp": "2009-11-10T23:00:00Z",
"fields": {
"value":0.64
}
}
]
client = InfluxDBClient('localhost', 8086, 'root', 'mydb')
client.create_database('mydb')
client.write_points(json_body)
对于clients.write_points(json_body)
,显示以下错误:
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
client.write_points(json_body)
File "C:\Python27\lib\site-packages\influxdb\client.py", line 364, in write_points
tags=tags)
File "C:\Python27\lib\site-packages\influxdb\client.py", line 406, in _write_points
expected_response_code=204
File "C:\Python27\lib\site-packages\influxdb\client.py", line 277, in write
expected_response_code=expected_response_code
File "C:\Python27\lib\site-packages\influxdb\client.py", line 257, in request
raise InfluxDBClientError(response.content, response.status_code)
InfluxDBClientError: 500: {"error":"database is required"}
看起来像使用0.9版本的your'e,请仔细检查您是否使用0.9的文档。例如,http://influxdb.com/docs/v0.9/concepts/reading_and_writing_data.html对于JSON主体具有不同的格式。 –
是的,我正在使用0.9版本 –