NSX-v Load Balancer Application Rules

Application rules in NSX for vSphere allow you to create advanced load balancing rules which may not be possible with the application profile or services natively available on the Edge Services Gateway (ESG). However, the ESG enables you to add your specific application rules to support your load balancing scenario; application rules are built using HA Proxy syntax.

In the code snippets below, I have included some of the HA Proxy snippets that I have deployed and used on the ESG.

Redirect to another pool

Redirect traffic to another load balancer pool if the primary pool is down. This takes into account that multiple pools are configured on the load-balancer and that all members in the primary pool are down. The only caveat here, is you must specify the Name and not the Pool ID, so be sure to copy it exactly from the Pools configuration pane.

acl pool_down nbsrv(PRIMARY_POOL_NAME) eq 0
use_backend SECONDARY_POOL_NAME if PRIMARY_POOL_NAME

Redirect to external website

Redirect traffic to a external website in the event that all members in the primary pool are down. You may elect to create a static maintenance page such as “site down for maintenance” whilst you bring up the pool members behind the load balancer.

acl pool_down nbsrv(NAME_OF_POOL) eq 0
redirect location http://www.tonysangha.com if pool_down

This post assumes that you have already completedĀ the required steps to setup your application profile, virtual server and monitoring profiles. The only thing you are required to do after creating theĀ application rules is to attach them to the virtual server you want them to be applied to, after which point they are in effect.

Advertisements

1 thought on “NSX-v Load Balancer Application Rules”

  1. Hello,

    I am using above application rule for pool redirection. Issue is that once pool 1 comes back online active connections are not redirecting to pool 1. is there a way to redirect all existing and new connection back to pool 1 once it becomes online?

    Thank you,
    Ronak Patel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s