通过mod_archive_odbc的本机驱动程序将ejabberd连接到MySQL

时间:2013-09-24 14:01:44

标签: mysql ejabberd

我正在尝试将我们的ejabberd服务器连接到MySQL以添加mod_archive_odbc模块。我们正在运行ejabberd 2.1.13。服务器的其余部分使用mnesia进行存储。我首先尝试了DSN方法,但失败了。我目前在erlang.log中收到此错误:

=PROGRESS REPORT==== 24-Sep-2013::13:50:27 ===
          supervisor: {local,ejabberd_sup}
             started: [{pid,<0.777.0>},
                       {name,'ejabberd_mod_archive_odbc_chat.hostname.com'},
                       {mfargs,
                           {mod_archive_odbc,start_link,
                               ["chat.hostname.com",
                                [{database_type,"mysql"},
                                 {default_auto_save,true},
                                 {enforce_default_auto_save,false},
                                 {default_expire,infinity},
                                 {enforce_min_expire,0},
                                 {enforce_max_expire,infinity},
                                 {replication_expire,31536000},
                                 {session_duration,1800},
                                 {wipeout_interval,86400}]]}},
                       {restart_type,permanent},
                       {shutdown,1000},
                       {child_type,worker}]
=CRASH REPORT==== 24-Sep-2013::13:50:36 ===   crasher:
    initial call: mod_archive_odbc:init/1
    pid: <0.777.0>
    registered_name: 'ejabberd_mod_archive_odbc_chat.hostname.com'
    exception exit: {aborted,{no_exists,[sql_pool,"chat.hostname.com"]}}
      in function  gen_server:terminate/6
    ancestors: [ejabberd_sup,<0.37.0>]

这就是模块部分的样子:

  {mod_archive_odbc, [{database_type, "mysql"},
                      {default_auto_save, true},
                      {enforce_default_auto_save, false},
                      {default_expire, infinity},
                      {enforce_min_expire, 0},
                      {enforce_max_expire, infinity},
                      {replication_expire, 31536000},
                      {session_duration, 1800},
                      {wipeout_interval, 86400}]}

这就是数据库部分的样子:

{odbc_server, {mysql, "localhost", "ejabberd", "ejabberd", "password"}}.

我也可以使用ejabberd用户本地和远程连接到mysql服务器。

发生错误时,这是​​ngrep输出:

# ngrep port 3306
interface: eth0 (10.179.7.192/255.255.255.192)
filter: (ip or ip6) and ( port 3306 )
^Cexit
0 received, 0 dropped

# ngrep -d lo port 3306
interface: lo (127.0.0.0/255.0.0.0)
filter: (ip or ip6) and ( port 3306 )
^Cexit
0 received, 0 dropped

如果我通过网络上的另一台计算机与ejabberd用户连接到MySQL,那么这是ngrep输出

# ngrep port 3306
interface: eth0 (10.179.7.192/255.255.255.192)
filter: (ip or ip6) and ( port 3306 )
####
T 10.179.7.235:3306 -> XX.XXX.XXX.XXX:55909 [AP]
  J....5.5.32.....xxpKb-VK...................UKXV(a2rh6r].mysql_native_password.
##
T XX.XXX.XXX.XXX:55909 -> 10.179.7.235:3306 [AP]
  >...................................ejabberd....).p.P..lt=BTK..w..
##
T 10.179.7.235:3306 -> XX.XXX.XXX.XXX:55909 [AP]
  ...........
#
T XX.XXX.XXX.XXX:55909 -> 10.179.7.235:3306 [AP]
  !....select @@version_comment limit 1
#
T 10.179.7.235:3306 -> XX.XXX.XXX.XXX:55909 [AP]
  .....'....def....@@version_comment............................MySQL Community Server (GPL).........
##
T XX.XXX.XXX.XXX:55909 -> 10.179.7.235:3306 [AP]
  .....
###

似乎已安装MySQL模块:

(ejabberd@ip-10-179-7-235)1> ejabberd_check:check_database_module(mysql).
ok

1 个答案:

答案 0 :(得分:2)

问题是我所做的更改未在实际服务中更新。另一个问题How to uninstall odbc for Ejabberd?以及@giavac上面的评论使我意识到配置文件显然并不总是配置权威。

具体来说,我通过添加以下行修复了我的问题:

override_local.