Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Slightly related to " Other options to "balance source" in haproxy", I would like to know what ports are currently pointed where.

To confirm, I'm using haproxy to distribute clients which make only a single connection at a time to a different port on the proxy, to different backend servers. Assume the protocol is ssh.

I'm using a stick-table to keep clients to one backend server until that server goes down. What's the best way to find out what the current state is?

I know I could make one frontend for each port then point them all at the same backend. The name of the frontend is then logged but i can't help but want one neat frontend with a range of ports and then dst_port logged.

share|improve this question
    
I guess there's always the choice of seeing if I can patch the logging to include dst_prt... Wonder if there's a reason why that's 'hard' or a bad idea. –  PriceChild May 20 '11 at 15:22

2 Answers 2

My current answer/solution (mentioned in the question) is as follows.

I define a different 'listen' for each port to be bound with a recognisable name.

I then ensure option tcplog is enabled for that frontend.

The logging then provides me the two pieces of information I need. The frontend and backend used.

e.g.

haproxy[18989]: 127.0.0.1:34550 [15/Oct/2003:15:24:28.312] frontend backend/server 0/0/5007 0 cD 0/0/0/0/0 0/0

I parse that log file 'magically' and use that information to present the latest status.

option logasap helps..

share|improve this answer
    
One of the downsides to this is it doesn't take into account stick-table expire times unless you're clever. –  PriceChild May 20 '11 at 14:11

I'm not sure if this is what you need.

You can enable the stats on the HAProxy configuration, adding this lines in the :80 port config

stats enable
stats auth YOURUSERNAME:YOURPASSWORD

Then you can go to the URL: http://YOURDOMAIN-OR-IP/haproxy?stats

There you can see the status and redirection HAProxy is doing at any time.

share|improve this answer
    
I'm afraid that doesn't give you the status of the stick-table like I would like. –  PriceChild May 19 '11 at 21:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.