Postagens

Mostrando postagens de abril, 2016

HAProxy : Load Balancing on Layer4

HAProxy : Load Balancing on Layer4 2015/02/18   Configure HAProxy on Layer4 Mode. This example based on the environment like follows. | -------+----------------------------------------------- | +-------------------+--------------------+ |10.0.0.30 |10.0.0.31 |10.0.0.32 +-----+-----+ +-------+------+ +-------+------+ | Frontend | | Backend#1 | | Backend#2 | | HAProxy | | MariaDB | | MariaDB | +-----------+ +--------------+ +--------------+ [1] Configure HAProxy. [root@dlp ~]#  vi  /etc/haproxy/haproxy.cfg global log 127.0.0.1 local2 info chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 256 maxsslconn 256 user haproxy group haproxy daemon defaults       # set "mode tcp" for Layer4 mode tcp log global timeout con...

HAProxy : Refer to the Statistics#2

HAProxy : Refer to the Statistics#2 2015/02/18   Configure HAProxy to see HAProxy's Statistics with commands. [1] Install some packages. [root@dlp ~]#  yum  -y install socat [2] Configure HAProxy. [root@dlp ~]#  vi  /etc/haproxy/haproxy.cfg # add follows in the "global" section global       # binds UNIX sockets stats socket /var/lib/haproxy/stats [root@dlp ~]#  systemctl  restart haproxy  [3] Refer to the Statistics like follows. # display current stats [root@dlp ~]#  echo  "show info" | socat /var/lib/haproxy/stats stdio Name: HAProxy Version: 1.5.2 Release_date: 2014/07/12 Nbproc: 1 Process_num: 1 Pid: 1953 ... ... Idle_pct: 100 node: dlp.server.world description: # display stas with CSV [root@dlp ~]#  echo  "show stat" | socat /var/lib/haproxy/stats stdio # pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,..... http-in...

HAProxy : Refer to the Statistics#1

Imagem
HAProxy : Refer to the Statistics#1 2015/02/18   Configure HAProxy to see HAProxy's Statistics on the web. [1] Configure HAProxy. [root@dlp ~]#  vi  /etc/haproxy/haproxy.cfg # add follows in the "frontend" section frontend http-in bind *:80       # enable statistics reports stats enable       # auth info for statistics site stats auth admin:adminpassword       # hide version of HAProxy stats hide-version       # display HAProxy hostname stats show-node       # refresh time stats refresh 60s       # statistics reports' URI stats uri /haproxy?stats [root@dlp ~]#  systemctl  restart haproxy  [2] Access to the frontend server from a Client with HTTP/HTTPS, then authentication is required like follows, input the auth info you set in config. [3] Just accessed. It's possible to refer to stati...

HAProxy : SSL Settings

Imagem
HAProxy : SSL Settings 2015/02/18   Configure HAProxy with SSL. The connection between HAproxy and Clients are encrypted with SSL. ( HAproxy - backends are normal ) This example based on the environment like follows . | -------+----------------------------------------------- | +-------------------+--------------------+ |10.0.0.30 |10.0.0.31 |10.0.0.32 +-----+-----+ +-------+------+ +-------+------+ | Frontend | | Backend#1 | | Backend#2 | | HAProxy | | Web Server | | Web Server | +-----------+ +--------------+ +--------------+ [1] Create SSL certificates. [root@dlp ~]#  cd  /etc/pki/tls/certs  [root@dlp certs]#  openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/pki/tls/certs/haproxy.pem -out /etc/pki/tls/certs/haproxy.pem -days 365  Generating a 2048 bit RSA private key ......++++++ .......++++++ writing new private key to '/etc/pki/...

HAProxy : HTTP Load Balancing

Imagem
HAProxy : HTTP Load Balancing 2015/02/18   Install HAProxy to configure Load Balancing Server. This example based on the environment like follows. | -------+----------------------------------------------- | +-------------------+--------------------+ |10.0.0.30 |10.0.0.31 |10.0.0.32 +-----+-----+ +-------+------+ +-------+------+ | Frontend | | Backend#1 | | Backend#2 | | HAProxy | | Web Server | | Web Server | +-----------+ +--------------+ +--------------+   Configure Servers that HTTP connection to HAProxy Server is forwarded to backend Web Servers. [1] Install HAProxy. [root@dlp ~]#  yum  -y install haproxy [2] Configure HAProxy. [root@dlp ~]#  mv  /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.org  [root@dlp ~]#  vi  /etc/haproxy/haproxy.cfg # create new global       # for logging sec...

LVS + Keepalived

LVS + Keepalived 2015/06/10   This is the Redundant configuration for LVS + Keepalived Server itself. This example is based on the environment below. | +----------------+-----------------+ | | 192.168.0.30|eth0 --- VIP:192.168.0.29 --- eth0|192.168.0.31 +-------+--------+ +--------+-------+ | LVS+Keepalived | | LVS+Keepalived | +-------+--------+ +--------+-------+ 10.0.0.30|eth1 ----- VIP:10.0.0.29 ---- eth1|10.0.0.31 | | +----------------+-----------------+ | +------------+ | +------------+ | Backend01 |10.0.0.51 | 10.0.0.52| Backend02 | | Web Server +------------+-------------+ Web Server | | |eth0 eth0| | +------------+ ...

Configure LVS (Linux Virtual Server)

Imagem
Configure LVS (Linux Virtual Server) 2015/06/10   Configure LVS (Linux Virtual Server) to build a load barancer. This example is based on the environment below. | | eth0|192.168.0.30 +----------+ --------------------| LVS |---------------------- +-----+----+ eth1|10.0.0.30 | +------------+ | +------------+ | Backend01 |10.0.0.51 | 10.0.0.52| Backend02 | | Web Server +------------+-------------+ Web Server | | |eth0 eth0| | +------------+ +------------+   HTTP packets to the eth0 on LVS Server are forwarded to Backend01 and Backend02 Servers with NAT. Change the default gateway to internal IP address of LVS on both Backend Web Servers first. (it's 10.0.0.30 on the example) [1] Install ipvsadm. [...

Pound : URL Redirect

Imagem
Pound : URL Redirect 2015/06/09   This is the Redirection settings from URL matching. This example based on the environment like follows. | --------+-------------------------------------------------------------------- | +-------------------+--------------------+--------------------+ |10.0.0.30 |10.0.0.51 |10.0.0.52 |10.0.0.53 +------+-----+ +-------+------+ +-------+------+ +-------+------+ | Frontend | | Backend#1 | | Backend#2 | | Backend#3 | | Pound | | Web Server | | Web Server | | Web Server | +------------+ +--------------+ +--------------+ +--------------+   For example, Configure Pound like that HTTP connections to dlp.server.world are forwarded to Backend#1, HTTP connections to dlp.virtual.host are forwarded to Backend#2, HTTP connections to others except above are forwarded to Backend#3. [1] Configure Pound. [r...