p_usrloc_admin.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  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. <!-- Include general documentation entities -->
  5. <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
  6. %docentities;
  7. ]>
  8. <!-- Module User's Guide -->
  9. <chapter>
  10. <chapterinfo>
  11. </chapterinfo>
  12. <title>User's Guide</title>
  13. <section>
  14. <title>Overview</title>
  15. <para>
  16. The p_usrloc module is built upon the usrloc module and provides the same usrloc export to the registrar module (for example). The usrloc module must not be loaded at the same time with the p_usrloc module. The parameters and the interface for the p_usrloc module are thus almost the same, so in this document only extra parameters (specific only to p_usrloc module) and differences are noted. For a complete description of the paramters that are inherited from usrloc see the page here. Note that the modparam statement must still refer to the p_usrloc module.
  17. </para>
  18. <para> The goal of the p_usrloc module is to provide partionioned user location service to Kamailio/SER. This provides three major benefits:
  19. <itemizedlist>
  20. <listitem>
  21. <para>
  22. <emphasis>Redundancy</emphasis> Failure of a location database does not mean that the location service is down
  23. </para>
  24. </listitem>
  25. <listitem>
  26. <para>
  27. <emphasis> Load Balancing</emphasis> DB performance is greatly increased as queries are automatically split on a pool of ID(number configurable at runtime). Furthermore, a read only db handler can be used to further increase the spead of the "select" queries.
  28. </para>
  29. </listitem>
  30. <listitem>
  31. <para>
  32. <emphasis> Failover </emphasis> A faulty DB server is detected and taken out. When it recovers, the module makes sure that no stale contacts are returned from it.
  33. </para>
  34. </listitem>
  35. </itemizedlist>
  36. </para>
  37. <para>
  38. </para>
  39. <para>Write queries are replicated to two or more databases, depending on some
  40. distribution keys, e.g. the username and domain the subscribers. The number of databases
  41. used for replication is configurable at compile time by modifying the DB_NUM define.
  42. Its main field of application is for storing and retrieving location data. The actual
  43. database for this subscriber is choosen from a set that is specified in the master
  44. database. Read queries are executed on one database of the set. If this database is
  45. not available, the other database would be used. This failure is recorded in the
  46. master database.
  47. </para>
  48. <para>Connections to the distributed databases are setup prior the actual query
  49. is executed. The module maintains a cache of the database handles to provide
  50. better performance. This handles are periodically checked if there are still valid
  51. and if needed updated from the master database. As default only one key is used
  52. for the database lookup, but the additional usage of a second one is possible.
  53. </para>
  54. <para>Changes in the master database are autodetected. For better performance it is
  55. possible to use one read-only instance, that is locally installed, and write only
  56. errors and other status information to a central master database.
  57. It is also possible to specify different failover schemas and even use transaction to
  58. provide additional data safety. This module could further try to minimise the impact
  59. of a database error with the usage of spare databases that are automatically activated.
  60. It also supports the manual deactivation of redundant databases for maintenance purposes.
  61. </para>
  62. <para><warning>
  63. The p_usrloc module still has some missing feature, like automatic expiry of contacts and dumping of all users via the fifo cmd.
  64. </warning></para>
  65. </section>
  66. <section>
  67. <title>Dependencies</title>
  68. <section>
  69. <title>&kamailio; Modules</title>
  70. <para>
  71. The following modules must be loaded before this module:
  72. <itemizedlist>
  73. <listitem>
  74. <para>
  75. <emphasis>a database module</emphasis> necessary to connect to the
  76. master database and to the distributed databases.
  77. </para>
  78. </listitem>
  79. </itemizedlist>
  80. </para>
  81. </section>
  82. <section>
  83. <title>External Libraries or Applications</title>
  84. <para>
  85. The following libraries or applications must be installed before running
  86. &kamailio; with this module loaded:
  87. <itemizedlist>
  88. <listitem>
  89. <para>
  90. <emphasis>None</emphasis>.
  91. </para>
  92. </listitem>
  93. </itemizedlist>
  94. </para>
  95. </section>
  96. </section>
  97. <section>
  98. <title>Parameters</title>
  99. <section>
  100. <title><varname>write_db_url</varname> (string)</title>
  101. <para>
  102. The url to the master database where errors are written to.
  103. </para>
  104. <para>
  105. Default value is <quote>&defaultdb;</quote>
  106. </para>
  107. <example>
  108. <title>Set <varname>write_db_url</varname> parameter</title>
  109. <programlisting format="linespecific">
  110. ...
  111. modparam("p_usrloc", "write_db_url", "mysql://username:password@localhost/databasename")
  112. ...
  113. </programlisting>
  114. </example>
  115. </section>
  116. <section>
  117. <title><varname>read_db_url</varname> (string)</title>
  118. <para>
  119. The url to the master database where the distribution data is
  120. read from. It is seperated from write access, so for better
  121. performance, a local replicate can be used for read access.
  122. </para>
  123. <para>
  124. <emphasis>Default value is &defaultdb; .
  125. </emphasis>
  126. </para>
  127. <example>
  128. <title>Set <varname>read_db_url</varname> parameter</title>
  129. <programlisting format="linespecific">
  130. ...
  131. modparam("p_usrloc", "read_db_url", "mysql://user:passwd@localhost/db")
  132. ...
  133. </programlisting>
  134. </example>
  135. </section>
  136. <section>
  137. <title><varname>reg_db_table</varname> (string)</title>
  138. <para>
  139. Specifies the table where the information about the distributed databases
  140. is stored.
  141. </para>
  142. <para>
  143. <emphasis>
  144. Default value is <quote>locdb</quote>.
  145. </emphasis>
  146. </para>
  147. <example>
  148. <title>Set <varname>reg_db_table</varname> parameter</title>
  149. <programlisting format="linespecific">
  150. ...
  151. modparam("p_usrloc", "reg_db_table", "locdb")
  152. ...
  153. </programlisting>
  154. </example>
  155. </section>
  156. <section>
  157. <title><varname>id_column</varname> (string)</title>
  158. <para>
  159. Specifies the column where the id of a distributed database is stored.
  160. </para>
  161. <para>
  162. <emphasis>
  163. Default value is <quote>id</quote>.
  164. </emphasis>
  165. </para>
  166. <example>
  167. <title>Set <varname>id_column</varname> parameter</title>
  168. <programlisting format="linespecific">
  169. ...
  170. modparam("p_usrloc", "id_column", "id")
  171. ...
  172. </programlisting>
  173. </example>
  174. </section>
  175. <section>
  176. <title><varname>num_column</varname> (string)</title>
  177. <para>
  178. Specifies the column where the associated number of the distributed
  179. database is stored. For each distributed database ID there
  180. must be at least two databases available, the databases above
  181. the second are ignored.
  182. </para>
  183. <para>
  184. <emphasis>
  185. Default value is <quote>no</quote>.
  186. </emphasis>
  187. </para>
  188. <example>
  189. <title>Set <varname>num_column</varname> parameter</title>
  190. <programlisting format="linespecific">
  191. ...
  192. modparam("p_usrloc", "num_column", "nr")
  193. ...
  194. </programlisting>
  195. </example>
  196. </section>
  197. <section>
  198. <title><varname>url_column</varname> (string)</title>
  199. <para>
  200. Specifies the column where the url of the distributed database is stored.
  201. </para>
  202. <para>
  203. <emphasis>
  204. Default value is <quote>url</quote>.
  205. </emphasis>
  206. </para>
  207. <example>
  208. <title>Set <varname>url_column</varname> parameter</title>
  209. <programlisting format="linespecific">
  210. ...
  211. modparam("p_usrloc", "url_column", "url")
  212. ...
  213. </programlisting>
  214. </example>
  215. </section>
  216. <section>
  217. <title><varname>status_column</varname> (string)</title>
  218. <para>
  219. Specifies the column where the status of the distributed database is stored.
  220. </para>
  221. <para>
  222. <emphasis>
  223. Default value is <quote>status</quote>.
  224. </emphasis>
  225. </para>
  226. <example>
  227. <title>Set <varname>status_column</varname> parameter</title>
  228. <programlisting format="linespecific">
  229. ...
  230. modparam("p_usrloc", "status_column", "status")
  231. ...
  232. </programlisting>
  233. </example>
  234. </section>
  235. <section>
  236. <title><varname>failover_time_column</varname> (string)</title>
  237. <para>
  238. Specifies the column where the failover time of the
  239. location databases is stored. This field is set to the
  240. current time when a databases is turned off or turned on.
  241. </para>
  242. <para>
  243. <emphasis>
  244. Default value is <quote>failover</quote>.
  245. </emphasis>
  246. </para>
  247. <example>
  248. <title>Set <varname>failover_time_column</varname> parameter</title>
  249. <programlisting format="linespecific">
  250. ...
  251. modparam("p_usrloc", "failover_time_column", "fail")
  252. ...
  253. </programlisting>
  254. </example>
  255. </section>
  256. <section>
  257. <title><varname>spare_flag_column</varname> (string)</title>
  258. <para>
  259. Specifies the column where the spare flag of the location
  260. databases is stored. It is possible to declare an entry in
  261. the p_usrloc table as spare which is used in a failover.
  262. Due to the fact that the data is stored in two databases and
  263. it takes the spare the complete expire time to be up to
  264. date, it is not very useful.
  265. </para>
  266. <para>
  267. <emphasis>
  268. Default value is <quote>spare</quote>.
  269. </emphasis>
  270. </para>
  271. <example>
  272. <title>Set <varname>spare_flag_column</varname> parameter</title>
  273. <programlisting format="linespecific">
  274. ...
  275. modparam("p_usrloc", "spare_flag_column", "spare")
  276. ...
  277. </programlisting>
  278. </example>
  279. </section>
  280. <section>
  281. <title><varname>error_column</varname> (string)</title>
  282. <para>
  283. Specifies the column where the errors of the distributed
  284. databases are stored. Each call to db_handle_error increases
  285. the error counter. After exceeding the error threshold, the
  286. database's status is set to off.
  287. </para>
  288. <para>
  289. <emphasis>
  290. Default value is <quote>errors</quote>.
  291. </emphasis>
  292. </para>
  293. <example>
  294. <title>Set <varname>error_column</varname> parameter</title>
  295. <programlisting format="linespecific">
  296. ...
  297. modparam("p_usrloc", "error_column", "error")
  298. ...
  299. </programlisting>
  300. </example>
  301. </section>
  302. <section>
  303. <title><varname>risk_group_column</varname> (string)</title>
  304. <para>
  305. Specifies the column where the risk group of the distributed
  306. databases is stored. All databases on one host are in the
  307. same risk group. This is only useful when using spares and
  308. prevents the module from taking a spare which shares the same
  309. risk as the broken database.
  310. </para>
  311. <para>
  312. <emphasis>
  313. Default value is <quote>rg</quote>.
  314. </emphasis>
  315. </para>
  316. <example>
  317. <title>Set <varname>risk_group_column</varname> parameter</title>
  318. <programlisting format="linespecific">
  319. ...
  320. modparam("p_usrloc", "risk_group_column", "rg")
  321. ...
  322. </programlisting>
  323. </example>
  324. </section>
  325. <section>
  326. <title><varname>expire_time</varname> (int)</title>
  327. <para>
  328. Specifies the time (in seconds) when a contact expires, used
  329. for resetting the failover time of a reactivated database.
  330. It should be equal or greater than the contact expiration
  331. time of the registrar module.
  332. </para>
  333. <para>
  334. <emphasis>
  335. Default value is <quote>3600</quote>.
  336. </emphasis>
  337. </para>
  338. <example>
  339. <title>Set <varname>expire_time</varname> parameter</title>
  340. <programlisting format="linespecific">
  341. ...
  342. modparam("p_usrloc", "expire_time", "3600")
  343. ...
  344. </programlisting>
  345. </example>
  346. </section>
  347. <section>
  348. <title><varname>db_err_threshold</varname> (int)</title>
  349. <para>
  350. Specifies the error value on which a database shall be turned of.
  351. </para>
  352. <para>
  353. <emphasis>
  354. Default value is <quote>50</quote>.
  355. </emphasis>
  356. </para>
  357. <example>
  358. <title>Set <varname>db_err_threshold</varname> parameter</title>
  359. <programlisting format="linespecific">
  360. ...
  361. modparam("p_usrloc", "db_err_threshold", "50")
  362. ...
  363. </programlisting>
  364. </example>
  365. </section>
  366. <section>
  367. <title><varname>failover_level</varname> (int)</title>
  368. <para>
  369. Specifies the manner a failover is done. Following modes are supported:
  370. </para>
  371. <itemizedlist>
  372. <listitem>
  373. <para><emphasis>1</emphasis> - Just turn off the broken database</para>
  374. </listitem>
  375. <listitem>
  376. <para><emphasis>2</emphasis> - Try to find a spare, if none found, just
  377. turn off the broken database</para>
  378. </listitem>
  379. </itemizedlist>
  380. <para>
  381. <emphasis>
  382. Default value is <quote>1</quote>.
  383. </emphasis>
  384. </para>
  385. <example>
  386. <title>Set <varname>failover_level</varname> parameter</title>
  387. <programlisting format="linespecific">
  388. ...
  389. modparam("p_usrloc", "failover_level", "1")
  390. ...
  391. </programlisting>
  392. </example>
  393. </section>
  394. <section>
  395. <title><varname>db_retry_interval</varname> (int)</title>
  396. <para>
  397. Specifies the interval (in seconds) in which a timer process
  398. shall check the availability of the databases and try to reconnect
  399. to broken ones. It don't make sense to choose a lower value as 10.
  400. It's necessary to provide a writeable master database, otherwise
  401. this check stays disabled.
  402. </para>
  403. <para>
  404. <emphasis>
  405. Default value is <quote>10</quote>.
  406. </emphasis>
  407. </para>
  408. <example>
  409. <title>Set <varname>db_retry_interval</varname> parameter</title>
  410. <programlisting format="linespecific">
  411. ...
  412. modparam("p_usrloc", "db_retry_interval", "10")
  413. ...
  414. </programlisting>
  415. </example>
  416. </section>
  417. <section>
  418. <title><varname>db_use_transactions</varname> (int)</title>
  419. <para>
  420. Specifies if transactions should be used (set to 1) to reach a higher data
  421. consistency. Keep in mind that this will probably decrease performance.
  422. </para>
  423. <para>
  424. <emphasis>
  425. Default value is <quote>0</quote>.
  426. </emphasis>
  427. </para>
  428. <example>
  429. <title>Set <varname>db_use_transactions</varname> parameter</title>
  430. <programlisting format="linespecific">
  431. ...
  432. modparam("p_usrloc", "db_use_transactions", "0")
  433. ...
  434. </programlisting>
  435. </example>
  436. </section>
  437. <section>
  438. <title><varname>db_transaction_level</varname> (string)</title>
  439. <para>
  440. Specifies the isolation level on which transactions are performed.
  441. Possible values: Modes supported by the database backend. In order
  442. to activate transaction the db_use_transactions parameter must be
  443. also set.
  444. </para>
  445. <para>
  446. <emphasis>
  447. Default value is <quote>READ UNCOMMITED</quote>.
  448. </emphasis>
  449. </para>
  450. <example>
  451. <title>Set <varname>db_transaction_level</varname> parameter</title>
  452. <programlisting format="linespecific">
  453. ...
  454. modparam("p_usrloc", "db_transaction_level", "READ UNCOMMITED")
  455. ...
  456. </programlisting>
  457. </example>
  458. </section>
  459. <section>
  460. <title><varname>write_on_master_db</varname> (int)</title>
  461. <para>
  462. Sets the write access to the master database. If set to 0,
  463. no write operations are permitted on the master database.
  464. </para>
  465. <para>
  466. <emphasis>
  467. Default value is <quote>0</quote>.
  468. </emphasis>
  469. </para>
  470. <example>
  471. <title>Set <varname>write_on_master_db</varname> parameter</title>
  472. <programlisting format="linespecific">
  473. ...
  474. modparam("p_usrloc", "write_on_master_db", "0")
  475. ...
  476. </programlisting>
  477. </example>
  478. </section>
  479. <section>
  480. <title><varname>write_on_db</varname> (int)</title>
  481. <para>
  482. Sets the write access to the distributed databases. If set
  483. to 0, no write operations are permitted on the databases.
  484. </para>
  485. <para>
  486. <emphasis>
  487. Default value is <quote>0</quote>.
  488. </emphasis>
  489. </para>
  490. <example>
  491. <title>Set <varname>write_on_db</varname> parameter</title>
  492. <programlisting format="linespecific">
  493. ...
  494. modparam("p_usrloc", "write_on_db", "0")
  495. ...
  496. </programlisting>
  497. </example>
  498. </section>
  499. <section>
  500. <title><varname>connection_expires</varname> (int)</title>
  501. <para>
  502. Specifies the period (in seconds) after a database connection
  503. expires. Usage of a too small value will probably decrease the
  504. performance.
  505. </para>
  506. <para>
  507. <emphasis>
  508. Default value is <quote>300</quote>.
  509. </emphasis>
  510. </para>
  511. <example>
  512. <title>Set <varname>connection_expires</varname> parameter</title>
  513. <programlisting format="linespecific">
  514. ...
  515. modparam("p_usrloc", "connection_expires", "300")
  516. ...
  517. </programlisting>
  518. </example>
  519. </section>
  520. <section>
  521. <title><varname>alg_location</varname> (int)</title>
  522. <para>
  523. Specify the way the distribution of the subscriptions are computed. At the moment the only way is to use the CRC32 algorithm to compute the location ID. Any integer value is fine.
  524. </para>
  525. <para>
  526. <emphasis>
  527. Default value is <quote>0</quote>.
  528. </emphasis>
  529. </para>
  530. <example>
  531. <title>Set <varname>alg_location</varname> parameter</title>
  532. <programlisting format="linespecific">
  533. ...
  534. modparam("p_usrloc", "alg_location", 1)
  535. ...
  536. </programlisting>
  537. </example>
  538. </section>
  539. <section>
  540. <title><varname>domain_db</varname>(str)</title>
  541. <para>
  542. Specify the way the lookup is made. In can be either partitioned or single. For example, if you have a location table that is large and needs to be partitioned, and a smaller table cfa that is ok to be on only the master db(so there is no need to have it distributed), you can set this parameter to <quote>location=cluster,cfa=single</quote>. This means that a call to <programlisting>lookup(location)</programlisting> will be done via the partition databases configured via the reg_db_table parameter, but a call to <programlisting>lookup(cfa)</programlisting> will be done on only the master database (as with usrloc module)
  543. </para>
  544. <para>
  545. <emphasis>
  546. Default value is <quote>location=cluster,cfa=single</quote>.
  547. </emphasis>
  548. </para>
  549. <example>
  550. <title>Set <varname>domain_db</varname> parameter</title>
  551. <programlisting format="linespecific">
  552. ...
  553. modparam("p_usrloc", "domain_db", "location=cluster,cfa=single")
  554. ...
  555. </programlisting>
  556. </example>
  557. </section>
  558. <section>
  559. <title><varname>default_db_type</varname>(str)</title>
  560. <para>
  561. In case a domain (like location,cfa) is not matched by a domain_db definition, the type is configured by using this parameter. Accepted values are single and cluster.
  562. </para>
  563. <para>
  564. <emphasis>
  565. Default value is <quote>single</quote>.
  566. </emphasis>
  567. </para>
  568. <example>
  569. <title>Set <varname>default_db_type</varname> parameter</title>
  570. <programlisting format="linespecific">
  571. ...
  572. modparam("p_usrloc", "default_db_type", "cluster")
  573. ...
  574. </programlisting>
  575. </example>
  576. </section>
  577. </section>
  578. <section>
  579. <title><varname>default_db_url</varname>(str)</title>
  580. <para>
  581. The URL of the default database for Location domains (for domains that are single). This must be configured if they are use.
  582. </para>
  583. <para>
  584. <emphasis>
  585. Default value is <quote>DEFAULT_DB_URL</quote>.
  586. </emphasis>
  587. </para>
  588. <example>
  589. <title>Set <varname>default_db_type</varname> parameter</title>
  590. <programlisting format="linespecific">
  591. ...
  592. modparam("p_usrloc", "default_db_url", "mysql://ser:ser@localhost/ser")
  593. ...
  594. </programlisting>
  595. </example>
  596. </section>
  597. <section>
  598. <title> Changes from usrloc module </title>
  599. <section>
  600. <title><varname>db_mode</varname> (integer)</title>
  601. <para>
  602. The p_usrloc module must utilize database for persistent contact storage.
  603. Only mode 3 is possible at this time. Because of the way other matching mode work,
  604. they make no sense on a distributed environment.
  605. </para>
  606. <itemizedlist>
  607. <listitem>
  608. <para>
  609. 3 - DB-Only scheme. No memory cache is kept, all operations being
  610. directly performed with the database. The timer deletes all
  611. expired contacts from database - cleans after clients that didn't
  612. un-register or re-register. The mode is useful if you configure
  613. more servers sharing the same DB without any replication at SIP
  614. level. The mode may be slower due the high number of DB operation.
  615. For example NAT pinging is a killer since during each ping cycle
  616. all nated contact are loaded from the DB; The lack of memory
  617. caching also disable the statistics exports.
  618. </para>
  619. </listitem>
  620. </itemizedlist>
  621. <para>
  622. <emphasis>
  623. Default value is 3.
  624. </emphasis>
  625. </para>
  626. <example>
  627. <title>Set <varname>db_mode</varname> parameter</title>
  628. <programlisting format="linespecific">
  629. ...
  630. modparam("p_usrloc", "db_mode", 2)
  631. ...
  632. </programlisting>
  633. </example>
  634. </section>
  635. <section>
  636. <title><varname>db_url</varname></title> <para> This parameters is now obsolete, and replaced by specific p_usrloc parameters</para>
  637. </section>
  638. </section>
  639. <section>
  640. <title>Installation &amp; Running</title>
  641. <section>
  642. <title>Database setup</title>
  643. <section>
  644. <title>Configuration Table</title>
  645. <para>
  646. Before running &kamailio; with p_usrloc, you have to setup the master database
  647. table where the module will find data about the distributed databases.
  648. For that, if the table was not created by the installation script or you choose
  649. to install everything by yourself you can use the p_usrloc-create.sql
  650. <acronym>SQL</acronym> script in the database directories in the
  651. openser/scripts folder as template.
  652. Database and table name can be set with module parameters so they
  653. can be changed, but the name of the columns must be as they are
  654. in the <acronym>SQL</acronym> script.
  655. You can also find the complete database documentation on the
  656. project webpage, &kamailiodbdocs;.
  657. </para>
  658. <example>
  659. <title>Example database content - reg_table (locdb) table</title>
  660. <programlisting format="linespecific">
  661. ...
  662. +----+----+------+--------+--------+---------------------+-------+----+
  663. | id | no | url | status | errors | failover | spare | rg |
  664. +----+----+------+--------+--------+---------------------+-------+----+
  665. | 1 | 1 | URL1 | 1 | 0 | 1900-01-01 00:00:01 | 0 | 0 |
  666. | 1 | 2 | URL2 | 1 | 0 | 1900-01-01 00:00:01 | 0 | 0 |
  667. | 2 | 1 | URL3 | 1 | 0 | 1900-01-01 00:00:01 | 0 | 0 |
  668. | 2 | 2 | URL4 | 1 | 0 | 1900-01-01 00:00:01 | 0 | 0 |
  669. +----+----+------+--------+--------+---------------------+-------+----+
  670. ...
  671. </programlisting>
  672. <para>The URLs are omitted for a better overview, but you can use
  673. standard &kamailio; database URLs like
  674. &defaultdb;
  675. Databases don't need to be on different hosts, e.g. for testing purposes.
  676. </para>
  677. </example>
  678. <para>
  679. This table contains two database groups. The first with id one,
  680. and the second with the id two.
  681. </para>
  682. </section>
  683. </section>
  684. <section>
  685. <title>Maintenance</title>
  686. <para>The module supports the decativation of redundant databases for maintenance
  687. reasons. This can be done by setting the status column of the respective database
  688. in the p_usrloc to the value <quote>2</quote>. This setting is autodetected from
  689. all modules on the server cluster. Changes in the locdb table are periodically
  690. polled with help of a timer process. After one minute the all read and write traffic
  691. is removed from the deactivated database, and maintenance can be done.
  692. </para>
  693. <para>
  694. In order to activate the database again, after the maintenance has been finished,
  695. the respective status column needs to be set to <quote>0</quote>. This is
  696. autodetected as well, the first module that noticed the change will set the status
  697. column to <quote>1</quote> and setting the failover column to the current time and
  698. date. Write requests are now transfered again to the database, but no reads are done
  699. yet.
  700. </para>
  701. <para>
  702. After the configured expire_time has been passed, i.e. every contact has been
  703. inserted at least one time in the database the respective failover time column
  704. is set to the default value again. The database is then also used to read contacts
  705. from, the cluster is in normal operation with full redundancy again.
  706. </para>
  707. </section>
  708. <section>
  709. <title>Additional configuration</title>
  710. <para>As this module is only used internally from other modules, there is no
  711. additional configuration except for the module parameter setup necessary.
  712. </para>
  713. </section>
  714. </section>
  715. </chapter>