Kamailio负载均衡与动态路由

时间:2017-09-16 08:01:07

标签: load-balancing asterisk voip sip-server kamailio

如何使用以下信息划分3台服务器之间的所有传入流量? 我正在使用3个或更多星号服务器配置kamailio。我在数据库上配置了dr_rules.gwlist表。

mysql> select * from dr_gateways;
+------+------+--------------------+-------+------------+-------+-------------+
| gwid | type | address            | strip | pri_prefix | attrs | description |
+------+------+--------------------+-------+------------+-------+-------------+
|    5 |   10 | 192.168.50.11:5060 |     0 | NULL       | NULL  |             |
|    6 |   10 | 192.168.50.12:5060 |     0 | NULL       | NULL  |             |
|    9 |   10 | 192.168.50.16:5060 |     0 | NULL       | NULL  |             |
+------+------+--------------------+-------+------------+-------+-------------+
3 rows in set (0.00 sec)

mysql> select * from dr_rules;
+--------+---------+----------+-----------------+----------+---------+-----------------------+-------------+
| ruleid | groupid | prefix   | timerec         | priority | routeid | gwlist                | description |
+--------+---------+----------+-----------------+----------+---------+-----------------------+-------------+
|     13 | 0       | 70704070 |                 |        0 | 0       | 6,9;9,6;6,9,5 |             |
+--------+---------+----------+-----------------+----------+---------+-----------------------+-------------+
7 rows in set (0.00 sec)

我想要将具有70704070前缀的所有流量平衡到具有以下优先级的3服务器:

gwid6 = 40%

gwid9 = 40%

gwid5 = 20%

1 个答案:

答案 0 :(得分:0)

使用RANDOM https://kamailio.org/docs/modules/1.3.x/cfgutils.html#AEN165

之后使用调度程序或其他网关管理模块(或只是从带有htable缓存的数据库中读取)