Home  >  Article  >  Database  >  安装ejabberd2并配置MySQL为其数据库

安装ejabberd2并配置MySQL为其数据库

WBOY
WBOYOriginal
2016-06-07 15:39:571083browse

以前用过openfire做为服务器,但是openfire的集群支持不是很好,所以改用Ejabberd,由于它是用Erlang语言开发的,其并发率与分布式的功能都是很强悍的,在此我记录一下我的安装与配置过程。 1.安装就不用说了,到其官网下载安装包。我的系统是Mac OS, 所以我

以前用过openfire做为服务器,但是openfire的集群支持不是很好,所以改用Ejabberd,由于它是用Erlang语言开发的,其并发率与分布式的功能都是很强悍的,在此我记录一下我的安装与配置过程。

1.安装就不用说了,到其官网下载安装包。我的系统是Mac OS,  所以我只说明在Mac OS上安装。下载安装包后,直接点击安装。安装后会在/Applications目录生成Ejabberd的目录,由于我下载的是Ejabberd-2.1.11,所以安装目录为:/Applications/ejabberd-2.1.11/

2.配置支持MySQL,打开/Applications/ejabberd-2.1.11/conf/ejabberd.cfg   并做如下修改

a. 注释

{auth_method, internal}.
注释后为
%%{auth_method, internal}.
b. 这句取消注释
{auth_method, odbc}.
c. 创建数据库ejabberd

d.创建表 ,  如果你的MySQL是5.5.3版本以前,那么编辑mysql.sql,   将SET table_type=InnoDB;改为SET default_storage_engine=InnoDB;

cd /Applications/ejabberd-2.1.11/lib/ejabberd-2.1.11/priv/sql
mysql -u root -p ejabberd <br>
<br>
d. 配置mySQL<pre class="brush:php;toolbar:false">%%
%% MySQL server:
%%
{odbc_server, {mysql, "localhost", "ejabberd", "root", "MySqlPassword"}}.

e.配置模块,加一个_odbc

{mod_last_odbc,     []},
{mod_offline_odbc,  []},
{mod_privacy_odbc,  []},
{mod_private_odbc,  []},
{mod_pubsub_odbc,   [ % requires mod_caps ...
{mod_roster_odbc,   []},
{mod_vcard_odbc,    []},

3. 开启ejabberd, 

cd /Applications/ejabberd-2.1.11/lib
./start


由于mysql中没有数据,所以我们注册一个帐号,命令如下:

./ejabberdctl register admin mes1.com 123456


现在到http://localhost:5280/admin/  去login

用户名:admin

密码:123456



Reference:http://iohq.net/index.php?title=Building_an_Ejabberd_Server_with_MySql


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn