Database Connection Problems

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with "Follow this article to find what you should do if you suspect that yate's database connection is not opened. The example in this article are for Postgresql, but the steps are ...")
 
(Install devel packages)
 
(8 intermediate revisions by one user not shown)
Line 1: Line 1:
Follow this article to find what you should do if you suspect that yate's database connection is not opened.
+
Follow this article to find what you should do if you suspect that yate's database connection is not opened.<br/>
The example in this article are for Postgresql, but the steps are the same when debugging Mysql issue.
+
The examples in this article are for Postgresql, but the steps are the same when debugging Mysql issue.
  
 
===Check your setup===
 
===Check your setup===
Line 9: Line 9:
 
  ; This section holds default settings for each of the following message handlers
 
  ; This section holds default settings for each of the following message handlers
 
  ; All these settings can be overriden in individual handler sections
 
  ; All these settings can be overriden in individual handler sections
 
+
 
  ; priority: int: Priority in Yate's handlers chain
 
  ; priority: int: Priority in Yate's handlers chain
 
  priority=10
 
  priority=10
 
+
 
  ; account: string: Name of the database connection to use
 
  ; account: string: Name of the database connection to use
 
  account=yateadmin
 
  account=yateadmin
Line 34: Line 34:
 
  ; Note that modules can be located only in the module directory so no path
 
  ; Note that modules can be located only in the module directory so no path
 
  ;  information should be specified
 
  ;  information should be specified
 
+
 
  pgsqldb.yate=true
 
  pgsqldb.yate=true
 
  register.yate=true
 
  register.yate=true
Line 42: Line 42:
 
If you've come so far and still have no database connection, it's time to turn on the message sniffer.  
 
If you've come so far and still have no database connection, it's time to turn on the message sniffer.  
  
 +
====Using message sniffer from rmanager====
 
Type in console: '''telnet localhost 5038''' and enter '''status'''. If  
 
Type in console: '''telnet localhost 5038''' and enter '''status'''. If  
 
  name=pgsqldb,type=database;conns=1
 
  name=pgsqldb,type=database;conns=1
Line 48: Line 49:
 
Of course, I'm assuming you're restarting YATE from scratch each time you're testing!  
 
Of course, I'm assuming you're restarting YATE from scratch each time you're testing!  
  
* Enable message sniffer in yate.conf
+
====Enable message sniffer in yate.conf====
 +
In yate.conf:
 
  ; msgsniff: bool: Activate message sniffer module (if loaded) at engine init time
 
  ; msgsniff: bool: Activate message sniffer module (if loaded) at engine init time
 
  msgsniff=enable
 
  msgsniff=enable
+
 
 
  [modules]
 
  [modules]
 
  msgsniff.yate=true
 
  msgsniff.yate=true
Line 59: Line 61:
 
  yate -vvvvvvvvvvv
 
  yate -vvvvvvvvvvv
  
* copy it's output to a text editor of your choice and look for messages similar to the one below:  
+
====Verify messages====
 +
 
 +
* copy the output to a text editor of your choice and look for messages similar to the one below:  
  
 
  Sniffed 'database' time=1198763820.022221
 
  Sniffed 'database' time=1198763820.022221
Line 71: Line 75:
  
 
The last line may indicate, that you do not have database support compiled in!
 
The last line may indicate, that you do not have database support compiled in!
 +
 +
===Install devel packages===
  
 
Solution:
 
Solution:
Line 78: Line 84:
 
  apt-get install postgresql-dev
 
  apt-get install postgresql-dev
  
*    * After that, recompile YATE. It won't overwrite your config files, but it's a good idea to back them up just in case.  
+
If you are not using a Debian based system use the command appropriate for you operating system to install development packages for postgresql/mysql.
 +
 
 +
* After that, recompile YATE. It won't overwrite your config files, but it's a good idea to back them up just in case.  
  
 
  ./configure
 
  ./configure
Line 98: Line 106:
  
 
Good luck. If you find other solutions, please include them here for others.
 
Good luck. If you find other solutions, please include them here for others.
 +
 +
'''See also'''
 +
* [[Administrate Yate]]
 +
* [[PostgreSQL|Using PostgreSQL database in Yate]]
 +
* [[MySQL|Using MySQL database in Yate]]
 +
 +
[[Category:Database]] [[Category:Debug]]

Latest revision as of 10:36, 4 November 2013

Follow this article to find what you should do if you suspect that yate's database connection is not opened.
The examples in this article are for Postgresql, but the steps are the same when debugging Mysql issue.

Contents

[edit] Check your setup

[edit] register.conf

Your register.conf should include a reference to the database connection you are going to use (account=yateadmin).

[default]
; This section holds default settings for each of the following message handlers
; All these settings can be overriden in individual handler sections

; priority: int: Priority in Yate's handlers chain
priority=10

; account: string: Name of the database connection to use
account=yateadmin

[edit] pgsqldb.conf

Your pgsqldb.conf should provide the actual login data for this account (using the accountname as title).

[yateadmin]
host=localhost
database=yateadmin
user=postgres
password=secret
port=5432

[edit] yate.conf

Also, in your yate.conf these modules should be enabled by hand, if you set modload=disable

 [modules]
; This section should hold one line for each module whose loading behaviour
;  is to be changed from the default specified by modload= in section [general]
; Each line has to be of the form:
;   modulename.yate=boolean
; Note that modules can be located only in the module directory so no path
;  information should be specified

pgsqldb.yate=true
register.yate=true

[edit] Using message sniffer

If you've come so far and still have no database connection, it's time to turn on the message sniffer.

[edit] Using message sniffer from rmanager

Type in console: telnet localhost 5038 and enter status. If

name=pgsqldb,type=database;conns=1

is not listed, you might as well assume, that the DB module is not working properly. If you're sure about the setup, you probably did not compile in DB support, see below.

Of course, I'm assuming you're restarting YATE from scratch each time you're testing!

[edit] Enable message sniffer in yate.conf

In yate.conf:

; msgsniff: bool: Activate message sniffer module (if loaded) at engine init time
msgsniff=enable
 
[modules]
msgsniff.yate=true
  • start YATE in very verbose mode (I actually don't know how many v's yate will take so I give it lots :-)
yate -vvvvvvvvvvv

[edit] Verify messages

  • copy the output to a text editor of your choice and look for messages similar to the one below:
Sniffed 'database' time=1198763820.022221
  thread=0x80a1940 'EnginePrivate'
  data=(nil)
  retval='(null)'
  param['account'] = 'yateadmin'
  param['query'] = 'UPDATE cdr SET ended=true WHERE ended IS NULL OR NOT ended'
  param['results'] = 'false'
Returned false 'database' delay=0.003901

The last line may indicate, that you do not have database support compiled in!

[edit] Install devel packages

Solution:

  • on Debian, install the development packages for the appropriate database (for other Linuxes ask your local Guru)
apt-get install postgresql-dev

If you are not using a Debian based system use the command appropriate for you operating system to install development packages for postgresql/mysql.

  • After that, recompile YATE. It won't overwrite your config files, but it's a good idea to back them up just in case.
./configure
make
make install

Now you should get the following with message sniffer on:

Sniffed 'database' time=1198764342.030883
  thread=0x80acae0 'EnginePrivate'
  data=(nil)
  retval='(null)'
  param['account'] = 'yateadmin'
  param['query'] = 'UPDATE lines SET inuse=0'
  param['results'] = 'false'
<pgsqldb:ALL> Performing query "UPDATE lines SET inuse=0" for 'yateadmin'
<pgsqldb:ALL> Query for 'yateadmin' returned 0 rows, 2 affected
Returned true 'database' delay=0.014249

Good luck. If you find other solutions, please include them here for others.

See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers