From 60ae1b47c56dd17e17eefe479173515a360e9805 Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 1 Dec 2008 17:45:01 +0000 Subject: [PATCH] * doc/guide.tex: New subsection Database Connection * doc/guide.html: Likewise SVN Revision: 1697 --- ChangeLog | 5 ++ doc/guide.html | 141 +++++++++++++++++++--------------- doc/guide.tex | 205 +++++++++++++++++++++++++++++-------------------- 3 files changed, 207 insertions(+), 144 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41c44f958..f906b18f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-12-01 Badlop + + * doc/guide.tex: New subsection Database Connection + * doc/guide.html: Likewise + 2008-11-28 Alexey Shchepin * src/mod_muc/mod_muc_room.erl: Clean user activity after timeout diff --git a/doc/guide.html b/doc/guide.html index c15a76df7..e33aaf296 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -1246,7 +1246,18 @@ different storage systems for modules, and so forth.

The following databas

  • OpenLDAP
  • Normally any LDAP compatible server should work; inform us about your success with a not-listed server so that we can list it here. -
  • +

    Important note about virtual hosting: +if you define several domains in ejabberd.cfg (see section 3.1.1), +you probably want that each virtual host uses a different configuration of database, authentication and storage, +so that usernames do not conflict and mix between different virtual hosts. +For that purpose, the options described in the next sections +must be set inside a host_cofig for each vhost (see section 3.1.2). +For example: +

    {host_config, "public.example.org", [
    +  {odbc_server, {pgsql, "localhost", "database", "ejabberd", "password"}},
    +  {auth_method, [odbc]}
    +]}.
    +

    3.2.1  MySQL

    Although this section will describe ejabberd’s configuration when you want to use the native MySQL driver, it does not describe MySQL’s installation and @@ -1254,18 +1265,7 @@ database creation. Check the MySQL documentation and the tutorial {odbc_pool_size, 10}. -

    You can configure an interval to make a dummy SQL request -to keep alive the connections to the database. -The default value is ’undefined’, so no keepalive requests are made. -Specify in seconds: for example 28800 means 8 hours. -

    {odbc_keepalive_interval, undefined}.
    -

    If the connection to the database fails, ejabberd waits 30 seconds before retrying. -You can modify this interval with this option: -

    {odbc_start_interval, 30}.
    -

    +you can find information to update your database schema.

    Driver Compilation

    You can skip this step if you installed ejabberd using a binary installer or if the binary packages of ejabberd you are using include support for MySQL.

    1. @@ -1276,14 +1276,9 @@ put them for example in the same directory as your ejabberd .beam files also needed for native MySQL support!). This can be done, by using next commands:
      ./configure --enable-odbc && make install
      -

    -

    Authentication

    -

    The option value name may be misleading, as the auth_method name is used -for access to a relational database through ODBC, as well as through the native -MySQL interface. Anyway, the first configuration step is to define the odbc -auth_method. For example: -

    {host_config, "public.example.org", [{auth_method, [odbc]}]}.
    -

    The actual database access is defined in the option odbc_server. Its +

    +

    Database Connection

    +

    The actual database access is defined in the option odbc_server. Its value is used to define if we want to use ODBC, or one of the two native interface available, PostgreSQL or MySQL.

    To use the native MySQL interface, you can pass a tuple of the following form as parameter: @@ -1297,6 +1292,24 @@ can thus take the following form:

    {mysql, "Server", Port, "Database", "Username", "Password"}
     

    The Port value should be an integer, without quotes. For example:

    {odbc_server, {mysql, "localhost", Port, "test", "root", "password"}}.
    +

    By default ejabberd opens 10 connections to the database for each virtual host. +Use this option to modify the value: +

    {odbc_pool_size, 10}.
    +

    You can configure an interval to make a dummy SQL request +to keep alive the connections to the database. +The default value is ’undefined’, so no keepalive requests are made. +Specify in seconds: for example 28800 means 8 hours. +

    {odbc_keepalive_interval, undefined}.
    +

    If the connection to the database fails, ejabberd waits 30 seconds before retrying. +You can modify this interval with this option: +

    {odbc_start_interval, 30}.
    +

    +

    Authentication

    +

    The option value name may be misleading, as the auth_method name is used +for access to a relational database through ODBC, as well as through the native +MySQL interface. Anyway, the first configuration step is to define the odbc +auth_method. For example: +

    {auth_method, [odbc]}.
     

    Storage

    MySQL also can be used to store information into from several ejabberd @@ -1314,7 +1327,16 @@ tutorial

    +

    Driver Compilation

    +

    You can skip this step if you installed ejabberd using a binary installer or +if the binary packages of ejabberd you are using include support for ODBC.

    If you want to use Microsoft SQL Server with ODBC, you need to configure, +compile and install ejabberd with support for ODBC and Microsoft SQL Server +enabled. This can be done, by using next commands: +

    ./configure --enable-odbc --enable-mssql && make install
    +

    +

    Database Connection

    +

    By default ejabberd opens 10 connections to the database for each virtual host. Use this option to modify the value:

    {odbc_pool_size, 10}.
     

    You can configure an interval to make a dummy SQL request @@ -1322,13 +1344,6 @@ to keep alive the connections to the database. The default value is ’undefined’, so no keepalive requests are made. Specify in seconds: for example 28800 means 8 hours.

    {odbc_keepalive_interval, undefined}.
    -

    -

    Driver Compilation

    -

    You can skip this step if you installed ejabberd using a binary installer or -if the binary packages of ejabberd you are using include support for ODBC.

    If you want to use Microsoft SQL Server with ODBC, you need to configure, -compile and install ejabberd with support for ODBC and Microsoft SQL Server -enabled. This can be done, by using next commands: -

    ./configure --enable-odbc --enable-mssql && make install
     

    Authentication

    The configuration of Microsoft SQL Server is the same as the configuration of @@ -1349,15 +1364,7 @@ and database creation. Check the PostgreSQL documentation and the tutorial ejabberd’s configuration which is duplicate to this section.

    Also the file pg.sql in the directory src/odbc might be interesting for you. This file contains the ejabberd schema for PostgreSQL. At the end of the file -you can find information to update your database schema.

    By default ejabberd opens 10 connections to the database for each virtual host. -Use this option to modify the value: -

    {odbc_pool_size, 10}.
    -

    You can configure an interval to make a dummy SQL request -to keep alive the connections to the database. -The default value is ’undefined’, so no keepalive requests are made. -Specify in seconds: for example 28800 means 8 hours. -

    {odbc_keepalive_interval, undefined}.
    -

    +you can find information to update your database schema.

    Driver Compilation

    You can skip this step if you installed ejabberd using a binary installer or if the binary packages of ejabberd you are using include support for @@ -1371,14 +1378,9 @@ directory as your ejabberd .beam files. (this is also needed for native PostgreSQL support!). This can be done, by using next commands:

    ./configure --enable-odbc && make install
    -

    -

    Authentication

    -

    The option value name may be misleading, as the auth_method name is used -for access to a relational database through ODBC, as well as through the native -PostgreSQL interface. Anyway, the first configuration step is to define the odbc -auth_method. For example: -

    {host_config, "public.example.org", [{auth_method, [odbc]}]}.
    -

    The actual database access is defined in the option odbc_server. Its +

    +

    Database Connection

    +

    The actual database access is defined in the option odbc_server. Its value is used to define if we want to use ODBC, or one of the two native interface available, PostgreSQL or MySQL.

    To use the native PostgreSQL interface, you can pass a tuple of the following form as parameter: @@ -1392,6 +1394,21 @@ can thus take the following form:

    {pgsql, "Server", Port, "Database", "Username", "Password"}
     

    The Port value should be an integer, without quotes. For example:

    {odbc_server, {pgsql, "localhost", 5432, "database", "ejabberd", "password"}}.
    +

    By default ejabberd opens 10 connections to the database for each virtual host. +Use this option to modify the value: +

    {odbc_pool_size, 10}.
    +

    You can configure an interval to make a dummy SQL request +to keep alive the connections to the database. +The default value is ’undefined’, so no keepalive requests are made. +Specify in seconds: for example 28800 means 8 hours. +

    {odbc_keepalive_interval, undefined}.
    +

    +

    Authentication

    +

    The option value name may be misleading, as the auth_method name is used +for access to a relational database through ODBC, as well as through the native +PostgreSQL interface. Anyway, the first configuration step is to define the odbc +auth_method. For example: +

    {auth_method, [odbc]}.
     

    Storage

    PostgreSQL also can be used to store information into from several ejabberd @@ -1406,15 +1423,7 @@ Keep in mind that you cannot have several variants of the same module loaded!

    Using ejabberd with MySQL native driver also can help you. Note that the tutorial contains information about ejabberd’s configuration which is duplicate to -this section.

    By default ejabberd opens 10 connections to the database for each virtual host. -Use this option to modify the value: -

    {odbc_pool_size, 10}.
    -

    You can configure an interval to make a dummy SQL request -to keep alive the connections to the database. -The default value is ’undefined’, so no keepalive requests are made. -Specify in seconds: for example 28800 means 8 hours. -

    {odbc_keepalive_interval, undefined}.
    -

    +this section.

    Driver Compilation

    You can skip this step if you installed ejabberd using a binary installer or if the binary packages of ejabberd you are using include support for ODBC.

    1. @@ -1424,16 +1433,26 @@ put them for example in the same directory as your ejabberd .beam files
    2. Then, configure, compile and install ejabberd with ODBC support enabled. This can be done, by using next commands:
      ./configure --enable-odbc && make install
      -

    -

    Authentication

    -

    The first configuration step is to define the odbc auth_method. For -example: -

    {host_config, "public.example.org", [{auth_method, [odbc]}]}.
    -

    The actual database access is defined in the option odbc_server. Its +

    +

    Database Connection

    +

    The actual database access is defined in the option odbc_server. Its value is used to defined if we want to use ODBC, or one of the two native interface available, PostgreSQL or MySQL.

    To use a relational database through ODBC, you can pass the ODBC connection string as odbc_server parameter. For example:

    {odbc_server, "DSN=database;UID=ejabberd;PWD=password"}.
    +

    By default ejabberd opens 10 connections to the database for each virtual host. +Use this option to modify the value: +

    {odbc_pool_size, 10}.
    +

    You can configure an interval to make a dummy SQL request +to keep alive the connections to the database. +The default value is ’undefined’, so no keepalive requests are made. +Specify in seconds: for example 28800 means 8 hours. +

    {odbc_keepalive_interval, undefined}.
    +

    +

    Authentication

    +

    The first configuration step is to define the odbc auth_method. For +example: +

    {auth_method, [odbc]}.
     

    Storage

    An ODBC compatible database also can be used to store information into from diff --git a/doc/guide.tex b/doc/guide.tex index 6702880f3..d40cd8ae5 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -1590,6 +1590,21 @@ The following LDAP servers are tested with \ejabberd{}: success with a not-listed server so that we can list it here. \end{itemize} +Important note about virtual hosting: +if you define several domains in ejabberd.cfg (see section \ref{hostnames}), +you probably want that each virtual host uses a different configuration of database, authentication and storage, +so that usernames do not conflict and mix between different virtual hosts. +For that purpose, the options described in the next sections +must be set inside a \term{host\_cofig} for each vhost (see section \ref{virtualhost}). +For example: +\begin{verbatim} +{host_config, "public.example.org", [ + {odbc_server, {pgsql, "localhost", "database-public-example-org", "ejabberd", "password"}}, + {auth_method, [odbc]} +]}. +\end{verbatim} + + \makesubsection{mysql}{MySQL} \ind{MySQL}\ind{MySQL!schema} @@ -1603,26 +1618,6 @@ Moreover, the file mysql.sql in the directory src/odbc might be interesting for you. This file contains the \ejabberd{} schema for MySQL. At the end of the file you can find information to update your database schema. -By default \ejabberd{} opens 10 connections to the database for each virtual host. -Use this option to modify the value: -\begin{verbatim} -{odbc_pool_size, 10}. -\end{verbatim} - -You can configure an interval to make a dummy SQL request -to keep alive the connections to the database. -The default value is 'undefined', so no keepalive requests are made. -Specify in seconds: for example 28800 means 8 hours. -\begin{verbatim} -{odbc_keepalive_interval, undefined}. -\end{verbatim} - -If the connection to the database fails, \ejabberd{} waits 30 seconds before retrying. -You can modify this interval with this option: -\begin{verbatim} -{odbc_start_interval, 30}. -\end{verbatim} - \makesubsubsection{compilemysql}{Driver Compilation} \ind{MySQL!Driver Compilation} @@ -1642,16 +1637,9 @@ if the binary packages of \ejabberd{} you are using include support for MySQL. \end{verbatim} \end{enumerate} -\makesubsubsection{mysqlauth}{Authentication} -\ind{MySQL!authentication} -The option value name may be misleading, as the \term{auth\_method} name is used -for access to a relational database through ODBC, as well as through the native -MySQL interface. Anyway, the first configuration step is to define the odbc -\term{auth\_method}. For example: -\begin{verbatim} -{host_config, "public.example.org", [{auth_method, [odbc]}]}. -\end{verbatim} +\makesubsubsection{configuremysql}{Database Connection} +\ind{MySQL!Database Connection} The actual database access is defined in the option \term{odbc\_server}. Its value is used to define if we want to use ODBC, or one of the two native @@ -1681,6 +1669,38 @@ The \term{Port} value should be an integer, without quotes. For example: {odbc_server, {mysql, "localhost", Port, "test", "root", "password"}}. \end{verbatim} +By default \ejabberd{} opens 10 connections to the database for each virtual host. +Use this option to modify the value: +\begin{verbatim} +{odbc_pool_size, 10}. +\end{verbatim} + +You can configure an interval to make a dummy SQL request +to keep alive the connections to the database. +The default value is 'undefined', so no keepalive requests are made. +Specify in seconds: for example 28800 means 8 hours. +\begin{verbatim} +{odbc_keepalive_interval, undefined}. +\end{verbatim} + +If the connection to the database fails, \ejabberd{} waits 30 seconds before retrying. +You can modify this interval with this option: +\begin{verbatim} +{odbc_start_interval, 30}. +\end{verbatim} + + +\makesubsubsection{mysqlauth}{Authentication} +\ind{MySQL!authentication} + +The option value name may be misleading, as the \term{auth\_method} name is used +for access to a relational database through ODBC, as well as through the native +MySQL interface. Anyway, the first configuration step is to define the odbc +\term{auth\_method}. For example: +\begin{verbatim} +{auth_method, [odbc]}. +\end{verbatim} + \makesubsubsection{mysqlstorage}{Storage} \ind{MySQL!storage} @@ -1707,6 +1727,24 @@ Moreover, the file mssql.sql in the directory src/odbc might be interesting for you. This file contains the \ejabberd{} schema for Microsoft SQL Server. At the end of the file you can find information to update your database schema. + +\makesubsubsection{compilemssql}{Driver Compilation} +\ind{Microsoft SQL Server!Driver Compilation} + +You can skip this step if you installed \ejabberd{} using a binary installer or +if the binary packages of \ejabberd{} you are using include support for ODBC. + +If you want to use Microsoft SQL Server with ODBC, you need to configure, +compile and install \ejabberd{} with support for ODBC and Microsoft SQL Server +enabled. This can be done, by using next commands: +\begin{verbatim} +./configure --enable-odbc --enable-mssql && make install +\end{verbatim} + + +\makesubsubsection{configuremssql}{Database Connection} +\ind{Microsoft SQL Server!Database Connection} + By default \ejabberd{} opens 10 connections to the database for each virtual host. Use this option to modify the value: \begin{verbatim} @@ -1721,18 +1759,6 @@ Specify in seconds: for example 28800 means 8 hours. {odbc_keepalive_interval, undefined}. \end{verbatim} -\makesubsubsection{compilemssql}{Driver Compilation} -\ind{Microsoft SQL Server!Driver Compilation} - -You can skip this step if you installed \ejabberd{} using a binary installer or -if the binary packages of \ejabberd{} you are using include support for ODBC. - -If you want to use Microsoft SQL Server with ODBC, you need to configure, -compile and install \ejabberd{} with support for ODBC and Microsoft SQL Server -enabled. This can be done, by using next commands: -\begin{verbatim} -./configure --enable-odbc --enable-mssql && make install -\end{verbatim} \makesubsubsection{mssqlauth}{Authentication} \ind{Microsoft SQL Server!authentication} @@ -1767,19 +1793,6 @@ Also the file pg.sql in the directory src/odbc might be interesting for you. This file contains the \ejabberd{} schema for PostgreSQL. At the end of the file you can find information to update your database schema. -By default \ejabberd{} opens 10 connections to the database for each virtual host. -Use this option to modify the value: -\begin{verbatim} -{odbc_pool_size, 10}. -\end{verbatim} - -You can configure an interval to make a dummy SQL request -to keep alive the connections to the database. -The default value is 'undefined', so no keepalive requests are made. -Specify in seconds: for example 28800 means 8 hours. -\begin{verbatim} -{odbc_keepalive_interval, undefined}. -\end{verbatim} \makesubsubsection{compilepgsql}{Driver Compilation} \ind{PostgreSQL!Driver Compilation} @@ -1802,16 +1815,9 @@ PostgreSQL. \end{verbatim} \end{enumerate} -\makesubsubsection{pgsqlauth}{Authentication} -\ind{PostgreSQL!authentication} -The option value name may be misleading, as the \term{auth\_method} name is used -for access to a relational database through ODBC, as well as through the native -PostgreSQL interface. Anyway, the first configuration step is to define the odbc -\term{auth\_method}. For example: -\begin{verbatim} -{host_config, "public.example.org", [{auth_method, [odbc]}]}. -\end{verbatim} +\makesubsubsection{configurepgsql}{Database Connection} +\ind{PostgreSQL!Database Connection} The actual database access is defined in the option \term{odbc\_server}. Its value is used to define if we want to use ODBC, or one of the two native @@ -1840,6 +1846,32 @@ The \term{Port} value should be an integer, without quotes. For example: \begin{verbatim} {odbc_server, {pgsql, "localhost", 5432, "database", "ejabberd", "password"}}. \end{verbatim} +By default \ejabberd{} opens 10 connections to the database for each virtual host. +Use this option to modify the value: +\begin{verbatim} +{odbc_pool_size, 10}. +\end{verbatim} + +You can configure an interval to make a dummy SQL request +to keep alive the connections to the database. +The default value is 'undefined', so no keepalive requests are made. +Specify in seconds: for example 28800 means 8 hours. +\begin{verbatim} +{odbc_keepalive_interval, undefined}. +\end{verbatim} + + +\makesubsubsection{pgsqlauth}{Authentication} +\ind{PostgreSQL!authentication} + +The option value name may be misleading, as the \term{auth\_method} name is used +for access to a relational database through ODBC, as well as through the native +PostgreSQL interface. Anyway, the first configuration step is to define the odbc +\term{auth\_method}. For example: +\begin{verbatim} +{auth_method, [odbc]}. +\end{verbatim} + \makesubsubsection{pgsqlstorage}{Storage} \ind{PostgreSQL!storage} @@ -1861,19 +1893,6 @@ of your database. Check the documentation of your database. The tutorial \footah contains information about \ejabberd{}'s configuration which is duplicate to this section. -By default \ejabberd{} opens 10 connections to the database for each virtual host. -Use this option to modify the value: -\begin{verbatim} -{odbc_pool_size, 10}. -\end{verbatim} - -You can configure an interval to make a dummy SQL request -to keep alive the connections to the database. -The default value is 'undefined', so no keepalive requests are made. -Specify in seconds: for example 28800 means 8 hours. -\begin{verbatim} -{odbc_keepalive_interval, undefined}. -\end{verbatim} \makesubsubsection{compileodbc}{Driver Compilation} @@ -1892,14 +1911,9 @@ ODBC. \end{verbatim} \end{enumerate} -\makesubsubsection{odbcauth}{Authentication} -\ind{ODBC!authentication} -The first configuration step is to define the odbc \term{auth\_method}. For -example: -\begin{verbatim} -{host_config, "public.example.org", [{auth_method, [odbc]}]}. -\end{verbatim} +\makesubsubsection{configureodbc}{Database Connection} +\ind{ODBC!Database Connection} The actual database access is defined in the option \term{odbc\_server}. Its value is used to defined if we want to use ODBC, or one of the two native @@ -1911,6 +1925,31 @@ string as \term{odbc\_server} parameter. For example: {odbc_server, "DSN=database;UID=ejabberd;PWD=password"}. \end{verbatim} +By default \ejabberd{} opens 10 connections to the database for each virtual host. +Use this option to modify the value: +\begin{verbatim} +{odbc_pool_size, 10}. +\end{verbatim} + +You can configure an interval to make a dummy SQL request +to keep alive the connections to the database. +The default value is 'undefined', so no keepalive requests are made. +Specify in seconds: for example 28800 means 8 hours. +\begin{verbatim} +{odbc_keepalive_interval, undefined}. +\end{verbatim} + + +\makesubsubsection{odbcauth}{Authentication} +\ind{ODBC!authentication} + +The first configuration step is to define the odbc \term{auth\_method}. For +example: +\begin{verbatim} +{auth_method, [odbc]}. +\end{verbatim} + + \makesubsubsection{odbcstorage}{Storage} \ind{ODBC!storage}