XDB不关闭TCP连接
我从我的电脑(XDB不关闭TCP连接,tcp,influxdb,influxdb-python,Tcp,Influxdb,Influxdb Python,我从我的电脑(2.2.2.2)连接到我的XDB(1.1.1:8086)以执行一些查询。我发现,我的服务器保持连接打开: 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 t
2.2.2.2
)连接到我的XDB(1.1.1:8086
)以执行一些查询。我发现,我的服务器保持连接打开:
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
当我在本地主机上尝试时,当我几乎立即停止发送要保存的查询或数据时,连接就会减少。XDB也没有执行任何查询:
InfluxDB shell version: 1.6.0
> SHOW QUERIES
qid query database duration status
--- ----- -------- -------- ------
670 SHOW QUERIES 537µs running
如何在linux中关闭此会话?如何配置XDB以自动关闭此会话(在本地主机上,我有默认配置)
版本:Python库XDB(5.1.0)
操作系统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)
是什么造成了这些联系?是你写的代码吗?你能把它寄出去吗?客户端和服务器之间的网络设置是什么?我添加了我的程序。您通过网络设置了解什么?我已从提供商处订购了服务器,但这不在我的本地网络上。完成后,您应该调用
client.close()
。但是,如果退出程序时仍建立了连接,则会发生无法从此处的信息中解决的其他问题。您的IP地址看起来很奇怪/古怪-因此可能会有一些事情,例如客户端/服务器之间的防火墙或其他与网络相关的事情干扰了您的设置。如果有防火墙,它应该会阻止它,但我的服务器会将其保持在已建立的状态,这不是服务器端的问题吗?有没有办法,如何从命令行关闭此连接?如果问题完全在服务器端,连接状态将不会“建立”。还要记住,防火墙可以做比阻塞连接更糟糕的事情。