2

1.1.1.1:8086我从我的电脑 ( )连接到我的 influxdb ( 2.2.2.2) 以执行一些查询。我发现,我的服务器保持连接打开:

netstat -tpn | grep 8086
tcp6       0      0 1.1.1.1:8086     2.2.2.2:50839      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:51890      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:48478      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:56878      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:52680      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:52580      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:57184      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:61375      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:51220      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:34310      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:52282      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:49720      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:52946      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:52501      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:57278      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:36788      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:50687      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:64940      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:64949      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:48236      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:46754      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:50046      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:60312      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:55634      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:65141      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:51456      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:59572      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:49993      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:54233      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:50674      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:64182      ESTABLISHED 48554/influxd
tcp6       0      0 1.1.1.1:8086     2.2.2.2:58076      ESTABLISHED 48554/influxd

当我在本地主机上尝试它时,当我停止发送查询或数据以几乎立即保存时,连接减少了。influxdb 也没有执行查询:

InfluxDB shell version: 1.6.0

> SHOW QUERIES
qid query        database duration status
--- -----        -------- -------- ------
670 SHOW QUERIES          537µs    running

如何在 linux 中关闭此会话?我应该如何配置 influxdb 以自动关闭此会话(在本地主机上我有默认配置)。

版本:
Python lib influxdb (5.1.0)
OS Ubuntu 16.04.5 LTS

程序:

from influxdb import InfluxDBClient
import random

host = '1.1.1.1'
port = 8086
user = 'user'
password = 'password'
dbname = 'database'
client = InfluxDBClient(host, port, user, password, dbname)

json_body = [{"measurement": "TEST",
                "tags": {"Location": "local0"},
                "fields": {"Value": random.random()}}]
print(json_body)
client.write_points(json_body)
4

0 回答 0