How to Install a TwinStar-based Asterisk Cluster on

How to Install a TwinStar-based Asterisk Cluster on
Two Elastix 1.6 Servers
Document version: 1.2
Date:
13 July 2010
Before You Begin – Important Notes
•
Please note that some configuration steps are to be performed on both servers while
others are to be performed on the Primary server only.
•
The “Primary server” mentioned in this document refers to the server to which the
Astribank(s) “Main” USB socket is connected.
•
Power off all Astribank devices before you begin the installation procedure.
I. Actions to be Performed on Both Servers
1.1 Install the Elastix 1.6 Software
During the standard Elastix 1.6 installation procedure select the “Create custom layout”
option in the “Partitioning” dialog. Then configure the desired hard disk layout according
the following recommendations.
The size of the DRBD partition needs to be specified. All files destined for replication
between the servers will be located in that partition. It is logical to place potentially disk
space consuming files there, such as the call recording files and voice mail messages.
Therefore, it is likely that the DRBD partition will be the biggest partition on the disk.
Also, we recommend using the sda2 partition as the DRBD partition. It is because sda2 is
used as the default partition in the servers' configuration scripts. If a different partition is
used it will be necessary to define it later in the /usr/share/twinstar_config.conf file (ref.
p. 2.2.).
The following hard disk partitioning approach is recommended:
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
Partition
Mount Point Size
File
System
sda1
/boot
100 MB
ext3
sda2
/MARKER
Use the following formula:
HD Size – 20000MB- RAM Size -100 MB
ext3
sda3
/
20000 MB
ext3
sda4
<extended>
RAM size of the server
swap
sda5
Note
Swap
partition
Complete the Elastix installation. The server will reboot automatically.
1.2 Disable the Automatic /dev/sda2 (DRBD partition) Mounting
umount /MARKER
sed -i '/MARKER/d' /etc/fstab
rmdir /MARKER
1.3 Configure YUM Repositories
Download and install the Xorcom repository encryption public key as follows:
cd /tmp
wget http://updates.xorcom.com/astribank/elastix/repo/RPM-GPG-KEYxorcom
rpm --import RPM-GPG-KEY-xorcom
Download the Xorcom repository configuration file as follows:
cd /etc/yum.repos.d
wget http://updates.xorcom.com/astribank/elastix/xorcom.repo
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
1.4 Install DRBD Packages
yum install drbd83 kmod-drbd83
1.5 Update DAHDI (mandatory) and Asterisk (optional)
yum update *dahdi* asterisk*
1.6 Install Scripts and Zapauto
Install the twinstar-addon scripts and the zapauto (DAHDI Hardware Detection and
Configuration Tool for FreePBX) as follows:
yum install freepbx-module-zapauto twinstar_addon
1.7 Configure the Desired Host Names
For example: use srv-a on the Primary and srv-b on the Secondary server. For the Primary
server:
a) In the /etc/sysconfig/network file define:
HOSTNAME=srv-a
b) Run:
hostname srv-a
c) Make sure that command 'uname -n' returns the defined host name.
II. Actions to be Performed on the Primary Server Only
2.1 Define Parameters in conf Files
Define the following parameter in the /etc/dahdi/init.conf file:
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
XPP_HOTPLUG_DAHDI=yes
Define the correct parameters in the /usr/share/twinstar/twinstar_config.conf file.
This is an example of the file:
# Ethernet interface used for servers maintenance purpose. The
install_twinstar script will use
# this interface for communication with Server B
MAINT_IF=eth0
# Server B IP address. Must be reachable through the MAINT_IF interface.
SRV_B_IP=192.168.0.167
# Ethernet interface used for cluster services (http, VoIP, dhcp etc).
CLUSTER_IF=eth0
# IP address that is used for cluster access. SIP phones etc will access
the Asterisk by using
# this address. The address automatically activated on the server that
takes control of the cluster.
# In order to ensure correct IP routing table building, in addition to the
IP address the system must know
# the subnet mask. Therefore, the address must be defined in the CIDR
(Classless Inter-domain Routing) notation.
CLUSTER_IP=192.168.0.253/20
# Whether dhcpd service must be activated on the active server. The default
value is "No".
#DHCPD_ENABLE=Yes
# Whether TFTP folder must be replicated between the servers. The default
value is "No".
#TFTPD_ENABLE=Yes
# Ethernet interface to be used for DRBD communication
DRBD_IF=eth0
# The hard disk partition used for DRBD replication. The default is
/dev/sda2 for non RAID and /dev/md2 for RAID
# installations
#DRBD_PART=/dev/sda2
# Sort order of Astribank spans to be defined in the /etc/dahdi/xpp_order.
By default, the Astribanks
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
# serial numbers are listed there. It is possible to list USB connectors ID
instead.
#LIST_ASTRIBANKS_BY_CONNECTOR_ID=No
2.2 Create SSH Encryption Keys
The keys will be used for SSH password-less communication between the servers during the
configuration process.
cd /usr/share/twinstar
./setup_keys ip_address_of_Server_B
2.3 Connect the Astribank Devices
Connect the Astribank devices to both the Primary server and the Backup server and power
them on.
The Astribank USB socket marked as "Main" must be connected to the Primary server. The
Astribank USB socket marked as "Backup" must be connected to the Backup server.
It is recommended that each Astribank be connected to the same USB socket location on
both servers.
2.5 Configure DRBD, DAHDI, Asterisk and the Cluster IP
The twinstar_config performs all of these tasks on both servers. Note that it is necessary to
run this command on the Primary server only. The script will communicate with the backup
server via SSH and configure it using remote commands.
cd /usr/share/twinstar
./twinstar_config -d -a -i
III. Check the Installation
3.1 Check the DRBD Status
On the Primary server something similar to the following should appear:
[root@srv-a ~]# cat /proc/drbd
version: 8.3.2 (api:88/proto:86-90)
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
GIT-hash: dd7985327f146f33b86d4bff5ca8c94234ce840e build by …..
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate A r---ns:1372464 nr:0 dw:1372464 dr:3990 al:978 bm:75 lo:0 pe:0 ua:0
ap:0 ep:1 wo:b oos:216
On the Backup server something similar to the following should appear:
[root@srv-b ~]# cat /proc/drbd
version: 8.3.2 (api:88/proto:86-90)
GIT-hash: dd7985327f146f33b86d4bff5ca8c94234ce840e build by ...
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate A r---ns:1448 nr:1801368 dw:1802764 dr:4409 al:12 bm:21 lo:0 pe:0 ua:0
ap:0 ep:1 wo:b oos:0
3.2 Check IP Settings
On the Primary server the eth0:0 interface with the cluster IP address should appear
activated and the cluster IP should be defined as the source address for eth0 and for the
default gateway in the IP routing table:
[root@srv-a ~]# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc ...
link/ether 00:1c:c0:65:33:3b brd ff:ff:ff:ff:ff:ff
inet 192.168.0.166/20 brd 192.168.15.255 scope global eth0
inet 192.168.0.253/20 brd 192.168.15.255 scope global secondary eth0:0
inet6 fe80::21c:c0ff:fe65:333b/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
[root@srv-a ~]# ip r s
192.168.0.0/20 dev eth0 proto kernel scope link src 192.168.0.253
169.254.0.0/16 dev eth0 scope link
default via 192.168.0.1 dev eth0 src 192.168.0.253
On the Backup server there should not be any sign of the cluster IP :
[root@srv-b ~]# ip a s
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc ...
link/ether 00:1c:c0:65:32:8b brd ff:ff:ff:ff:ff:ff
inet 192.168.0.167/20 brd 192.168.15.255 scope global eth0
inet6 fe80::21c:c0ff:fe65:328b/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
[root@srv-b ~]# ip r s
192.168.0.0/20 dev eth0 proto kernel scope link
169.254.0.0/16 dev eth0 scope link
default via 192.168.0.1 dev eth0
3.3 Check DAHDI and Asterisk Status on the Primary Server
# lsdahdi
### Span 1: XBUS-00/XPD-00 "Xorcom
HDB3/CCS/CRC4 RED
1 E1
Clear
(In use)
2 E1
Clear
(In use)
3 E1
Clear
(In use)
4 E1
Clear
(In use)
5 E1
Clear
(In use)
6 E1
Clear
(In use)
...................
XPD #00/00: E1" (MASTER)
(SWEC:
(SWEC:
(SWEC:
(SWEC:
(SWEC:
(SWEC:
OSLEC)
OSLEC)
OSLEC)
OSLEC)
OSLEC)
OSLEC)
RED
RED
RED
RED
RED
RED
The "(In use)" label means that the Asterisk "uses" the channel.
3.4 Check the TwinStar Status on the Primary Server
# twinstar status
DEVICE
PORT
usb:001/002
0
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
WATCHDOG
on
www.xorcom.com
POWER0
yes
POWER1
yes
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
3.5 Try to Switch to the Backup Server
# twinstar jump
IV. Controlling the TwinStar Status
Use the 'twinstar' utility that is located in the /usr/sbin folder.
4.1 To check status:
#twinstar status
DEVICE
PORT
WATCHDOG
POWER0
POWER1
usb:001/006
0
on
yes
yes
usb:001/007
0
on
yes
yes
4.2 To activate switching to another USB interface:
twinstar jump
4.3 To start USB voltage monitoring and exchange of watchdog messages:
twinstar enable-wd
4.4 To stop USB voltage monitoring and exchange of watchdog messages:
twinstar disable-wd
The watchdog should be disabled before stopping the DAHDI for maintenance purposes.
V. Changing the Server IP Addresses
5.1 Configure the IP addresses on both servers in the regular way.
5.2 Configure the following parameters in the /usr/share/twinstar/twinstar_config.conf file
on the Primary server:
MAINT_IF
SRV_B_IP
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
CLUSTER_IF
CLUSTER_IP
DRBD_IF
Ref. p. 2.2 for further details.
5.3 Run the twinstar_config script:
/usr/share/twinstar/twinstar_config -i
VI. Changing the DAHDI/Asterisk Configuration for Added/Removed
Astribank Device(s)
The simplest way to do this is:
a) Connect/remove the Astribank
b) On the Primary server run:
/usr/share/twinstar/twinstar_config -a
Note: all DAHDI-related configuration in DAHDI and Asterisk will be removed and then recreated. This means, for example, that the FXS extensions with some possible custom
information will be lost.
It is also possible to change the configuration manually. The following can be done on the
Primary server:
a) Disable the Twinstar watchdog as follows:
twinstar disable-wd
b) Edit the /etc/dahdi/system.conf file.
c) Edit the /etc/dahdi/xpp_order file.
d) Change the Asterisk configuration.
Note: the Asterisk/FreePBX configuration changes will be replicated automatically by
DRBD. However, the /etc/dahdi files will need to be copied manually to the Backup server.
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]
e) Restart Asterisk and DAHDI.
Xorcom USA
23309 North 17th Drive Suite #100
Phoenix, AZ 85027 USA
Tel: 866-XORCOM1/866-967-2661
[email protected]
www.xorcom.com
Xorcom Headquarters
Misgav Industrial Park
D.N. Misgav 20179, Israel
Tel: +972-4-9951999
[email protected]