Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: <core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
Unless Kamailio implements its own DNS query mechanism, it should use the system library's resolver, which hits /etc/hosts as well. It works for me to use hostnames only in /etc/hosts in my dispatcher list.
Failing that, however, you can run a DNS cache locally like pdnsd or dnsmasq. Pdnsd in particular can source from /etc/hosts, and you can put it in your /etc/resolv.conf as a nameserver.
On 09/01/2010 11:10 AM, Santiago Soares wrote:
Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: <core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
kamailio >= 3.0 is based on ser's core which has implemented its own caching resolver library. I do not know if there is a way to disable it complete and use the system's stub resolver. You could try the "use_dns_cache" option: http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
regards klaus
Am 01.09.2010 17:10, schrieb Santiago Soares:
Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: <core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Sep 01, 2010 at 18:49, Klaus Darilion klaus.mailinglists@pernau.at wrote:
kamailio >= 3.0 is based on ser's core which has implemented its own caching resolver library. I do not know if there is a way to disable it complete and use the system's stub resolver. You could try the "use_dns_cache" option: http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
Yes, if you disable the dns cache it will use the system resolver. It's also used during the initial startup phase, when the dns cache is not yet fully initialized.
You could also leave the cache enabled and add/remove records by hand (using sercmd or xmlrpc) using the dns rpcs (e.g. dns_add_a, dns.add_srv, dns.delete_a a.s.o, for more info see http://sip-router.org/docbook/sip-router/branch/master/rpc_list/rpc_list.htm... ).
Andrei
regards klaus
Am 01.09.2010 17:10, schrieb Santiago Soares:
Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: <core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 9/1/10 7:01 PM, Andrei Pelinescu-Onciul wrote:
On Sep 01, 2010 at 18:49, Klaus Darilionklaus.mailinglists@pernau.at wrote:
kamailio>= 3.0 is based on ser's core which has implemented its own caching resolver library. I do not know if there is a way to disable it complete and use the system's stub resolver. You could try the "use_dns_cache" option: http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
Yes, if you disable the dns cache it will use the system resolver.
when the cache is enabled and the record is not cached, will first dns query find the records in /etc/hosts and then cache it? Or in other words, if a query to internal cache fails, then is used the system resolver?
Just for sake of completing info in this thread, disabling completely the internal cache is by global parameter: dns_cache_init=no
Thanks, Daniel
It's also used during the initial startup phase, when the dns cache is not yet fully initialized.
You could also leave the cache enabled and add/remove records by hand (using sercmd or xmlrpc) using the dns rpcs (e.g. dns_add_a, dns.add_srv, dns.delete_a a.s.o, for more info see http://sip-router.org/docbook/sip-router/branch/master/rpc_list/rpc_list.htm... ).
Andrei
regards klaus
Am 01.09.2010 17:10, schrieb Santiago Soares:
Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR:<core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
Both options (dns_cache_init=no and use_dns_cache=no) worked for me. I think that the internal resolver is used only if cache is enabled. Thank you!
Santiago Soares Fone: (41) 8488-0537
On Wed, Sep 1, 2010 at 2:09 PM, Daniel-Constantin Mierla miconda@gmail.comwrote:
On 9/1/10 7:01 PM, Andrei Pelinescu-Onciul wrote:
On Sep 01, 2010 at 18:49, Klaus Darilionklaus.mailinglists@pernau.at wrote:
kamailio>= 3.0 is based on ser's core which has implemented its own caching resolver library. I do not know if there is a way to disable it complete and use the system's stub resolver. You could try the "use_dns_cache" option: http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
Yes, if you disable the dns cache it will use the system resolver.
when the cache is enabled and the record is not cached, will first dns query find the records in /etc/hosts and then cache it? Or in other words, if a query to internal cache fails, then is used the system resolver?
Just for sake of completing info in this thread, disabling completely the internal cache is by global parameter: dns_cache_init=no
Thanks, Daniel
It's also used during the initial startup phase, when the dns cache is
not yet fully initialized.
You could also leave the cache enabled and add/remove records by hand (using sercmd or xmlrpc) using the dns rpcs (e.g. dns_add_a, dns.add_srv, dns.delete_a a.s.o, for more info see
http://sip-router.org/docbook/sip-router/branch/master/rpc_list/rpc_list.htm... ).
Andrei
regards
klaus
Am 01.09.2010 17:10, schrieb Santiago Soares:
Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR:<core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla http://www.asipto.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Sep 01, 2010 at 19:09, Daniel-Constantin Mierla miconda@gmail.com wrote:
On 9/1/10 7:01 PM, Andrei Pelinescu-Onciul wrote:
On Sep 01, 2010 at 18:49, Klaus Darilionklaus.mailinglists@pernau.at wrote:
kamailio>= 3.0 is based on ser's core which has implemented its own caching resolver library. I do not know if there is a way to disable it complete and use the system's stub resolver. You could try the "use_dns_cache" option: http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
Yes, if you disable the dns cache it will use the system resolver.
when the cache is enabled and the record is not cached, will first dns query find the records in /etc/hosts and then cache it? Or in other words, if a query to internal cache fails, then is used the system resolver?
No, the system resolver is never used when the cache is enabled (except during very early initialisation before mod_init, e.g. mod_register or modparam callbacks). The problem with having fallback to the system resolver is that in case the entry is not in /etc/hosts (or similar), you will have double queries for each failure and you would also not be able to do any dns fallback / srv rec. load balancing (which depend on having cached records).
Just for sake of completing info in this thread, disabling completely the internal cache is by global parameter: dns_cache_init=no
but note also that you won't have dns fall-back.
Andrei
Thanks, Daniel
It's also used during the initial startup phase, when the dns cache is not yet fully initialized.
You could also leave the cache enabled and add/remove records by hand (using sercmd or xmlrpc) using the dns rpcs (e.g. dns_add_a, dns.add_srv, dns.delete_a a.s.o, for more info see http://sip-router.org/docbook/sip-router/branch/master/rpc_list/rpc_list.htm... ).
Andrei
regards klaus
Am 01.09.2010 17:10, schrieb Santiago Soares:
Hello,
I'm using kamailio as a simple load balancer. My dispatcher list is something like that:
1 sip:server1:5060 1 sip:server2:5060 2 sip:server1:5060
and /etc/hosts is
10.1.1.1 server1 10.1.1.2 server2
When I want to do some maintenance task in one of the servers, server2, for exemple, I simply change /etc/hosts like that:
10.1.1.1 server1 10.1.1.1 server2
And all the traffic is redirected to server 1. It's a simple yet effective way to remove a server from balancing. The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it doesn't work, since kamailio appears to resolv names only by DNS. I receive this message on startup:
Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatch.c:241]: could not resolve server1 Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR: dispatcher [dispatcher.c:247]: no dispatching list loaded from file Sep 1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR:<core> [sr_module.c:874]: init_mod(): Error while initializing module dispatcher
Is there any way to avoid this behavior, and force kamailio to use /etc/hosts?
Thank you.
Santiago Soares Fone: (41) 8488-0537
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla http://www.asipto.com/
On 09/01/2010 01:25 PM, Andrei Pelinescu-Onciul wrote:
The problem with having fallback to the system resolver is that in case the entry is not in /etc/hosts (or similar), you will have double queries for each failure and you would also not be able to do any dns fallback / srv rec. load balancing (which depend on having cached records).
There is no SRV resolution in the stub resolver?
On Sep 01, 2010 at 14:50, Alex Balashov abalashov@evaristesys.com wrote:
On 09/01/2010 01:25 PM, Andrei Pelinescu-Onciul wrote:
The problem with having fallback to the system resolver is that in case the entry is not in /etc/hosts (or similar), you will have double queries for each failure and you would also not be able to do any dns fallback / srv rec. load balancing (which depend on having cached records).
There is no SRV resolution in the stub resolver?
There is (both SRV and NAPTR), but there is no way to fallback (so if the first destination fails it won't try another). There is also no weight based load balancing (the srv record with the lowest prio and highest weight will always be selected). The dns fall-back part references directly records in the dns cache from tm (which saves a lot of memory) and hence it is disabled if the dns cache is off.
Andrei
Hi!
I tried to summarize the options at http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
Please review and fix if something is wrong.
btw: are the tuning options like dns_try_ipv6, dns_retr_time, dns_retr_no, dns_use_search_list .... also used when the internal resolver is used?
regards klaus
Am 02.09.2010 06:26, schrieb Andrei Pelinescu-Onciul:
The dns fall-back part references directly records in the dns cache from tm (which saves a lot of memory) and hence it is disabled if the dns cache is off.
On Sep 02, 2010 at 10:13, Klaus Darilion klaus.mailinglists@pernau.at wrote:
Hi!
I tried to summarize the options at http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
Please review and fix if something is wrong.
Replaced dns_cache_init=off with use_dns_cache=off. The difference is that if use_dns_cache=off, but dns_cache_init=on (default), the cache can be enabled anytime at runtime (e.g. sercmd cfg.set_now_int core use_dns_cache 1). If dns_cache_init=off, the cache cannot be enabled at runtime (requires a restart), but you save a little bit of memory (it might matter on embedded systems).
btw: are the tuning options like dns_try_ipv6, dns_retr_time, dns_retr_no, dns_use_search_list .... also used when the internal resolver is used?
Yes, the ones above are used both when the cache is enabled or disabled. The ones that are not are some of the dns_cache_flags: ipv6_only and prefer_ipv6 are obeyed only if the cache is used.
Andrei