Re: Simple health check return... -- without backend needed?

2013-01-17 Thread Joel Krauska
On Thu, Jan 17, 2013 at 3:27 PM, Jonathan Matthews
wrote:

> On 17 January 2013 23:02, Joel Krauska  wrote:
> > Is there a simple way to have haproxy send a simple response for a given
> > URL?
> >
> > Matching somewhat the functionality of Nginx's empty_gif module?
> > http://wiki.nginx.org/HttpEmptyGifModule
> > I don't need to send an actual empty gif, but just a simple 200 and OK
> would
> > be fine.
> >
> > Use case would be to have an ACL that when matched always responds with a
> > simple 200.
> > (external check to make sure HAProxy is functional without needing to hit
> > any backends.)
>
> Sounds like you want to configure "monitor-uri":
> http://cbonte.github.com/haproxy-dconv/configuration-1.4.html#monitor-uri.
>
>
monitor-uri looks like it would only work as a path match.

I need to match a Host header.

eg.
ping.example.com (always return 200 when haproxy is running)
vs
www.example.com  (proxy to backend pool)


Re: Tactics for load balancing all connections

2013-01-17 Thread Unai Rodriguez
Yes that works in the way I mentioned (cookies then source IP) 

Sent from mobile, please excuse brevity/typos. 

- Reply message -
From: "James Bensley" 
To: 
Subject: Tactics for load balancing all connections
Date: Fri, Jan 18, 2013 03:19


Hi Unai,

Well that is what I have in the configuration, as I included in my
first email, but will this actually work? Does HAProxy support listing
more than one mechanism at once? If so, is there some sort of priority
list on which I can see the order they are used in?

Many thanks,
James.



Re: Simple health check return... -- without backend needed?

2013-01-17 Thread Jonathan Matthews
On 17 January 2013 23:02, Joel Krauska  wrote:
> Is there a simple way to have haproxy send a simple response for a given
> URL?
>
> Matching somewhat the functionality of Nginx's empty_gif module?
> http://wiki.nginx.org/HttpEmptyGifModule
> I don't need to send an actual empty gif, but just a simple 200 and OK would
> be fine.
>
> Use case would be to have an ACL that when matched always responds with a
> simple 200.
> (external check to make sure HAProxy is functional without needing to hit
> any backends.)

Sounds like you want to configure "monitor-uri":
http://cbonte.github.com/haproxy-dconv/configuration-1.4.html#monitor-uri.

Jonathan
-- 
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html



Simple health check return... -- without backend needed?

2013-01-17 Thread Joel Krauska
Is there a simple way to have haproxy send a simple response for a given
URL?

Matching somewhat the functionality of Nginx's empty_gif module?
http://wiki.nginx.org/HttpEmptyGifModule
I don't need to send an actual empty gif, but just a simple 200 and OK
would be fine.

Use case would be to have an ACL that when matched always responds with a
simple 200.
(external check to make sure HAProxy is functional without needing to hit
any backends.)

Can an acl respond with errorcode 200?

Would creating a backend with no members and changing the 500 response file
to look like a 200 response file work?
(seems hacky)

Any advice?

Thanks,

Joel


Re: Tactics for load balancing all connections

2013-01-17 Thread James Bensley
On 17 January 2013 12:39, Jonathan Matthews  wrote:
> From the fine documentation:
>
> ---
>   appsession
>
> The "otherwise" caveat sounds like what you're looking for.

Thanks for the info Jonathan.

I am aware of the appsession feature, however when I trialled it I
could get it to evenly distribute the traffic.

Under my current configuration which I previously posted, I think
there is a very uneven distribution of traffic to the two back-end
servers. I need to look through the logs and confirm what the ratio
is, but just looking at the graphs for network traffic, CPU load and
memory usage; One back-end server is using much more than the other.

Cheers,
James.



Re: Tactics for load balancing all connections

2013-01-17 Thread James Bensley
Hi Unai,

Well that is what I have in the configuration, as I included in my
first email, but will this actually work? Does HAProxy support listing
more than one mechanism at once? If so, is there some sort of priority
list on which I can see the order they are used in?

Many thanks,
James.



Re:

2013-01-17 Thread Baptiste
I'm sorry, but you must first help yourself before asking help to
third parties...

there is a single link for you to start with: http://www.google.fr

good luck

Baptiste


On Thu, Jan 17, 2013 at 3:27 PM, John Paul Iglesia  wrote:
> Hi,
>
> Can you give me a more detail step by step procedure? Or even a link that I
> can work with?
>
> I installed Debian 6 on my two VM's.
>
> I  really appreciate your help.
>
> Hoping that you can help me further until I'm finish with the setup that I'm
> making!
>
> Tnx--
>
>> Date: Thu, 17 Jan 2013 08:59:33 +0100
>> Subject: Re:
>> From: bed...@gmail.com
>> To: zcyc...@hotmail.com
>> CC: haproxy@formilux.org
>
>>
>> Hi John,
>>
>> To know your server's IP address, use either "ifconfig" or "ip
>> address" commands.
>> And Yes, your installation proposal is doable with the quoted components.
>>
>> cheers
>>
>>
>> On Thu, Jan 17, 2013 at 6:51 AM, John Paul Iglesia 
>> wrote:
>> > Hi,
>> >
>> > I would like to how can I know my server IP? And is it possible to run
>> > haproxy on first vm and the webserver on the other vm?
>> >
>> > Here is the complete set up :
>> >
>> > 1st VM has haproxy and nginx.
>> > 2nd VM has apache and mysql.
>> >
>> > Is it possible?
>> >
>> > Hoping for your quick response!
>> >
>> > Tnx
>> >
>> >



Re: Tactics for load balancing all connections

2013-01-17 Thread Unai Rodriguez
If you use load balance source and then cookies HAProxy will load balance based 
on the cookies and if they are not there (i.e. not supported by the client) 
then based on source IP. I think this is what you want right?

Sent from mobile, please excuse brevity/typos. 

- Reply message -
From: "Jonathan Matthews" 
To: 
Subject: Tactics for load balancing all connections
Date: Thu, Jan 17, 2013 20:39


On 17 January 2013 12:24, James Bensley  wrote:
> Howdy All,
>
> I wondered if anyone could entertain me with some ideas and thoughts
> on being able to load balance all connections that pass through
> HAProxy, perhaps by using more that one method, to "catch all"
> connections (I have a single box set up in mind which is troubling
> me). I have placed a snippet of the config below. We are inserting a
> cooking to the request, either s1 for server1 or s2 for server2 so
> that customers are having sticky sessions with the web servers. For
> customers that don't support cookies, the servers redirect the user to
> a different URL that carries the session ID in the URL all throughout
> the session (an SSL session is terminated in front of HAProxy, so
> HAProxy is HTTP only below).In the cookie-less scenario we would like
> to use source IP based balancing; whilst this isn't the most even
> distribution of traffic, it will be a minority of traffic.
>
> So, can I enable two balancing techniques? Is there a way of having
> priority based balancing so cookies are preferred, failing that,
> source IP?

From the fine documentation:

---
  appsession

[snip]

  When an application cookie is defined in a backend, HAProxy will check when
  the server sets such a cookie, and will store its value in a table, and
  associate it with the server's identifier. Up to  characters from
  the value will be retained. On each connection, haproxy will look for this
  cookie both in the "Cookie:" headers, and as a URL parameter (depending on
  the mode used). If a known value is found, the client will be directed to the
  server associated with this value. Otherwise, the load balancing algorithm is
  applied.
---

The "otherwise" caveat sounds like what you're looking for.

Jonathan
-- 
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html



Re: Tactics for load balancing all connections

2013-01-17 Thread Jonathan Matthews
On 17 January 2013 12:24, James Bensley  wrote:
> Howdy All,
>
> I wondered if anyone could entertain me with some ideas and thoughts
> on being able to load balance all connections that pass through
> HAProxy, perhaps by using more that one method, to "catch all"
> connections (I have a single box set up in mind which is troubling
> me). I have placed a snippet of the config below. We are inserting a
> cooking to the request, either s1 for server1 or s2 for server2 so
> that customers are having sticky sessions with the web servers. For
> customers that don't support cookies, the servers redirect the user to
> a different URL that carries the session ID in the URL all throughout
> the session (an SSL session is terminated in front of HAProxy, so
> HAProxy is HTTP only below).In the cookie-less scenario we would like
> to use source IP based balancing; whilst this isn't the most even
> distribution of traffic, it will be a minority of traffic.
>
> So, can I enable two balancing techniques? Is there a way of having
> priority based balancing so cookies are preferred, failing that,
> source IP?

>From the fine documentation:

---
  appsession

[snip]

  When an application cookie is defined in a backend, HAProxy will check when
  the server sets such a cookie, and will store its value in a table, and
  associate it with the server's identifier. Up to  characters from
  the value will be retained. On each connection, haproxy will look for this
  cookie both in the "Cookie:" headers, and as a URL parameter (depending on
  the mode used). If a known value is found, the client will be directed to the
  server associated with this value. Otherwise, the load balancing algorithm is
  applied.
---

The "otherwise" caveat sounds like what you're looking for.

Jonathan
-- 
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html



Tactics for load balancing all connections

2013-01-17 Thread James Bensley
Howdy All,

I wondered if anyone could entertain me with some ideas and thoughts
on being able to load balance all connections that pass through
HAProxy, perhaps by using more that one method, to "catch all"
connections (I have a single box set up in mind which is troubling
me). I have placed a snippet of the config below. We are inserting a
cooking to the request, either s1 for server1 or s2 for server2 so
that customers are having sticky sessions with the web servers. For
customers that don't support cookies, the servers redirect the user to
a different URL that carries the session ID in the URL all throughout
the session (an SSL session is terminated in front of HAProxy, so
HAProxy is HTTP only below).In the cookie-less scenario we would like
to use source IP based balancing; whilst this isn't the most even
distribution of traffic, it will be a minority of traffic.

So, can I enable two balancing techniques? Is there a way of having
priority based balancing so cookies are preferred, failing that,
source IP? If not, what do others do if you want to use balancing
method A, but some clients might not fit into the criteria for that?

Cheers,
James.

global
log 127.0.0.1   local0 notice info
user haproxy
group haproxy
daemon
stats socket /var/run/haproxy/haproxy.sock mode 0600 level admin

defaults
log global
modehttp
option  httplog
option  dontlognull
retries 3
maxconn 1
contimeout  5000
clitimeout  5
srvtimeout  5

listen  https-iis-servers   127.0.0.1:80

cookie apps insert
option persist
option redispatch

# Active WebApp servers
server  server1 192.168.1.1:80 cookie s1 check inter 2000 rise 3 fall 3
server  server2 192.168.1.2:80 cookie s2 check inter 2000 rise 3 fall 3

balance source



Re: Session stickiness based on appsession. JSESSIONID twice on some log lines.

2013-01-17 Thread Unai Rodriguez

On 2013-01-16 16:49, Baptiste wrote:

Hi,

Please remove the "cookie JSESSIONID prefix" line from your 
configuration.


Yes, THAT WORKS, thank you so much!!!



Re:

2013-01-17 Thread Baptiste
Hi John,

To know your server's IP address, use either "ifconfig" or "ip
address" commands.
And Yes, your installation proposal is doable with the quoted components.

cheers


On Thu, Jan 17, 2013 at 6:51 AM, John Paul Iglesia  wrote:
> Hi,
>
> I would like to how can I know my server IP? And is it possible to run
> haproxy on first vm and the webserver on the other vm?
>
> Here is the complete set up :
>
> 1st VM has haproxy and nginx.
> 2nd VM has apache and mysql.
>
> Is it possible?
>
> Hoping for your quick response!
>
> Tnx
>
>