fabiolb / fabio

Consul Load-Balancing made simple
https://fabiolb.net
MIT License
7.25k stars 620 forks source link

TCP no route - cant balance tcp #936

Closed aleksraiden closed 10 months ago

aleksraiden commented 10 months ago

I'll check all 1.6.х versions.

So, I test with just simple config: proxy.addr = 127.0.0.1:6001;proto=tcp

Then, I register my service (Redis-like db) into Consul (yeah, consul enabled by fabio config too) with tag: kvrocksprefix-:28186 proto=tcp - and service works in 28186 port.

Fabio after start correct add new route: `

2023/08/13 21:40:10 [INFO] Version 1.6.1 starting 2023/08/13 21:40:10 [INFO] Go runtime is go1.18.4 2023/08/13 21:40:10 [INFO] Registering metrics provider "" 2023/08/13 21:40:10 [INFO] Metrics disabled 2023/08/13 21:40:10 [INFO] Setting GOGC=100 2023/08/13 21:40:10 [INFO] Setting GOMAXPROCS=24 2023/08/13 21:40:10 [INFO] consul: Connecting to "localhost:8500" in datacenter "dc1" 2023/08/13 21:40:10 [INFO] Admin server access mode "rw" 2023/08/13 21:40:10 [INFO] Admin server listening on ":6998" 2023/08/13 21:40:10 [INFO] Waiting for first routing table 2023/08/13 21:40:10 [INFO] consul: Using dynamic routes 2023/08/13 21:40:10 [INFO] consul: Using tag prefix "kvrocksprefix-" 2023/08/13 21:40:10 [INFO] consul: Watching KV path "/fabio/config" 2023/08/13 21:40:10 [INFO] consul: Watching KV path "/fabio/noroute.html" 2023/08/13 21:40:10 [DEBUG] consul: Manual config changed to #95011 2023/08/13 21:40:10 [INFO] Updated config to 2023/08/13 21:40:10 [INFO] TCP proxy listening on 127.0.0.1:6001 2023/08/13 21:40:10 [DEBUG] consul: Manual config changed to #95011 2023/08/13 21:40:10 [DEBUG] consul: Health changed to #546575 2023/08/13 21:40:10 [INFO] Updated config to route add kvrocks :28186 tcp://10.0.0.11:28186 tags "kvrocks,kvrocks-main" 2023/08/13 21:40:17 [WARN] No route for :6001

`

But every try to connect via 127.0.0.1:6001 get a closing session and [WARN] No route for :6001 in fabio log.

P.S. http rounting in same config are OK, via UI I see may route too...

tristanmorgan commented 10 months ago

If you want a TCP service to be accessible on port 6001 then you need to tag it with "urlprefix-:6001 proto=tcp", your service registration to consul will still have your (containers?) listening on 28186.

(swap the urlprefix for kvrocksprefix by configuring registry.consul.tagprefix)

aleksraiden commented 10 months ago

If you want a TCP service to be accessible on port 6001 then you need to tag it with "urlprefix-:6001 proto=tcp", your service registration to consul will still have your (containers?) listening on 28186.

(swap the urlprefix for kvrocksprefix by configuring registry.consul.tagprefix)

Thanks for helping. In my case, I have a dedicated fabio for each service and I splitting they by prefix (using option registry.consul.tagprefix uniq for each). You think that's all problems in this point? If yes, please, help me, how to split a correct each service by it's own fabio?

By in experiment, I create a fabio instance with no consul, only add a static route - and have this message (No route) too...

aleksraiden commented 10 months ago

Sorry, my mistake, all work OK. A port in Consul tag using for select route port. not a destination. All works for me, thanks @torwig for help