如何使用单独的脚本连接到 ejabberd 的 Mnesia 数据库?
我正在尝试从单独的脚本将隶属关系数据插入 ejabberd 的 Mnesia 数据库中。我是一名 Erlang 初学者,虽然我可以弄清楚如何创建和使用单独的 Mnesia 数据库,但我无法弄清楚如何连接到 ejabberd 的数据库。使用相同的“-mnesia dir”似乎还不够。
I'm trying to insert affiliation data into ejabberd's Mnesia databse from a separate script. I'm an Erlang beginner, and while I can figure out how to create and use a separate Mnesia database, I can't figure out how to connect to ejabberd's. Using the same "-mnesia dir" does not seem to suffice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题归结为如何在 Erlang 中进行 rpc 调用的问题。
确保 ejabberd 使用节点主机部分的完全限定主机名或 IP 地址运行。这在我的安装中在 /etc/ejabberd/ejabberdctl.cfg 中指定为 EJABBERD_NODE。如果您确实必须在此步骤中更改主机名,请参阅 https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.10/doc/guide.html#htoc79 (“更改计算机主机名”)。
使用 -name 或 -sname 启动 shell 或脚本,并使用具有与上述相同限制的主机。
您已准备好使用 Erlang 的内置 RPC。例如:
来自您的 shell 或脚本)
The question reduces to the question of how to make rpc calls in Erlang.
Ensure that ejabberd is running with either a fully-qualified hostname or IP address for host part of the node. This is specified in my installation as EJABBERD_NODE in /etc/ejabberd/ejabberdctl.cfg. If you do have to change the hostname in this step, consult https://git.process-one.net/ejabberd/mainline/blobs/raw/v2.1.10/doc/guide.html#htoc79 ("Change Computer Hostname").
Start your shell or script with -name or -sname and use a host with the same restriction as above.
You're ready to use Erlang's built-in RPC. For example:
(from your shell or script)
只需使用命令ejabberdctl debug
just use command ejabberdctl debug