Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. ·...

13
pg. 1 Snapt HAProxy Manual Version 1.5

Transcript of Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. ·...

Page 1: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 1

Snapt HAProxy Manual

Version 1.5

Page 2: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 2

Contents

Chapter 1: Summary ............................................................................................................... 3

Chapter 2: Installation ............................................................................................................. 4

Chapter 3: Initial Setup ........................................................................................................... 5

Chapter 4: First-run Wizard...................................................................................................... 6

Chapter 5: Your First Group .................................................................................................... 7

Chapter 6: Viewing your Group .......................................................................................... 11

Chapter 7: Moving Forward ................................................................................................. 13

Page 3: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 3

Chapter 1: Summary

Snapt HAProxy is a powerful, feature packed load balancing solution. I t allows

intelligent load balancing, health checking and protocol monitoring for any TCP

based serv ice.

All Snapt products run on the Snapt Framework – a platform which gives an easy to

use interface, reporting, user and access control and much more to you.

Snapt is available in many forms. I f you are just starting out you may want to look at

using a VM image from us (VMWare, OVF, Xen) or installing from our ISO/LiveCD.

Alternatively, if you already have a Linux or BSD device you want to install Snapt on

you can use a bundled package if it is available for your OS, or install your own

webserver to run Snapt inside of.

There are several help files and documents available in order to help you install the

initial framework; this manual will assume that has already been done.

Page 4: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 4

Chapter 2: Installation

Installing Snapt HAProxy is simple once you have the Snapt Framework up and

running. Under the Setup menu, you will find Snaptins & Plugins where you can install

the Snaptin called HAProxy Manager.

Click Install to begin the download automatically, after which you can refresh the

Manage Plugins page and click Enable to enable your new Snaptin. Refresh once

again and you will notice you now have an HAProxy menu.

Page 5: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 5

Chapter 3: Initial Setup

Snapt supports starting fresh or integrating with an existing HAProxy setup. For this

reason, when you first visit the HAProxy module you will be guided through an initial

setup process. During this we will discover your configuration files, start-up scripts and

binaries for HAProxy.

At this stage it is required that you have HAProxy installed. Depending on your

operating system you can do this with one of the following commands. I f you are

using a v irtual image from us you can skip this.

UBUNTU, DEBIAN, ETC

apt-get install haproxy

REDHAT, FEDORA, ETC

yum install haproxy

FREEBSD

cd /usr/ports/net/haproxy make install

Now you can v isit the main HAProxy page in Snapt. Simply click the HAProxy icon in

your menu and you will be directed to the configuration page shown below.

Typically all the defaults will be fine, if not you will be given instructions.

Click Continue Integration and then Finalise Integration.

Page 6: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 6

Chapter 4: First-run Wizard

Now that you have fully integrated Snapt with your HAProxy install, you will be

prompted to run the wizard. This is highly advised as it not only helps with initial

options but also sets up the logging and reporting for Snapt HAProxy.

Click Start the wizard to begin, then follow the guided process as you setup your

Snapt HAProxy load balancer. I f you are unsure of any settings just continue to Save

the settings on each page as the defaults are fine.

When you get to Logging options you need to decide if you would like to enable

logging, which is highly recommended for stats, and whether you want the system

to notify you when events occur in HAProxy, and what severity you wish to receive.

Page 7: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 7

Chapter 5: Your First Group

Snapt has two distinct types of load balancing groups available, the most simple is

simply what we call a group and it is the preferred method for 95% of the uses so we

recommend starting with that.

The second type is a frontend-backend combo. A group prov ides both a frontend

(the listener, e.g. port 80) and a backend (the task of sending requests to servers).

The reason you may want to split this in the future is if you have a different backend

for static content such as images, CSS, and html, and another for dynamic content

such as PHP.

To add a group, go to Group Management under the HAProxy Menu and then the

Add Group tab.

If you see other groups that you do not recognise on a fresh install, please delete

them as some Linux packages include a “default” configuration which you will not

need.

The group name is purely for reporting and management purposes, so call it

something you will recognise.

The IP address will typically be Any, meaning it will listen on all the IP’s available on

your server. However, if you have multiple groups running on the same port you will

want to specify this.

Port number is the port the load balancer should accept connections on, typically

80 for web, or 25 for email and so on.

Page 8: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 8

Step 2 of adding your group is the configuration of how that group will function.

What method should it use for balancing the load, how many connections should it

allow, what protocol tests to do and so on.

Each balance method can be selected individually for a full description of how it

works. The most widely used one is Round-robin, which just balances each new

connection to the next server.

Balance Mode needs to be set specifically based on what you intend to load

balance. HTTP mode can only be used with standard web traffic (port 80), and

anything else should use TCP mode.

Each option on this page also has a tooltip (hover over the option name) for more

information.

There are several tabs at the top of the page as well. Protocol tests allow you to

perform more advanced tests on each server in the group to determine whether

they are up or not. For example, SSL Check will check that the port is not just open,

but also responds to a valid SSL request.

HTTP Options are group options specifically for HTTP traffic. This allows you to do

things like header modification, cookie insertion and more.

For a standard user, the first tab is all that is required as the defaults are sufficient.

Page 9: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 9

Once you have added your group, you will automatically be taken to add servers to

that group. Servers are the actual services which you are load balancing, for

example, your web servers.

Here you will name them (again, for reporting reasons) and give their IP address and

port.

After submitting this form you will be given the opportunity to configure specifics for

that server, such as server weight, max connections, and more. Again, the defaults

are sufficient for a standard user.

Page 10: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 10

Once you have saved your first server you technically have enough to begin load

balancing already, and can restart HAProxy to test it. However, the purpose of a

load balancer is of course to manage more than one host, so we advise you add

the rest of your servers at this stage.

Once you have done that, you will be able to go to the home screen of the HAProxy

module and start/restart your server.

You will now be able to see a quick summary on the dashboard for your group

(SnaptWeb in our example). You can then also use the tabs on the HAProxy module

front page to v iew a live dashboard, graphs, and more.

Page 11: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 11

Chapter 6: Viewing your Group

Now that you have a group up and running you can begin to store statistics for it, do

reporting, access advanced options and more.

The first step is familiarizing yourself with the interface and the status pages so that

you can monitor your servers. On your main HAProxy page you will see several tabs,

with a fortune of information about the current status of your load balancer.

Most of these tabs are also available in a fullscreen popup for datacentre

management. Start with server overview and the live dashboard – these will give you

a quick v iew of the situation.

The next step is Live Graphs; here you can v iew in real time the throughput on your

groups.

Page 12: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 12

I f you have enabled logging, you will also now be able to run reports through the

Reports module. Here you can see historic (in 5 minute intervals) data about your

groups – errors, hits, sessions, queues and much more.

The proxy throughput report will show you the stats across the entire “group”, the

overall load for your group, whereas the server error and throughput reports allow

you to focus on the servers in a specific group.

These can be critical for tracing errors, evaluating server performance and the like.

Page 13: Snapt HAProxy Manualkb.snapt-ui.com/wp-content/uploads/2012/03/Snapt-HAProxy... · 2012. 6. 5. · Snapt HAProxy is a powerful, feature packed load balancing solution. It allows intelligent

pg. 13

Chapter 7: Moving Forward

Now that you have an understanding of how the Snapt UI functions you can

continue to grow your load balancer, and begin to look at some of the advanced

features you can use.

Set up email and/or SMS alerts for when groups go down, improve the monitoring of

your groups with protocol checks and evaluate the performance servers are giving

in reports.