FreeSWITCH connect to redis with cluster and sentinel model
Before installing, you need to install hiredis and redis-plus-plus
redis-plus-plus must compile by c++11
when you done it, you need run this to check it:
pkg-config --list-all | grep redis++
pkg-config --list-all | grep hiredis
- Copy the following content to your configure.ac
PKG_CHECK_MODULES([HIREDIS], [hiredis >= 0.10.0],[ AM_CONDITIONAL([HAVE_HIREDIS],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_HIREDIS],[false])]) PKG_CHECK_MODULES([REDIS_PLUS], [redis++ >= 1.3.10],[ AM_CONDITIONAL([HAVE_REDIS_PLUS],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_REDIS_PLUS],[false])]) src/mod/applications/mod_redis_plus/Makefile
- Modify modules.conf in freeswitch source, add
applications/mod_redis_plus
- Clone source mod_redis_plus to
src/mod/application/
git clone https://github.com/nikohpng/mod_redis_plus ./src/mod/application/
- Run
autoreconf -fiv
to rebuild m4 file- Maybe, you need run
yum install -y libtool
orapt-get install libtool
- Maybe, you need run
- Run
rebootstrap.sh
orbootstrap.sh
to rebuild Makefile.in - If everything is ok, you can do
./configure && make && make install
- Add mod_redis_plus to freeswitch/conf/autoload/modules.conf.xml
- Add autoload_conf/redis_plus.conf.xml to freeswitch/conf/autoload_configs
- profiles - save multiple profiles
- profile - it contain all configuration of a connection
- connection - a connection name
- hostname - a connection ip address,
localhost
by default.- if it is sentinel, need like this
192.168.1.24:28001,192.168.1.25:28002
- if it is sentinel, need like this
- password - this connnection password
- port - connect to redis port,
6379
by default - redis-type - how connect to redis server, [0: single 1: cluster 2: sentinel]
- master-name - when sentinel type, you need fill it
- sentinel-timeout-ms - sentinel connection and socket timeout,
200
by default - timeout-ms - redis connection and socket timeout,
100
by default - ignore-connect-fail - ignore connection fail in profile
- max_pipelined_requests - pipline request,
20
by default