erlang 使用mysql创建的Ejabberd花名册

gdx19jrr  于 2022-12-08  发布在  Erlang
关注(0)|答案(2)|浏览(160)

我正在使用exauth和ejabberd来验证我的用户,但是我想使用mysql来存储用户信息,比如组、花名册等。
这是我的配置。

{auth_method, external}.
{extauth_program, "/home/hitesh/ejabberd_auth.php"}.

{host_config, "subdomain.nodyssey.com", [{auth_method, [external, anonymous]}]}.

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

mysql数据库是空的!2用户仍然有名册和聊天历史上的群聊,所以看起来像mnesia数据库正在使用!3我如何切换到mysql为这个?
我做错了什么?

woobm2wo

woobm2wo1#

这个问题已经问了一段时间了。在此期间,Ejabberd配置文件已经更改。要启用外部花名册存储,假设ejabberd和mysql DB以及ejabberd模式都已配置,您需要在ejabberd.yml中做的就是:

sql_type: mysql
sql_server: "localhost"
sql_database: "some_database_name"
sql_username: "some_username"
sql_password: "some_password"

并更改mod_roster: {}

mod_roster:
   db_type: sql
qaxu7uf2

qaxu7uf22#

user601836's correct. I misunderstood the question initially. Assuming that odbc and mysql driver are properly installed, here is the updated answer:

  1. Have you created the mysql tables to store the roster data, etc? Also are all of your ejabberd tables created using innodb engine? You can get the schema in github: https://github.com/processone/ejabberd/blob/2.1.x/src/odbc/mysql.sql . Also you can find it in your ejabberd installation folder. Mine is in this location: ejabberd_installation_root/lib/ejabberd-2.1.11/priv/sql/mysql.sql.
  2. Replace related module names using the *_odbc one in your ejabberd.cfg. For example, replace mod_roster to mod_roster_odbc, replace mod_muc to mod_muc_odbc. A number of odbc supported modules are listed here:
...
{mod_offline_odbc,  []},
{mod_last_odbc,     []},
{mod_roster_odbc,   []},
{mod_shared_roster_odbc,[]},
{mod_vcard_odbc,    []},
{mod_muc_odbc, [
  ...]},
{mod_pubsub_odbc, [
  ...]},
...

For the detailed module information, check the official doc:

https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.11/doc/guide.html#modoverview

相关问题