Monday, November 23, 2009

Install heartbeat on Ubuntu Mysql Cluster & HA Proxy

I already done (BUT NOT TESTED YET) my heartbeat installing heartbeat on ubuntu.

$ sudo apt-get install haproxy
$ sudo apt-get install heartbeat


HAproxy

The config file for HAProxy is in "/etc/haproxy.cfg"

here my sample of my haproxy.conf

global
log 127.0.0.1 daemon debug
stats socket /tmp/stats
maxconn 4096
pidfile /var/run/haproxy.pid
daemon

defaults
log global
mode tcp
option dontlognull retries 3 option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000

listen MySQL 172.16.100.240:3306
mode tcp
option httpchk
stats enable
stats uri /haproxy-stats
balance roundrobin

server mysql_master 172.16.100.241:3306
server mysql_slave 172.16.100.242:3306

Heartbeat

/etc/ha.d/ha.cf #main config file
/etc/ha.d/authkeys #authorization keys file

/etc/ha.d/haresource #share resources on nodes

example on my conf :

You must set on both machines

Primary machine Secondary machine
keepalive 2

warntime 10

deadtime 25

initdead 50

udpport 694

auto_failback on

bcast eth0

node niti.joey.net

node niti.aniket.net

debugfile /var/log/ha-debug

logfile /var/log/ha-log

keepalive 2

warntime 10

deadtime 25

initdead 50

udpport 694

auto_failback on

bcast eth1

node niti.joey.net

node niti.aniket.net

debugfile /var/log/ha-debug

logfile /var/log/ha-log


haresources conf

ubuntu-mysqlclusterA 172.168.1.241/24/eth0 # set in machine B

ubuntu-mysqlclusterB 172.168.1.242/24/eth0 # set in machine A

authkeys

Syntax:
auth
[]

example :

auth 1

1 md5 mypassword

Starting Heartbeat’s Services

Once, you are through with the above configurations in both of the machines, use the following to start the Heartbeat daemon.

$ /etc/init.d/heartbeat start

This command has to be run simultaneously on both the machines.

Following commands can also be used as required:

$ /etc/init.d/heartbeat stop

$ /etc/init.d/heartbeat restart


Reference for my project :

Thanks and credits to these blog and people :

http://theitaxis.wordpress.com/2009/11/14/heartbeat-a-step-by-step-configuration-guide-to-high-availability-linux-clusters/

http://raghupathy.wordpress.com/2008/05/01/high-availabilitycluster-with-load-balancing-by-using-heartbeat-and-haproxy/

http://oceanobservatories.org/spaces/display/CIDev/High+availability+Load+Balancer+-+HAProxy+and+heartbeat


Uninstall / Delete / Remove Package on Ubuntu

For example remove package called mplayer, enter:

$ sudo apt-get remove mplayer

Remove package called lighttpd along with all configuration files, enter:

$ sudo apt-get --purge remove lighttpd

To list all installed package, enter:\

dpkg --list
dpkg --list | less
dpkg --list | grep -i 'http'

Sunday, November 22, 2009

Change hostname on CentOS

Change the hostname machine running CentOS.
  • Login with putty.exe / or SSH
  • Goto : cd /etc/sysconfig/
  • Type vi / nano network
  • Press i (for VI) on the keyboard and change the HOSTNAME to your preferred servername
  • Press ESC on the keyboard
  • Save the configuration by :wq! (For VI) or control x and save Y (for nano)
  • Reboot

Thursday, November 19, 2009

Squid Guard

This summary is not available. Please click here to view the post.

Wednesday, November 4, 2009

FreeBSD Check CPU Info

as root run this :

# sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'