FreeBSD 8.2+ CARP + Haproxy

Author  : Erika Date  : Agustus, 25 2011 Location  : Indonesia, Jakarta Selatan OS       : FreeBSD 8.2 Title       : High Availa...

Author : Erika
Date : Agustus, 25 2011
Location : Indonesia, Jakarta Selatan
OS      : FreeBSD 8.2
Title      : High Availability Load Balancer Webserver dengan FreeBSD + CARP + Haproxy
Sambil nunggu buka puasa dan nunggu thr cair, saya punya utang artikel sama mas ogeb
kita langsung saja teman2.
Disini saya menggunakan:
## 2 Server yang berfungsi sebagai Load Balancer
masing-masing server menggunakan 2 Interface yaitu ethernet1 ( em0: WAN ) dan ethernet2 ( em1: LAN )
Saya kasih nama LB1 dan LB2
Nama       : LB1
IP WAN ( em0 ): 175.103.XX.Y4
IP LAN ( em1 ): 192.168.0.9
Nama           : LB2
IP WAN ( em0 ): 175.103.XX.Y5
IP LAN ( em1 ): 192.168.0.10

## 4 Server yang berfungsi sebagai webserver ( 2 aktif dan 2 backup )
masing-masing server menggunakan 1 Interface ethernet ( LAN )
Nama          : krn1
IP LAN     : 192.168.0.1 status Haproxy: aktif
Nama          : krn2
IP LAN      : 192.168.0.2 status Haproxy: aktif
Nama      : krn3
IP LAN     : 192.168.0.3 status Haproxy: backup
Nama          : krn4
IP LAN     : 192.168.0.4     status Haproxy: backup
## IP Virtual ( CARP )
3 IP Virtual masing2 ( 175.103.XX.Y1 , 175.103.XX.Y2 , 175.103.XX.Y3 ) 
####################server LB1 dan LB2 ###########################
##Installasi haproxy
$cd /usr/ports/net/haproxy
$sudo make install
$cd /usr/local/etc
$sudo pico haproxy.conf <--- config lihat di bawah artikel ini
##Compile kernel
##disini saya menggunakan FreeBSD 8.2 64bit
cd /usr/src/sys/amd64/conf
echo "device carp" >> GENERIC
config GENERIC
cd ../compile/GENERIC
make depend
make
make install
make clean
sudo pico /etc/rc.conf <----- config bisa di lihat di bawah

sudo pico /etc/sysctl.conf <--- config bisa di lihat di bawah
sudo shutdown -r now     

#################### start config CARF pada LB1 /etc/rc.conf#########
defaultrouter="175.103.XX.1"
hostname="LB1.devbsd.org"
cloned_interfaces="carp0"
ifconfig_em0="inet 175.103.XX.Y4 netmask 255.255.255.0"
ifconfig_carp0="inet 175.103.XX.Y1 vhid 1 pass m4ling advskew 0"
ifconfig_carp0_alias0="175.103.XX.Y2 vhid 1 pass m4ling advskew 0"
ifconfig_carp0_alias1="175.103.XX.Y3 vhid 1 pass m4ling advskew 0"
ifconfig_em1="inet 192.168.0.9 netmask 255.255.255.0"
haproxy_enable="YES"
haproxy_config="/usr/local/etc/haproxy.conf"
############################ end config CARP pada LB1#############
################## start config CARF pada LB2 /etc/rc.conf ##############
defaultrouter="175.103.XX.1"
hostname="LB2.devbsd.org"
cloned_interfaces="carp0"
ifconfig_em0="inet 175.103.XX.Y5 netmask 255.255.255.0"
ifconfig_carp0="inet 175.103.XX.Y1 vhid 1 pass m4ling advskew 100"
ifconfig_carp0_alias0="175.103.XX.Y2 vhid 1 pass m4ling advskew 100"
ifconfig_carp0_alias1="175.103.XX.Y3 vhid 1 pass m4ling advskew 100"
ifconfig_em1="inet 192.168.0.10 netmask 255.255.255.0"
haproxy_enable="YES"
haproxy_config="/usr/local/etc/haproxy.conf"
##############end config CARP pada LB2 ###########################
################start config haproxy LB1 dan LB2 ####################
global
log 127.0.0.1 local0
log 127.0.0.1 syslog debug
maxconn 8192
user www
group www
daemon
nbproc 4
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
stats enable
stats scope .
stats uri /haproxy?stats
stats auth admin:pasW0rd
listen WebFarm 0.0.0.0:80
mode http
balance roundrobin
cookie SERVERID insert indirect
option forwardfor
option httpchk HEAD /check.txt HTTP/1.0
server krn1 192.168.0.206 cookie krn1 check inter 2000 rise 2 fall 5
server krn2 192.168.0.207 cookie krn2 check inter 2000 rise 2 fall 5
server krn3 192.168.0.212 cookie krn7 check inter 2000 backup
server krn4 192.168.0.213 cookie krn8 check inter 2000 backup
#####################end of config haproxy LB1 dan LB2######################
##################################/etc/sysctl.conf####################
net.inet.carp.allow=1
net.inet.carp.preempt=1
net.inet.carp.log=1
################################################################
Shoutz:
~~~~~~~
~ bagan, dono, apay, ping2, hky89, yopi, fuyumi, mrlemonade, ogeb, 1stlink@dalnet
Contact:
~~~~~~~~
erika || MCS|staff || erika[at]devbsd[dot]org

COMMENTS

Name

Application Support,19,database server,1,Desktop/XWindow,1,DNS Server,2,Email Server,3,Firewall,1,FTP Server,2,General,2,IPFilter,1,Kernel,2,Networking,8,Proxy Server,4,Security,6,Tips and Trick,5,Web Server,2,
ltr
item
IndoFreeBSD: FreeBSD 8.2+ CARP + Haproxy
FreeBSD 8.2+ CARP + Haproxy
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMMgs2zq6zw4-8-THiP8s8eT3htgce2irSLgot9M9JAXguet-4W4xxzdLuHB2TqDbqOM9X-JN5fM97HFIogpUf1xHOgXIci3CCRBSr1I9gFUNbM-EBPNuK7ZdxX_EXozfQKPhgTe76JAiA/s1600/haproxy.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMMgs2zq6zw4-8-THiP8s8eT3htgce2irSLgot9M9JAXguet-4W4xxzdLuHB2TqDbqOM9X-JN5fM97HFIogpUf1xHOgXIci3CCRBSr1I9gFUNbM-EBPNuK7ZdxX_EXozfQKPhgTe76JAiA/s72-c/haproxy.png
IndoFreeBSD
http://www.indofreebsd.or.id/2015/02/freebsd-82-carp-haproxy.html
http://www.indofreebsd.or.id/
http://www.indofreebsd.or.id/
http://www.indofreebsd.or.id/2015/02/freebsd-82-carp-haproxy.html
true
1901051463523757307
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content