注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Simon

 
 
 

日志

 
 

FreeSwitch + Bluebox High Availability (HA) Cluster using Heartbeat and DRBD  

2013-03-21 14:30:18|  分类: FreeSwitch |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
I need to test FreeSwitch first in a virtual environment before going into production, the objective is to come up with a highly available FreeSwitch cluster using Heartbeat 2.1 and DRBD 8.2. I'm using CentOS 5.5 for this demonstration, the real production servers will be using RHEL5 and has the following hardware specifications as stated in the systems requirement:
IBM X3650 M2
Intel? Xeon? Processor 2.5 Ghz
12GB DDR3 RAM
8 - 146GB SFF SCSI HDD RAID10
2 Integrated Gigabit Ethernet

Installing FreeSwitch

I'm going to install FreeSwitch using the latest stable version 1.0.6 which you can download from http://files.freeswitch.org, it would be nice if I could have used git unfortunately something is blocking it here in the office hence I couldn't get the files using git.

Off to the races, update the OS first.

# yum -y update

Next, make sure you installed the necessary tools to compile FreeSwitch.

# yum install autoconf automake gcc-c++ git-core libjpeg-devel libtool make ncurses-devel openssl-devel perl cpio expat-devel gettext-devel curl-devel curl

Keep things tidy, cd to /usr/src.

# cd /usr/src

Fetch file using wget

# wget http://files.freeswitch.org/freeswitch-1.0.6.tar.gz

Untar file.

# tar xzvf freeswitch-1.0.6.tar.gz

Change directory name to freeswitch (optional)

# mv freeswitch-1.0.6 freeswitch

Go to freeswitch directory and compile. This will take a while so go ahead, take a break, drink a soda or something, I prefer lemon iced tea :D

# cd freeswitch
# ./configure
# make 

 +---------- FreeSWITCH Build Complete ----------+
 + FreeSWITCH has been successfully built.       +
 + Install by running:                           +
 +                                               +
 +                make install                   +
 +-----------------------------------------------+ 

# make install

+---------- FreeSWITCH install Complete ----------+
 + FreeSWITCH has been successfully installed.     +
 +                                                 +
 +       Install sounds:                           +
 +       (uhd-sounds includes hd-sounds, sounds)   +
 +       (hd-sounds includes sounds)               +
 +       ------------------------------------      +
 +                make cd-sounds-install           +
 +                make cd-moh-install              +
 +                                                 +
 +                make uhd-sounds-install          +
 +                make uhd-moh-install             +
 +                                                 +
 +                make hd-sounds-install           +
 +                make hd-moh-install              +
 +                                                 +
 +                make sounds-install              +
 +                make moh-install                 +
 +                                                 +
 +       Install non english sounds:               +
 +       replace XX with language                  +
 +       (ru : Russian)                            +
 +       ------------------------------------      +
 +                make cd-sounds-XX-install        +
 +                make uhd-sounds-XX-install       +
 +                make hd-sounds-XX-install        +
 +                make sounds-XX-install           +
 +                                                 +
 +       Upgrade to latest:                        +
 +       ----------------------------------        +
 +                make current                     +
 +                                                 +
 +       Rebuild all:                              +
 +       ----------------------------------        +
 +                make sure                        +
 +                                                 +
 +       Install/Re-install default config:        +
 +       ----------------------------------        +
 +                make samples                     +
 +                                                 +
 +                                                 +
 +       Additional resources:                     +
 +       ----------------------------------        +
 +       http://www.freeswitch.org                 +
 +       http://wiki.freeswitch.org                +
 +       http://jira.freeswitch.org                +
 +       http://lists.freeswitch.org               +
 +                                                 +
 +       irc.freenode.net / #freeswitch            +
 +                                                 +
 +       Register For ClueCon:                     +
 +       ----------------------------------        +
 +       http://www.cluecon.com                    +
 +                                                 +
 +-------------------------------------------------+
# make cd-sounds-install && make cd-moh-install
# make samples

Once done, test to make sure that FreeSwitch is working! The compilation process including fetching sound files took almost an hour to complete, told you to take a break, didn't I? :D

# cd /usr/local/freeswitch/bin
# ./freeswitch

   _____              ______        _____ _____ ____ _   _
  |  ___| __ ___  ___/ ___\ \      / /_ _|_   _/ ___| | | |
  | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | |  | || |   | |_| |
  |  _|| | |  __/  __/___) |\ V  V /  | |  | || |___|  _  |
  |_|  |_|  \___|\___|____/  \_/\_/  |___| |_| \____|_| |_|

************************************************************
* Anthony Minessale II, Michael Jerris, Brian West, Others *
* FreeSWITCH (http://www.freeswitch.org)                   *
* Paypal Donations Appreciated: paypal@freeswitch.org      *
* Brought to you by ClueCon http://www.cluecon.com/        *
************************************************************

2010-12-29 00:36:26.546866 [CONSOLE] switch_core.c:1578
FreeSWITCH Version 1.0.6 (svn-exported) Started.
Max Sessions[1000]
Session Rate[30]
SQL [Enabled]
freeswitch@pbx1.cluster.local> sofia status

 Name          Type                                       Data      State
=================================================================================================
                 internal       profile         sip:mod_sofia@192.168.136.136:5060      RUNNING (0)
                 external       profile         sip:mod_sofia@192.168.136.136:5080      RUNNING (0)
    external::example.com       gateway                    sip:joeuser@example.com      NOREG
            internal-ipv6       profile                   sip:mod_sofia@[::1]:5060      RUNNING (0)
          192.168.136.136         alias                                   internal      ALIASED
=================================================================================================
3 profiles 1 alias

To shutdown FreeSwitch type "shutdown" or "..." inside the FreeSwitch shell to turn off FreeSwtich. Afterwards, edit PATH to include path to Freeswitch binaries. Create /etc/profile.d/freeswitch.sh, and add the line "export PATH=$PATH:/usr/local/freeswitch/bin".

# vim /etc/profile.d/freeswitch.sh

Add this line --> export PATH=$PATH:/usr/local/freeswitch/bin

Save and exit.

Make /etc/profile.d/freeswitch.sh executable by:

# chmod 755 /etc/profile.d/freeswitch.sh

Be sure to log off and log on back to see changes in effect.

# echo $PATH

Add FreeSwitch user:

# useradd freeswitch

Change freeswitch user passwd setting:

# vim /etc/passwd

freeswitch:x:500:500:Freeswitch:/home/freeswitch:/sbin/nologin

Change ownership of /usr/local/freeswitch.

# chown -R freeswitch:freeswitch /usr/local/freeswitch

To automatically start FreeSwitch at boot, copy /usr/src/freeswitch/build/freeswitch.init.redhat to /etc/init.d/ and make the following changes to PID_FILE, FS_FILE, and FS_HOME parameters:

# vim /etc/init.d/freeswitch

PID_FILE=${PID_FILE-/usr/local/freeswitch/log/freeswitch.pid}
FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/freeswitch}
FS_HOME=${FS_HOME-/usr/local/freeswitch} 

Save and exit.

Next, do the following:

# chmod 755 /etc/init.d/freeswitch
# chkconfig freeswitch on
# chkconfig --list freeswitch

Start FreeSwitch using the rc.d script:

# /etc/init.d/freeswitch start

Wait about 30 seconds for Freeswitch to be up and running, and connect to the server through the console:

# fs_cli

Check SIP status:

freeswitch@internal> sofia status

Check a specific SIP profile:

freeswitch@internal>sofia status profile internal

To exit the console, type "/exit" or "..."; To stop the Freeswitch server and exit the console, type "fsctl shutdown elegant".

Next step would be to clone this machine's current state, this is in order for me to have the second node in a jiffy, I'm using VMWare Workstation by the way.

Configuring DRBD

Make sure you have extra partition for DRBD, mine is on /dev/sda3 on both nodes, it's recommended that they're both have the same disk size.

Install DRBD on both nodes:

# yum install drbd82 kmod-drbd82

Configure DRBD.

# vim /etc/drbd.conf

resource "r0" {
        protocol C;
        disk { on-io-error pass_on; }
        startup { wfc-timeout 30; degr-wfc-timeout 20; }
        syncer { rate 10M; }
        on pbx1.cluster.local {
                device /dev/drbd0;
                disk /dev/sda3;
                address 192.168.136.136:7789;
                meta-disk internal;
        }
        on pbx2.cluster.local {
                device /dev/drbd0;
                disk /dev/sda3;
                address 192.168.136.137:7789;
                meta-disk internal;
        }
}

Save file and exit.

Copy /etc/drbd.conf to node2.

# scp /etc/drbd.conf root@node2:/etc/

Bringing up DRBD.

With DRBD off on both nodes, reboot node1 and watch DRDB during start up, type 'yes' when prompted. 

Login back to node1 and do the following to:

# drbdadm create-md r0

Node1 is now in secondary inconsistent state. Next, reboot node2 to bring up DRBD, once startup is complete login back to node2.

# drbdadm create-md r0

We now have to secondaries in incosistent state, it's time to synchronize them, login back to node1 and promote it to primary.

# drbdadm -- --overwrite-data-of-peer primary r0

Watch DRBD sync.

# watch cat /proc/drbd


Once syncing is done, login to node1 and create filesystem on /dev/drbd0 and test DRBD.


# mkfs.ext3 -L r0 /dev/drbd0


We don't have to repeat this on node2, everything we do on node1 is replicated on node2, that's DRBD at work.

Create /replication partition on both nodes, it will be used as mount point.

Installing and Configuring Heartbeat

Install Heartbeat on both nodes.

# yum install heartbeat

This will install heartbeat together with heartbeat-stonith and heartbeat-pils.

Create the following files under /etc/ha.d/ directory:
authkeys
ha.cf
haresources
Next, you can copy sample configuration files from the /usr/share/doc/heartbeat-version.no. directory, or create one from scratch, we'll do the latter.

# cd /etc/ha.d/
# vim authkeys

auth 1
1 sha1 secretkey!

Save and exit.

Change authkeys permission to 600 or else it will not work.

# chmod 600 authkeys

Next, create ha.cf file.

# vim ha.cf

debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
bcast eth0
auto_failback off
node pbx1.cluster.local
node pbx2.cluster.local

Third, create haresources file.

# vim haresources

pbx1.cluster.local IPaddr::192.168.136.138/24/eth1/192.168.136.255
pbx1.cluster.local drbddisk::r0 Filesystem::/dev/drbd0::/replication::ext3 freeswitch

Save and exit. 

Read sample configuration file which explains each parameter for more details. While in the/etc/ha.d/ directory, copy ha.cf, authkeys, and haresources to node2.

# scp authkeys ha.cf haresources root@pbx:/etc/ha.d/

Hold your horses for now, don't start Heartbeat yet, we still have to configure FreeSwitch to use the DRBD, go to primary node and cd to mounted drbd partition i.e. /replication

# cd /replication

1. Backup FreeSwitch installation first! or use VMWare snapshot functionality in case we messed things up.

# tar czvf usr-local-freeswitch.tar.gz /usr/local/freeswitch

2. Untar usr-local-freeswitch.tar.gz in current drbd directory /replication

# tar xzvf usr-local-freeswitch.tar.gz 

3. Remove /usr/local/freeswitch.

# rm -rf /usr/local/freeswitch

4. Create symbolic link for freeswitch to /usr/local/freeswitch from drbd directory.

# ln -s /replication/usr/local/freeswitch /usr/local/freeswitch

Repeat steps 1 to 4 on node2.

Now for the finale, it's time to start heartbeat on both nodes, I'll show my heartbeat logs to prove that failover is working. 

Check if our FreeSwitch HA cluster is working.

We need to have multiple terminal open to properly monitor the failover i.e. 2 terminals for each node. Monitor ha-debug logs in real time on both nodes by:

# tail -f /var/log/ha-debug

Go to node1, stop heartbeat and see what happens on terminal 2's ha-debug log.

[root@pbx1 ~]# /etc/init.d/heartbeat stop
Stopping High-Availability services:
                                                         [  OK  ]

[root@pbx2 ~]# tail -f /var/log/ha-debug

heartbeat[9455]: 2011/01/04_11:36:45 info: Received shutdown notice from 'pbx1.cluster.local'.
heartbeat[9455]: 2011/01/04_11:36:45 info: Resources being acquired from pbx1.cluster.local.
heartbeat[9455]: 2011/01/04_11:36:45 debug: StartNextRemoteRscReq(): child count 1
heartbeat[9726]: 2011/01/04_11:36:45 info: acquire all HA resources (standby).
heartbeat[9727]: 2011/01/04_11:36:46 info: No local resources [/usr/share/heartbeat/ResourceManager listkeys pbx2.cluster.local] to acquire.
heartbeat[9455]: 2011/01/04_11:36:46 debug: StartNextRemoteRscReq(): child count 1
ResourceManager[9752]:  2011/01/04_11:36:46 info: Acquiring resource group: pbx1.cluster.local IPaddr::192.168.136.138/24/eth1/192.168.136.255
IPaddr[9779]:   2011/01/04_11:36:46 INFO:  Resource is stopped
ResourceManager[9752]:  2011/01/04_11:36:46 info: Running /etc/ha.d/resource.d/IPaddr 192.168.136.138/24/eth1/192.168.136.255 start
ResourceManager[9752]:  2011/01/04_11:36:46 debug: Starting /etc/ha.d/resource.d/IPaddr 192.168.136.138/24/eth1/192.168.136.255 start
IPaddr[9877]:   2011/01/04_11:36:46 INFO: Using calculated netmask for 192.168.136.138: 255.255.255.0
IPaddr[9877]:   2011/01/04_11:36:46 INFO: eval ifconfig eth1:0 192.168.136.138 netmask 255.255.255.0 broadcast 192.168.136.255
IPaddr[9877]:   2011/01/04_11:36:46 DEBUG: Sending Gratuitous Arp for 192.168.136.138 on eth1:0 [eth1]
IPaddr[9848]:   2011/01/04_11:36:46 INFO:  Success
INFO:  Success
ResourceManager[9752]:  2011/01/04_11:36:46 debug: /etc/ha.d/resource.d/IPaddr 192.168.136.138/24/eth1/192.168.136.255 start done. RC=0
ResourceManager[9970]:  2011/01/04_11:36:46 info: Acquiring resource group: pbx1.cluster.local drbddisk::r0 Filesystem::/dev/drbd0::/replication::ext3 freeswitch
ResourceManager[9970]:  2011/01/04_11:36:46 info: Running /etc/ha.d/resource.d/drbddisk r0 start
ResourceManager[9970]:  2011/01/04_11:36:46 debug: Starting /etc/ha.d/resource.d/drbddisk r0 start
ResourceManager[9970]:  2011/01/04_11:36:46 debug: /etc/ha.d/resource.d/drbddisk r0 start done. RC=0
Filesystem[10038]:      2011/01/04_11:36:46 INFO:  Resource is stopped
ResourceManager[9970]:  2011/01/04_11:36:46 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd0 /replication ext3 start
ResourceManager[9970]:  2011/01/04_11:36:46 debug: Starting /etc/ha.d/resource.d/Filesystem /dev/drbd0 /replication ext3 start
Filesystem[10119]:      2011/01/04_11:36:46 INFO: Running start for /dev/drbd0 on /replication
Filesystem[10108]:      2011/01/04_11:36:46 INFO:  Success
INFO:  Success
ResourceManager[9970]:  2011/01/04_11:36:46 debug: /etc/ha.d/resource.d/Filesystem /dev/drbd0 /replication ext3 start done. RC=0
ResourceManager[9970]:  2011/01/04_11:36:46 info: Running /etc/init.d/freeswitch  start
ResourceManager[9970]:  2011/01/04_11:36:46 debug: Starting /etc/init.d/freeswitch  start
Starting freeswitch: [  OK  ]

ResourceManager[9970]:  2011/01/04_11:36:47 debug: /etc/init.d/freeswitch  start done. RC=0
heartbeat[9726]: 2011/01/04_11:36:47 info: all HA resource acquisition completed (standby).
heartbeat[9455]: 2011/01/04_11:36:47 info: Standby resource acquisition done [all].
heartbeat[10243]: 2011/01/04_11:36:47 debug: notify_world: setting SIGCHLD Handler to SIG_DFL
harc[10243]:    2011/01/04_11:36:47 info: Running /etc/ha.d/rc.d/status status
mach_down[10261]:       2011/01/04_11:36:47 info: Taking over resource group IPaddr::192.168.136.138/24/eth1/192.168.136.255
ResourceManager[10287]: 2011/01/04_11:36:47 info: Acquiring resource group: pbx1.cluster.local IPaddr::192.168.136.138/24/eth1/192.168.136.255
IPaddr[10314]:  2011/01/04_11:36:47 INFO:  Running OK
mach_down[10261]:       2011/01/04_11:36:47 info: Taking over resource group drbddisk::r0
ResourceManager[10373]: 2011/01/04_11:36:47 info: Acquiring resource group: pbx1.cluster.local drbddisk::r0 Filesystem::/dev/drbd0::/replication::ext3 freeswitch
Filesystem[10415]:      2011/01/04_11:36:47 INFO:  Running OK
mach_down[10261]:       2011/01/04_11:36:47 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
mach_down[10261]:       2011/01/04_11:36:47 info: mach_down takeover complete for node pbx1.cluster.local.
heartbeat[9455]: 2011/01/04_11:36:47 info: mach_down takeover complete.

As you can see node2 took over from node1 and is now primary, FreeSwitch is now running on node2.

Double check!

[root@pbx2 ~]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/drbd0 on /replication type ext3 (rw)

[root@pbx2 ~]# /etc/init.d/freeswitch status
freeswitch (pid 10253) is running...

As you can see /dev/drbd0 is mounted and FreeSwitch is running.

Start Heartbeat again on node1 and perform the same test, stop Heartbeat on node2 and see what happens on ha-debug log on node1. 

[root@pbx2 ~]# /etc/init.d/heartbeat stop
Stopping High-Availability services:
                                                         [  OK  ]

[root@pbx1 ~]# tail -f /var/log/ha-debug
heartbeat[10484]: 2011/01/04_11:50:17 info: Received shutdown notice from 'pbx2.cluster.local'.
heartbeat[10484]: 2011/01/04_11:50:17 info: Resources being acquired from pbx2.cluster.local.
heartbeat[10484]: 2011/01/04_11:50:17 debug: StartNextRemoteRscReq(): child count 1
heartbeat[10527]: 2011/01/04_11:50:17 info: acquire all HA resources (standby).
ResourceManager[10551]: 2011/01/04_11:50:18 info: Acquiring resource group: pbx1.cluster.local IPaddr::192.168.136.138/24/eth1/192.168.136.255
IPaddr[10590]:  2011/01/04_11:50:19 INFO:  Resource is stopped
IPaddr[10615]:  2011/01/04_11:50:19 INFO:  Resource is stopped
heartbeat[10528]: 2011/01/04_11:50:19 info: Local Resource acquisition completed.
heartbeat[10484]: 2011/01/04_11:50:19 debug: StartNextRemoteRscReq(): child count 2
heartbeat[10484]: 2011/01/04_11:50:19 debug: StartNextRemoteRscReq(): child count 2
heartbeat[10484]: 2011/01/04_11:50:19 debug: StartNextRemoteRscReq(): child count 1
ResourceManager[10551]: 2011/01/04_11:50:19 info: Running /etc/ha.d/resource.d/IPaddr 192.168.136.138/24/eth1/192.168.136.255 start
ResourceManager[10551]: 2011/01/04_11:50:19 debug: Starting /etc/ha.d/resource.d/IPaddr 192.168.136.138/24/eth1/192.168.136.255 start
IPaddr[10781]:  2011/01/04_11:50:19 INFO: Using calculated netmask for 192.168.136.138: 255.255.255.0
IPaddr[10781]:  2011/01/04_11:50:19 INFO: eval ifconfig eth1:0 192.168.136.138 netmask 255.255.255.0 broadcast 192.168.136.255
IPaddr[10781]:  2011/01/04_11:50:19 DEBUG: Sending Gratuitous Arp for 192.168.136.138 on eth1:0 [eth1]
IPaddr[10752]:  2011/01/04_11:50:20 INFO:  Success
INFO:  Success
ResourceManager[10551]: 2011/01/04_11:50:20 debug: /etc/ha.d/resource.d/IPaddr 192.168.136.138/24/eth1/192.168.136.255 start done. RC=0
ResourceManager[10874]: 2011/01/04_11:50:20 info: Acquiring resource group: pbx1.cluster.local drbddisk::r0 Filesystem::/dev/drbd0::/replication::ext3 freeswitch
ResourceManager[10874]: 2011/01/04_11:50:20 info: Running /etc/ha.d/resource.d/drbddisk r0 start
ResourceManager[10874]: 2011/01/04_11:50:20 debug: Starting /etc/ha.d/resource.d/drbddisk r0 start
ResourceManager[10874]: 2011/01/04_11:50:20 debug: /etc/ha.d/resource.d/drbddisk r0 start done. RC=0
Filesystem[10942]:      2011/01/04_11:50:20 INFO:  Resource is stopped
ResourceManager[10874]: 2011/01/04_11:50:20 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd0 /replication ext3 start
ResourceManager[10874]: 2011/01/04_11:50:20 debug: Starting /etc/ha.d/resource.d/Filesystem /dev/drbd0 /replication ext3 start
Filesystem[11023]:      2011/01/04_11:50:20 INFO: Running start for /dev/drbd0 on /replication
Filesystem[11012]:      2011/01/04_11:50:20 INFO:  Success
INFO:  Success
ResourceManager[10874]: 2011/01/04_11:50:20 debug: /etc/ha.d/resource.d/Filesystem /dev/drbd0 /replication ext3 start done. RC=0
ResourceManager[10874]: 2011/01/04_11:50:20 info: Running /etc/init.d/freeswitch  start
ResourceManager[10874]: 2011/01/04_11:50:20 debug: Starting /etc/init.d/freeswitch  start
Starting freeswitch: [  OK  ]

ResourceManager[10874]: 2011/01/04_11:50:21 debug: /etc/init.d/freeswitch  start done. RC=0
heartbeat[10527]: 2011/01/04_11:50:21 info: all HA resource acquisition completed (standby).
heartbeat[10484]: 2011/01/04_11:50:21 info: Standby resource acquisition done [all].
heartbeat[11149]: 2011/01/04_11:50:21 debug: notify_world: setting SIGCHLD Handler to SIG_DFL
harc[11149]:    2011/01/04_11:50:21 info: Running /etc/ha.d/rc.d/status status
mach_down[11165]:       2011/01/04_11:50:21 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
mach_down[11165]:       2011/01/04_11:50:21 info: mach_down takeover complete for node pbx2.cluster.local.
heartbeat[10484]: 2011/01/04_11:50:21 info: mach_down takeover complete.
heartbeat[11200]: 2011/01/04_11:50:21 debug: notify_world: setting SIGCHLD Handler to SIG_DFL
harc[11200]:    2011/01/04_11:50:21 info: Running /etc/ha.d/rc.d/ip-request-resp ip-request-resp
ip-request-resp[11200]: 2011/01/04_11:50:21 received ip-request-resp IPaddr::192.168.136.138/24/eth1/192.168.136.255 OK yes
ResourceManager[11221]: 2011/01/04_11:50:21 info: Acquiring resource group: pbx1.cluster.local IPaddr::192.168.136.138/24/eth1/192.168.136.255
IPaddr[11248]:  2011/01/04_11:50:23 INFO:  Running OK
heartbeat[11306]: 2011/01/04_11:50:23 debug: notify_world: setting SIGCHLD Handler to SIG_DFL
harc[11306]:    2011/01/04_11:50:23 info: Running /etc/ha.d/rc.d/ip-request-resp ip-request-resp
ip-request-resp[11306]: 2011/01/04_11:50:23 received ip-request-resp drbddisk::r0 OK yes
ResourceManager[11327]: 2011/01/04_11:50:23 info: Acquiring resource group: pbx1.cluster.local drbddisk::r0 Filesystem::/dev/drbd0::/replication::ext3 freeswitch
Filesystem[11368]:      2011/01/04_11:50:24 INFO:  Running OK

Check!

[root@pbx1 ~]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/drbd0 on /replication type ext3 (rw)

[root@pbx1 ~]# /etc/init.d/freeswitch status
freeswitch (pid 11145) is running...



Installing Bluebox aka FreePBX3


Since our HA Cluster is already working, installing Bluebox aka FreePBX3 would be a breeze. Bluebox requires MySQL, Apache, and PHP >=5.2. CentOS 5.5 comes with PHP 5.1.6 hence we need to install the EPEL and REMI repository on both nodes.


# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/5/remi/i386/remi-release-5-7.el5.remi.noarch.rpm


Install MySQL, Apache, and PHP on both nodes.


# yum install mysql-server php php-mysql php-gd php-xml php-mbstring php-pdo php-soap php-common httpd


Once your done installing on both nodes, it's now time to configure MySQL to use DRBD.


1. Go to node1 (primary node) and cd to mounted drbd directory and backup MySQL.


# cd /replication
# tar czvf var-lib-mysql.tar.gz /var/lib/mysql


2. Untar var-lib-mysql.tar.gz in current drbd directory /replication


# tar xzvf var-lib-mysql.tar.gz


3. Remove /var/lib/mysql


# rm -rf /var/lib/mysql


4. Create symbolic link for MySQL to /var/lib/mysql from drbd directory.


# ln -s /replication/var/lib/mysql /var/lib/mysql


Repeat steps 1 to 4 on node2.


Configuring Apache.


Create /replication/web directory on both nodes, this directory will be used by Apache.


Next, login to node1 and edit /etc/httpd/conf/httpd.conf and make the following changes.


# vim /etc/httpd/conf/httpd.conf


Replace all instances of "/var/www/html" with "/replication/web".


Save and exit.


Copy to node2.


# scp /etc/httpd/conf/httpd.conf root@pbx2:/etc/httpd/conf/


It's now time to update /etc/ha.d/haresources on both nodes and add MySQL and Apache to the mix, login to node1 and edit haresources.


# vim /etc/ha.d/haresources


pbx1.cluster.local IPaddr::192.168.136.138/24/eth1/192.168.136.255
pbx1.cluster.local drbddisk::r0 Filesystem::/dev/drbd0::/replication::ext3 freeswitch mysqld httpd


Save and exit, and copy to node2.


# scp /etc/ha.d/haresources root@pbx2:/etc/ha.d/


Start Apache and MySQL on the primary node and test!


Finally, install Bluebox on primary node.


# cd /replication/web
# git clone git://source.2600hz.org/bluebox.git
# cd bluebox
# ./preinstall.sh


While on primary node, add bluebox database then login to mysql prompt and do the following:


mysql> CREATE USER 'bluebox'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL ON bluebox.* TO 'bluebox'@'localhost';
mysql> FLUSH PRIVILEGES;


Open web browser and go to http://server_ip/bluebox and follow on-screen instructions to install Bluebox.


We now have a highly available FreeSwitch Cluster with Bluebox using DRDB and Heartbeat.


Cheers!


Many thanks to Vener who provided his valuable insights.


References:


http://www.fredshack.com/docs/freeswitch.html 
http://www.voipkb.com/wiki/index.php/NEW_Install:Linux#CentOS2
  评论这张
 
阅读(1848)| 评论(1)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018