/* Section: Kazoo Title: Installation */
NOTE: This document is a work in progress
The simplest Kazoo installation only requires a single server. Naturally to take full advantage of the distributed capabilities offered by Kazoo you will need multiple servers to form a cluster. The basic requirements for a Kazoo server (single or multiple server deployment) are:
- CentOS (64bit)
- root access
- internet access
There are six major components to a Kazoo system, they can all be installed on one server or split arbitrarily over any number of servers. This guide will provide examples for installing either a single server, or three server cluster. The components and their functions are:
- Kazoo (and RabbitMQ)
- Provides all application logic for the system, the brains of the operation. This also includes the RabbitMQ server which provides the command and control channel (AMQP). While it is possible for the RabbitMQ server to be a separate component, for the purposes of this document it will be assumed to be park of the Kazoo server.
- Kamailio
- Provides the SIP processing for the system. For the purposes of this guide we will assume that it is always installed on the same server as Kazoo.
- Freeswitch
- Provides all media handling for calls. In a multiple server cluster there will typically be dedicated Freeswitch servers.
- Bigcouch
- Provides the database for configuration and reporting for a cluster. Typically you will want Bigcouch running on multiple servers in a cluster for redundancy purposes.
- HAProxy
- Provides load balancing and request distribution. Also routes internal system connections between components and Bigcouch.
- Monster-UI
- Provides the Kazoo web interface for configuration and monitoring of the system.
The following should be done to prepare a server for installation (this should be done on all servers in a cluster prior to installing anything)
# wget -P /etc/yum.repos.d/ http://repo.2600hz.com/2600hz.repo
You must have the correct IP and host name configuration prior to starting installation. It is highly reccomended (almost required) that you set a static IP for all servers that you are installing.
After setting a static IP, you must also configure the hostnames in /etc/hosts for both long and short hostnames. Example:
191.168.1.100 test1.cluster1.2600hz.com test
During installation you should disable any firewalls and SELinux, this is to prevent them from causing any problems during installation and initial testing.
# service iptables save && service iptables stop && chkconfig iptables off
Edit /etc/selinux/config (restart required)
SELINUX=disabled
It is important for the time and dates to be correct and in sync on all servers in a cluster. It is highly reccomended that you use NTP to facilitate this.
Select the correct timezone
# tzselect
Symlink the timezone file to make the configuration change persistent
# ln -sf /usr/share/zoneinfo/<region>/<tzfile> /etc/localtime
Enable NTP
# service ntpd start && chkconfig ntpd on
Check date / time and verify it is correct
# date
# yum install -y kazoo-bigcouch-R15B haproxy kazoo-freeswitch-R15B kazoo-kamailio kazoo-R15B httpd monster-ui*
See Common Configuration section below for configuration that is to be done
The following configuration changes must be done in addition to the common configuration.
Edit /etc/kazoo/bigcouch/local.ini and update the cluster configuration values to the following:
q=1
r=1
w=1
n=1
Restart bigcouch for changes to take effect
# service bigcouch restart
You should now be ready to validate the installation
For the purposes of this guide we will assume the following cluster layout:
Server 1 (zone 1): bigcouch, kazoo Hostname: test1.cluster1.2600hz.com IP Addr : 192.168.1.100
Server 2: bigcouch, freeswitch Hostname: test2.cluster1.2600hz.com IP Addr : 192.168.1.101
Server 3 (zone 2): bigcouch, kazoo, monster-ui Hostname: test3.cluster1.2600hz.com IP Addr : 192.168.1.102
On all servers:
# yum install -y kazoo-bigcouch-R15B
Set the Erlang cookie correctly for bigcouch (see section below)
Set up bigcouch cluster
# curl -X PUT test1.cluster1.2600hz.com:5986/nodes/[email protected] -d {}
# curl -X PUT test1.cluster1.2600hz.com:5986/nodes/[email protected] -d {}
Server 1
# yum install -y kazoo-kamailio kazoo-R15B
** Server 2**
# yum install -y haproxy kazoo-freeswitch-R15B
Server 3
# yum install -y kazoo-kamailio kazoo-R15B httpd monster-ui*
See Common Configuration section below for configuration to be done on all servers
Update HAProxy configuration with all bigcouch servers /etc/kazoo/haproxy.cfg
listen bigcouch-data 127.0.0.1:15984
balance roundrobin
server test1.cluster1.2600hz.com 192.168.1.100:5984 check
server test2.cluster1.2600hz.com 192.168.1.101:5984 check
server test3.cluster1.2600hz.com 192.168.1.102:5984 check backup
listen bigcouch-mgr 127.0.0.1:15986
balance roundrobin
server test1.cluster1.2600hz.com 192.168.1.100:5986 check
server test2.cluster1.2600hz.com 192.168.1.101:5986 check
server test3.cluster1.2600hz.com 192.168.1.102:5986 check backup
All components must share the same Erlang cookie. Since Erlang cookies allow unrestricted access to the Erlang VM you should use a unique and non-public cookie string. The cookie must be set in the following configuration files:
/etc/kazoo/bigcouch/vm.args
-setcookie COOKIEHERE
/etc/kazoo/freeswitch/autoload_configs/kazoo.conf.xml
<param name="cookie" value="COOKIEHERE" />
/etc/kazoo/config.ini (in multiple locations)
cookie = COOKIEHERE
Symlink the Kazoo HAProxy configruation file
# rm -f /etc/haproxy/haproxy.cfg
# ln -s /etc/kazoo/haproxy/haproxy.cfg /etc/haproxy/
Update the following values in the /etc/kazoo/kamailio/local.cfg file
Server 1
#!substdef "!MY_HOSTNAME!test1.cluster1.2600hz.com!g"
#!substdef "!MY_IP_ADDRESS!192.168.1.100!g"
#!substdef "!MY_AMQP_URL!kazoo://guest:[email protected]:5672!g"
#!substdef "!MY_WEBSOCKET_DOMAIN!2600hz.com!g"
Server 3
#!substdef "!MY_HOSTNAME!test3.cluster1.2600hz.com!g"
#!substdef "!MY_IP_ADDRESS!192.168.1.102!g"
#!substdef "!MY_AMQP_URL!kazoo://guest:[email protected]:5672!g"
#!substdef "!MY_WEBSOCKET_DOMAIN!2600hz.com!g"
On both Server 1 and Server 3 update /etc/kazoo/kamailio/dbtext/dispatcher to contain the following:
1 sip:192.168.1.101:11000 0
We will now create 2 zones, one for each Kazoo server. Edit the zone, whistle_apps, and ecallmgr sections of /etc/kazoo/config.ini to look like the following:
[zone]
name = "c1_zone1"
amqp_uri = "amqp://guest:[email protected]:5672"
[zone]
name = "c1_zone2"
amqp_uri = "amqp://guest:[email protected]:5672"
[whistle_apps]
host = "test1.cluster1.2600hz.com"
zone = "c1_zone1"
cookie = COOKIEHERE
[whistle_apps]
host = "test3.cluster1.2600hz.com"
zone = "c1_zone2"
cookie = COOKIEHERE
[ecallmgr]
host = "test1.cluster1.2600hz.com"
zone = "c1_zone1"
cookie = COOKIEHERE
[ecallmgr]
host = "test3.cluster1.2600hz.com"
zone = "c1_zone2"
cookie = COOKIEHERE
Edit /var/www/html/monster-ui/js/config.js and ensure the api default value is correctly set to either Server 1 or Server 3:
default: 'http://192.168.1.102:8000/v2/'
(Note: for single server install, combine instructions for Server 1 and Server 2)
Start all services
Server 1
# service bigcouch restart
# service rabbitmq-server restart
# service rsyslog restart
# service kz-whistle_apps restart
# service kz-ecallmgr restart
# service kamailio restart
# service httpd restart
Server 2
# service bigcouch restart
# service rsyslog restart
# service haproxy restart
# service freeswitch restart
Server 3
# service bigcouch restart
# service rabbitmq-server restart
# service rsyslog restart
# service kz-whistle_apps restart
# service kz-ecallmgr restart
# service kamailio restart
# service httpd restart
Enable auto-startup for all services
Server 1
# chkconfig --add rabbitmq-server
# chkconfig --add kz-ecallmgr
# chkconfig --add kz-whistle_apps
# chkconfig rabbitmq-server on
# chkconfig kz-ecallmgr on
# chkconfig kz-whistle_apps on
# chkconfig kamailio on
# chkconfig bigcouch on
# chkconfig httpd on
Server 2
# chkconfig haproxy on
# chkconfig freeswitch on
Server 3
# chkconfig --add rabbitmq-server
# chkconfig --add kz-ecallmgr
# chkconfig --add kz-whistle_apps
# chkconfig rabbitmq-server on
# chkconfig kz-ecallmgr on
# chkconfig kz-whistle_apps on
# chkconfig kamailio on
# chkconfig bigcouch on
# chkconfig httpd on
Server 1 OR Server 3
# sup whistle_media_maintenance import_prompts /opt/kazoo/system_media/en-us en-us
Add freeswitch node Server 1 and Server 3
# sup -n ecallmgr ecallmgr_maintenance add_fs_node [email protected]
Add acl entries for SIP servers Server 1 OR Server 3
# sup -n ecallmgr ecallmgr_maintenance allow_sbc test1.cluster1.2600hz.com 192.168.1.100
# sup -n ecallmgr ecallmgr_maintenance allow_sbc test3.cluster1.2600hz.com 192.168.1.102
On all servers, curl the database ip/port to verify that it is reachable:
# curl localhost:15984
You should see something similar to:
{"couchdb":"Welcome","version":"1.1.1","bigcouch":"0.4.2"}
Connect to the cli and verify that you have at least one profile running, also verify that BOTH ecallmgr nodes are connected
# fs_cli
> sofia status
< should show at least one profile>
> erlang nodes list
< should show BOTH ecallmgr nodes (Server1 and Server3)
Server 1 and Server 3
# kamctl fifo ds_list
Server 1 and Server 3
# service kz-whistle_apps status
Verify that the status shows nodes for BOTH Server 1 and Server 3
Server 1 OR Server 3
# sup crossbar_maintenance create_account {ACCT NAME} {REALM} {LOGIN} {PASSWORD}
Server 1
# sup crossbar_maintenance init_apps /var/www/html/monster-ui/apps/ http://192.168.1.100:8000/v2
Server 3
# sup crossbar_maintenance init_apps /var/www/html/monster-ui/apps/ http://192.168.1.102:8000/v2
This guide was created using the (very good) guide at http://www.powerpbx.org/content/kazoo-v3-single-or-multiple-server-voip-telephony-platform-install-guide-v1 as a template / starting point.