Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabio config help with TCP #485

Open
satishviswanathan opened this issue Apr 18, 2018 · 30 comments
Open

Fabio config help with TCP #485

satishviswanathan opened this issue Apr 18, 2018 · 30 comments

Comments

@satishviswanathan
Copy link

satishviswanathan commented Apr 18, 2018

I'm new to Fabio and trying to set with following configuration but getting warning "syntax error: 'route add' invalid"

This is the command I've used in windows.

fabio-1.5.8-go1.10-windows_amd64.exe -registry.consul.addr 10.208.x.xx:8500 -proxy.addr :2302;proto=tcp
Fabi log Fabio-log.txt

@satishviswanathan satishviswanathan changed the title Fabio config help Fabio config help with TCP Apr 18, 2018
@aaronhurt
Copy link
Member

aaronhurt commented Apr 18, 2018

What do you have in your KV at /fabio/config? The attached log looks like it is reading your command line parameters correctly. That only leaves the contents of the keystore unknown.

@satishviswanathan
Copy link
Author

satishviswanathan commented Apr 18, 2018

Are you referring to the KV store in consul? attaching the consul KV

@aaronhurt
Copy link
Member

Yes, but what is inside the /fabio/config path.

@satishviswanathan
Copy link
Author

I'm sorry would you be able to guide me where to find this?

@aaronhurt
Copy link
Member

Navigate to fabio/config in your key store. Something like: http://10.208.6.98:8500/ui/#/dc1/kv/fabio/config/edit

@satishviswanathan
Copy link
Author

When I access the url I'm getting this error.

consul-error

@aaronhurt
Copy link
Member

Sorry, that was just an example ... you're actual path might be different depending on your datacenter name. Really I was just wanting to know if you had anything in your consul KV store under fabio/config. That's the default path for additional configuration and what I see being used in the log segment you attached.

            "Addr": "10.208.6.98:8500",
            "Scheme": "http",
            "Token": "",
            "KVPath": "/fabio/config",
            "NoRouteHTMLPath": "/fabio/noroute.html",

@aaronhurt
Copy link
Member

Ohh, I think I may see the issue ... can you try leaving registry.consul.tagprefix as the default value? Also the default consul address is localhost (127.0.0.1) ... so you shouldn't need to pass registry.consul.addr as it looks like you have consul and fabio running on the same host.

@satishviswanathan
Copy link
Author

Currently I was trying to get it working on my dev box which is Windows operating system and I have both Consul and Fabio running on the same box but I'm using my machine IP instead of localhost (127.0.0.1)

@aaronhurt
Copy link
Member

aaronhurt commented Apr 18, 2018

You should be able to start consul agent -dev and fabio on the same machine without any other options and get a working example. The addition of proto=tcp is also telling fabio to run as a TCP load balancer vs an HTTP load balancer.

@aaronhurt
Copy link
Member

aaronhurt commented Apr 18, 2018

Literally...

Window 1:

consul agent -dev

Window 2:

fabio

@satishviswanathan
Copy link
Author

You are right we can start consul agent -dev but that will use localhost right, but I want to use my machine IP

@satishviswanathan
Copy link
Author

Am I missing any configuration here, any help is highly appreciated

@magiconair

@aaronhurt
Copy link
Member

@satishviswanathan I think you need to start with a known clean state and then add as you progress. The errors you are seeing don't make sense with a clean configuration.

@satishviswanathan
Copy link
Author

I've now started clean

  1. Running consul as localhost
  2. Registered health check
  3. Registered TCP services
  4. Tried running Fabio with 2 different options with following results.

fabio-1.5.8-go1.10-windows_amd64.exe -proxy.addr :2302;proto=tcp
Fabio-log1.txt

fabio-1.5.8-go1.10-windows_amd64.exe -proxy.addr :2302;proto=tcp -registry.consul.tagprefix urlprefix-:2302
Fabio-log2.txt

@aaronhurt
Copy link
Member

Ahh, okay so ... what do your service registrations look like? What is your urlprefix tag on the service?

@satishviswanathan
Copy link
Author

Thank you for your support.

This is the config I've used for service registration.
Register-Service.txt

@magiconair
Copy link
Contributor

magiconair commented Apr 19, 2018 via email

@magiconair
Copy link
Contributor

magiconair commented Apr 19, 2018 via email

@satishviswanathan
Copy link
Author

When I remove the option registry.consul.urlprefix I get the following error.

syntax error: 'route add' invalid

@magiconair
Copy link
Contributor

magiconair commented Apr 19, 2018 via email

@satishviswanathan
Copy link
Author

satishviswanathan commented Apr 19, 2018

Thank you. I added the log and identified that while registering the consul service I had a "space" in the name. eg: "Service Check 1" which was causing the issue.

Now when i start fabio i can see the routes getting added. But when i access from my client application I'm getting the following error.

-registry.consul.addr 10.203.xxx.xx:8500 -proxy.addr :2302;proto=tcp

[WARN] No route for 10.203.xxx.xx:2302/v1/kv/orleans/Order_Cluster1?recurse

@magiconair
Copy link
Contributor

Try urlprefix-:2302 proto=tcp as tag when you register the service. Otherwise this is an HTTP service.

@satishviswanathan
Copy link
Author

satishviswanathan commented Apr 20, 2018

My consul service registration is having urlprefix

{
   "ID": "ServiceCheck1",
  "Name": "ServiceCheck1",
  "Notes": "serviceService 1",
  "Address": "10.208.x.xx",
  "Port": 11111,
  "Tags": ["urlprefix-:2302 proto=tcp"],
  "EnableTagOverride": false,
  "Check":{
  	"DeregisterCriticalServiceAfter": "90m",
    "TCP": "10.208.x.xx:11111",
    "Interval": "10s"
  }
}

while running fabio do I need to get this same option too?

@satishviswanathan
Copy link
Author

satishviswanathan commented Apr 20, 2018

2018/04/20 10:57:20 [INFO] HTTP proxy listening on :2302
2018/04/20 10:57:20 [INFO] Access logging disabled
2018/04/20 10:57:20 [INFO] Using routing strategy "rnd"
2018/04/20 10:57:20 [INFO] Using route matching "prefix"
2018/04/20 10:57:20 [INFO] consul: Registered fabio as "fabio"
2018/04/20 10:57:20 [INFO] consul: Registered fabio with id "fabio-9998"
2018/04/20 10:57:20 [INFO] consul: Registered fabio with address "10.203.xxx.xx"
2018/04/20 10:57:20 [INFO] consul: Registered fabio with tags ""
2018/04/20 10:57:20 [INFO] consul: Registered fabio with health check to "http://[10.203.106.62]:9998/health"
2018/04/20 10:57:20 [INFO] Config updates
+ route add ServiceCheck1:2302 tcp://10.208.x.xx:11111

Now when I access 10.203.xxx.xx:2302 from my client application, I'm getting the following error
No route for 10.203.xxx.xx:2302/v1/kv/orleans/Cluster1?recurse

@magiconair
Copy link
Contributor

This is still starting the HTTP listener instead of the TCP.

2018/04/20 10:57:20 [INFO] HTTP proxy listening on :2302

This is most likely an issue with semicolon in the proxy.addr parameter. Unfortunate choice of separators :(

Try this:

fabio -proxy.addr ':2302;proto=tcp'

and you should see

2018/04/20 20:30:52 [INFO] TCP proxy listening on :2302

@magiconair
Copy link
Contributor

@satishviswanathan Thanks for being patient and persistent!

@satishviswanathan
Copy link
Author

satishviswanathan commented Apr 20, 2018

I'm using the following command where I've mentioned the proto as tcp
-registry.consul.addr 10.203.xxx.xx:8500 -proxy.addr :2302;proto=tcp

But still the log shows
[INFO] TCP proxy listening on :2302

Not sure what I'm missing

@satishviswanathan
Copy link
Author

Got it, my mistake I was missing the quotes 10.203.xxx.xx:8500 -proxy.addr : '2302;proto=tcp'

Now trying to get the client connected via fabio

@satishviswanathan
Copy link
Author

Now when my client application try to connect to fabio @ port 2302, I'm getting the following error.

tcp: read tcp 10.xxx.x.xx:50690->10.xxx.x.xx:11111: wsarecv: An existing connection was forcibly closed by the remote host.

One of my service is running @ 10.xxx.x.xx:11111 and it is also listed in fabio routing table.

Please advice what can be done to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants