Influxdb没有监听udp端口

时间:2016-10-26 15:28:50

标签: udp influxdb

正如标题所述,我无法让Influxdb监听配置中定义的udp端口。

udp的配置如下所示:

[[udp]]
  enabled = true
  bind-address = ":8089"
  database = "testdb"
  retention-policy = ""
  batch-size = 5000
  batch-pending = 10
  read-buffer = 0
  batch-timeout = "1s"
  precision = ""

Http / tcp连接工作得很好,但不是udp。 我已使用netstat -aun检查了端口,结果为:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
udp        0      0 0.0.0.0:54601           0.0.0.0:*
udp        0      0 0.0.0.0:68              0.0.0.0:*
udp6       0      0 :::38131                :::*

未列出已定义的udp端口。

我已使用sudo service influxdb restart重新启动了Influxdb,但它没有帮助。

我错过了什么?

更新7.11.2016 21:59

我运行命令:influxd -config influxdb.generated.conf以查看如下输出:

 8888888           .d888 888                   8888888b.  888888b.
   888            d88P"  888                   888  "Y88b 888  "88b
   888            888    888                   888    888 888  .88P
   888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
   888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
   888   888  888 888    888 888  888   X88K   888    888 888    888
   888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
 8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"

[run] 2016/11/07 19:54:57 InfluxDB starting, version 1.0.2, branch master, commit ff307047057b7797418998a4ed709b0c0f346324
[run] 2016/11/07 19:54:57 Go version go1.6.2, GOMAXPROCS set to 2
[run] 2016/11/07 19:54:57 Using configuration at: influxdb.generated.conf
run: open server: listen: listen tcp :8088: bind: address already in use

它没有说到udp端口。

2 个答案:

答案 0 :(得分:1)

我有同样的问题,我认为根本原因可能是一样的。我将InfluxDB作为没有参数的Windows服务运行。因此它使用了与我预期的不同的.conf文件,所以当我启用UDP监听器时它没有生效。

要解决此问题,我更改了服务配置(通过nssm)以包含参数:

-config \path\to\my\config.conf

确保它通过我期望的配置运行。

答案 1 :(得分:0)

我有同样的问题。您已经在后台运行服务。然后,您尝试再次开始大量涌入。这就是为什么消息显示为“运行:打开服务器:监听:监听tcp:8088:绑定:已在使用的地址”。

首先停止后台服务:

sudo systemctl stop influxdb

然后在当前终端运行流入,以便您看到输出:

influxd -config influxdb.generated.conf

或者如果您将环境变量设置为指向您的配置,则:

sudo influxd

然后您将得到如下内容:

uesrname@host:~$ sudo influxd

 8888888           .d888 888                   8888888b.  888888b.
   888            d88P"  888                   888  "Y88b 888  "88b
   888            888    888                   888    888 888  .88P
   888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
   888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
   888   888  888 888    888 888  888   X88K   888    888 888    888
   888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
 8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"

[run] 2020/02/25 19:41:59 InfluxDB starting, version 1.1.1, branch unknown, commit unknown    
......   
[httpd] 2020/02/25 19:42:00 Listening on HTTP: [::]:8086
[udp] 2020/02/25 19:42:00 Started listening on UDP: :8189
[run] 2020/02/25 19:42:00 Listening for signals

如果以后要检查后台服务是否正在侦听UDP端口,请输入以下命令:

systemctl status influxd

您将获得状态

● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-02-25 19:56:01 CET; 2s ago
     Docs: man:influxd(1)
 Main PID: 7087 (influxd)
    Tasks: 9 (limit: 2233)
   CGroup: /system.slice/influxdb.service
           └─7087 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

.....
feb 25 19:56:02 host influxd[7087]: [httpd] 2020/02/25 19:56:02 Starting HTTP service
feb 25 19:56:02 host influxd[7087]: [httpd] 2020/02/25 19:56:02 Listening on HTTP: [::]:8086   
feb 25 19:56:02 host  influxd[7087]: [udp] 2020/02/25 19:56:02 Started listening on UDP: :8189
feb 25 19:56:02 host influxd[7087]: [run] 2020/02/25 19:56:02 Listening for signals