Using udp with specific ip

Hello

I want to collect data using influx from my app using udp protocol.
I have four apps and they are using the same port for sending data.

so I use below config file to gather data. (thie is an example)

[[udp]]
  enabled = true
  bind-address = "192.0.0.1:8089"
  database = "app1"
  retention-policy = ""
  batch-size = 1000
  batch-pending = 5
  read-buffer = 209715200
  batch-timeout = "1s"
  precision = ""

[[udp]]
  enabled = true
  bind-address = "192.0.0.2:8089"
  database = "app2"
  retention-policy = ""
  batch-size = 1000
  batch-pending = 5
  read-buffer = 209715200
  batch-timeout = "1s"
  precision = ""

[[udp]]
  enabled = true
  bind-address = "192.0.0.3:8089"
  database = "app3"
  retention-policy = ""
  batch-size = 1000
  batch-pending = 5
  read-buffer = 209715200
  batch-timeout = "1s"
  precision = ""

[[udp]]
  enabled = true
  bind-address = "192.0.0.4:8089"
  database = "app4"
  retention-policy = ""
  batch-size = 1000
  batch-pending = 5
  read-buffer = 209715200
  batch-timeout = "1s"
  precision = ""

However I get error message some like

[I] 2017-06-20T08:08:08Z Failed to set up UDP listener at address 192.0.0.1:8089: listen udp 192.0.0.1:8089: bind: cannot assign requested address service=udp

Does it unavailable use udp protocol with specific ip?

@darkrasid Thats because you are trying to have 4 different servers listening on the same port on the same host. Try changing the port or sending all the UDP packets to one endpoint and differentiating the data with tags from the application eg measurement,application=app2 value=1

Thank you for answering .

However when I set one udp host, I got error also.

[I] 2017-06-21T02:31:43Z Authentication enabled:true service=httpd
[I] 2017-06-21T02:31:43Z Listening on HTTP:[::]:8086 service=httpd
[I] 2017-06-21T02:31:43Z Starting retention policy enforcement service with check interval of 30m0s service=retention
[I] 2017-06-21T02:31:43Z Failed to set up UDP listener at address 192.0.0.1:8089: listen udp 192.0.0.1::8089: bind: cannot assign requested address service=udp
run: open server: open service: listen udp 192.0.0.1::8089: bind: cannot assign requested address

My udp config setting is

[[udp]]
  enabled = true
  bind-address = "192.0.0.1:8089"
  database = "gitlab"
  retention-policy = ""
  batch-size = 1000
  batch-pending = 5
  read-buffer = 209715200
  batch-timeout = "1s"
  precision = ""

I removed all other udp config. And I use influx on docker container.

Is 192.0.0.1 a valid IP address for your server?

Yes.
192.0.0.1 is just an example but I use valid IP when I test it.
And If I set config file below, data is stored well from the vaild IP.

[[udp]]
  enabled = true
  bind-address = "0.0.0.0:8089"
  database = "gitlab"
  retention-policy = ""
  batch-size = 1000
  batch-pending = 5
  read-buffer = 209715200
  batch-timeout = "1s"
  precision = ""

@darkrasid So setting it to open (0.0.0.0) fixes your issue? If it does not then I think you might be running into some docker issues. What docker image are you using and what is the docker run command?

Yes, it solved.

I misunderstand about setting udp ip.

Using 0.0.0.0:port is works fine.

Thank you for help @JeremySTX @jackzampolin.

1 Like