Fourhundred Thecat
2020-Jun-06 07:18 UTC
[asterisk-users] CDR mysql: timeout when remote database unavailable
Hello, I am using CDR mysql to log to remote server: in modules.conf, I preload the modules: [modules] preload => cdr_mysql.so preload => app_mysql.so and in cdr_mysql.conf, I have all the details defined (hostname, dbname, table, password, user, port). In a situation when I start asterisk, and the remote database in unreachable, asterisk waits for several minutes before it actually starts (before it loads sip module, etc). And when database is unreachable during operation, when call happens, sometimes the call is connected, other times it waits for mysql and call times out. I assume there might be scenarios where CDR logging is essential, and calls should not be made without CDR functioning (ie for billing purposes). But this is not my situation. I would like CDR to log, but in a situation where database is temporarily unavailable, I don't want that to prevent asterisk to function (ie, start, make calls) Is there somewhere a timeout setting, that I could set to a low number, so that it times out quickly ? or what would be the best solution in my case ? thanks,
Antony Stone
2020-Jun-06 08:38 UTC
[asterisk-users] CDR mysql: timeout when remote database unavailable
On Saturday 06 June 2020 at 09:18:11, Fourhundred Thecat wrote:> In a situation when I start asterisk, and the remote database is > unreachable, asterisk waits for several minutes before it actually > starts (before it loads sip module, etc). > > And when database is unreachable during operation, when call happens, > sometimes the call is connected, other times it waits for mysql and call > times out.> or what would be the best solution in my case ?I would install a local copy of MySQL (to the same machine as Asterisk) so that it is definitely available, tell Asterisk to write to that, and then set up replication to the remote MySQL instance which is sometimes unavailable. Replication will sort itself out automatically after almost any duration of non-connectivity. If you are using MySQL, the traditional Master-Slave replication is easy to set up and works well. If you're using MariaDB (which is installed in some distributions even when you ask for MySQL) then the new method of replication is Galera, although standard Master-Slave is still fully supported. Regards, Antony. -- If my advice was worth anything, I wouldn't just give it away. Please reply to the list; please *don't* CC me.
Fourhundred Thecat
2020-Jun-07 06:54 UTC
[asterisk-users] CDR mysql: timeout when remote database unavailable
> On 2020-06-06 10:38, Antony Stone wrote: > On Saturday 06 June 2020 at 09:18:11, Fourhundred Thecat wrote: > >> In a situation when I start asterisk, and the remote database is >> unreachable, asterisk waits for several minutes before it actually >> starts (before it loads sip module, etc). >> >> And when database is unreachable during operation, when call happens, >> sometimes the call is connected, other times it waits for mysql and call >> times out. > >> or what would be the best solution in my case ? > > I would install a local copy of MySQL (to the same machine as Asterisk) so > that it is definitely available, tell Asterisk to write to that, and then set > up replication to the remote MySQL instance which is sometimes unavailable.That is an interesting suggestion, which I'll consider. But I would still like to know where the Aterisk mysql timeout duration comes from, and whether it can be configured. thanks,