modules: several small doxygen bug fixes
[sip-router] / modules / db_mysql / doc / db_mysql_admin.xml
1 <?xml version="1.0" encoding='ISO-8859-1'?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4
5 <!-- Include general documentation entities -->
6 <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
7 %docentities;
8
9 ]>
10
11 <!-- Module User's Guide -->
12
13 <chapter>
14         
15         <title>&adminguide;</title>
16         
17         <section>
18         <title>Overview</title>
19         <para>
20                 This is a module which provides MySQL connectivity for Kamailio.
21                 It implements the DB API defined in Kamailio.
22         </para>
23         </section>
24
25         <section>
26         <title>Dependencies</title>
27         <section>
28                 <title>&kamailio; Modules</title>
29                 <para>
30                 The following modules must be loaded before this module:
31                         <itemizedlist>
32                         <listitem>
33                         <para>
34                                 <emphasis>No dependencies on other &kamailio; modules</emphasis>.
35                         </para>
36                         </listitem>
37                         </itemizedlist>
38                 </para>
39         </section>
40         <section>
41                 <title>External Libraries or Applications</title>
42                 <para>
43                 The following libraries or applications must be installed before running
44                 &kamailio; with this module loaded:
45                         <itemizedlist>
46                         <listitem>
47                         <para>
48                                 <emphasis>mysql</emphasis> - the development libraries forthe Mysql database. In some Linux distributions named "libmysqlclient-dev".
49                         </para>
50                         </listitem>
51                         </itemizedlist>
52                 </para>
53         </section>
54         </section>
55         <section>
56         <title>Exported Parameters</title>
57         <section>
58                 <title><varname>ping_interval</varname> (integer)</title>
59                 <para>
60                 Time interval in seconds to send ping messages to MySQL server in order to keep
61                 the connection open.
62                 </para>
63                 <para>
64                 <emphasis>
65                         Default value is 300 (5 min).
66                 </emphasis>
67                 </para>
68                 <example>
69                 <title>Set <varname>ping_interval</varname> parameter</title>
70                 <programlisting format="linespecific">
71 ...
72 modparam("db_mysql", "ping_interval", 600)
73 ...
74 </programlisting>
75                 </example>
76         </section>
77                 <section>
78                 <title><varname>timeout_interval</varname> (integer)</title>
79                 <para>
80                 Time interval (in seconds) after that an connection attempt, read or write request
81                 is aborted. The value counts three times, as several retries are done
82                 from the driver before it gives up.
83                 </para>
84                 <para>
85                 The read timeout parameter is ignored on MySQL driver versions prior to
86                 <quote>5.1.12</quote>, <quote>5.0.25</quote> and <quote>4.1.22</quote>.
87                 The write timeout parameter is ignored on versions prior to <quote>5.1.12</quote>
88                 and <quote>5.0.25</quote>, the <quote>4.1</quote> release don't support it at all.
89                 </para>
90                 <para>
91                 <emphasis>
92                         Default value is 2 (6 sec).
93                 </emphasis>
94                 </para>
95                 <example>
96                 <title>Set <varname>timeout_interval</varname> parameter</title>
97                 <programlisting format="linespecific">
98 ...
99 modparam("db_mysql", "timeout_interval", 2)
100 ...
101 </programlisting>
102                 </example>
103         </section>
104         <section>
105                 <title><varname>auto_reconnect</varname> (integer)</title>
106                 <para>
107                 Configure whether the module should automatically reconnect to MySQL server if the
108                 connection was lost.
109                 </para>
110                 <para>
111                 <emphasis>
112                         Default value is 1 (1 - on / 0 - off).
113                 </emphasis>
114                 </para>
115                 <example>
116                 <title>Set <varname>auto_reconnect</varname> parameter</title>
117                 <programlisting format="linespecific">
118 ...
119 modparam("db_mysql", "auto_reconnect", 0)
120 ...
121 </programlisting>
122                 </example>
123         </section>
124         </section>
125         <section>
126         <title>Exported Functions</title>
127                 <para>
128                 No function exported to be used from configuration file.
129                 </para>
130         </section>
131         <section>
132         <title>Installation</title>
133                 <para>
134                 Because it dependes on an external library, the mysql module is not
135                 compiled and installed by default. You can use one of these options.
136                 </para>
137                 <itemizedlist>
138                         <listitem>
139                         <para>
140                         - edit the "Makefile" and remove "db_mysql" from "excluded_modules"
141                         list. Then follow the standard procedure to install &kamailio;:
142                         "make all; make install".
143                         </para>
144                         </listitem>
145                         <listitem>
146                         <para>
147                         - from command line use: 'make all include_modules="db_mysql";
148                         make install include_modules="db_mysql"'.
149                         </para>
150                         </listitem>
151                 </itemizedlist>
152         </section>
153         <section>
154                 <title>Reading configuration from my.cnf</title>
155                 <para>
156                 In order to take into account specific mysql client options, a my.cnf config group can be passed using the <emphasis>db_url</emphasis> module parameter. This is done by setting <emphasis>[group]</emphasis> in front of or instead of the host part. The following examples are valid <emphasis>db_url</emphasis> definitions, which include a my.cnf group:
157                 </para>
158
159                 <itemizedlist>
160                         <listitem>mysql://user:pass@[group]host:port/db</listitem>
161                         <listitem>mysql://user:pass@[group]:port/db</listitem>
162                         <listitem>mysql://user:pass@[group]/db</listitem>
163                         <listitem>mysql://[group]/db</listitem>
164                 </itemizedlist>
165                 <example>
166                 <title>Set a my.cnf group in <varname>db_url</varname> parameter</title>
167                 <programlisting format="linespecific">
168 ...
169 modparam("usrloc", "db_url", "mysql://[kamailio]/kamailio)
170 ...
171 </programlisting>
172                 </example>
173                 <example>
174                 <title>Adding a kamailio group to my.cnf</title>
175                 <programlisting format="linespecific">
176 ...
177 [kamailio]
178 socket = /path/to/mysql.sock
179 user = kamailiouser
180 password = kamailiopass
181 default-character-set = utf8
182 ...
183 </programlisting>
184                 </example>
185                 <para>
186                 In addition to the given group, also the <emphasis>[client]</emphasis> section is read, in the order given in my.cnf. So if you for example specify a <emphasis>socket</emphasis> in both your specific group and the client group, then the value is taken from the last one.
187                 </para>
188                 <example>
189                 <title>Using [client] and specific group</title>
190                 <programlisting format="linespecific">
191 ...
192 [client]
193 socket = /var/run/mysql/mysqld.sock
194
195 [kamailio]
196 socket = /path/to/mysqld.sock
197 user = kamailiouser
198 password = kamailiopass
199 default-character-set = utf8
200 ...
201 </programlisting>
202                 </example>
203                 <para>
204                 In the example given above, the socket <emphasis>/path/to/mysqld.sock</emphasis> is used by &kamailio; because both <emphasis>[kamailio]</emphasis> and <emphasis>[client]</emphasis> define this option, and the latter overwrites the first.
205                 </para>
206         </section>
207 </chapter>
208