2016-04-04-Ejabberd-configure-db-postgresql
2016-05-12 00:17
549 查看
Configure Ejabberd chat server to use PostgreSQL
Date: 2016-04-04 19:58:00In order to make data persistent with in any application, we can link it to a PostgreSQL relational database.
To change the default to use a postgres database we first need to create a new postgresql database on the server
huazhang@zhoutekiMacBook-Air:~/ejabberd-15.09/bin$ psql psql (9.4.4) huazhang=# run ./createdb ejabberd ``` 2. Create the tables using the supplied script
huazhang-# ./psql ejabberd < ~/ejabberd-15.09/lib/ejabberd-15.09/priv/sql/pg.sql
3. Add a user for the database
~/ejabberd-15.09/bin$ createuser -P -s -e admin
Enter password for new role: root123
Enter it again: root123
CREATE ROLE testadmin PASSWORD ‘md55ebf4663bc3108d036c91bc4bbcfd599’ SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
4. Configure ODBC options in ejabberd.cfg:
Scroll down to the section headed Database setup.
edit the following, remove the %% commenting
PostgreSQL server:
odbc_type: pgsql
odbc_server: “localhost”
odbc_database: “ejabberd”
odbc_username: “admin”
odbc_password: “root123”
5. Add _odbc to modules you wish to use the odbc database, and store messages into archive table
e.g. mod_offline_odbc instead of mod_offline.
full list in ejabberd user guide
Modules enabled in all ejabberd virtual hosts.
modules:
#By default mod_mam does not store messages. If you like to store messages, simply add this mod_mam option:
mod_mam:
default: always
db_type: odbc
“`
Under authentication comment out internal authentication:
“`
auth_method: internal
Then un comment auth_method: odbc“`
Register a new user and appear online using PSI client or similar application
Add a user to allowed admin access control list in ejabberd.cfg
{acl, admin, {user, "username", "server"}}.
Confirm registered user and status in web admin:
http://serverIP:5280/admin/
Connect to database using PgAdmin to view tables with data and confirm ejabberd is now using PostgreSQL
Reference
Getting started with ejabberd[Initial setup and install of PostgreSQL Database]
(http://stackoverflow.com/questions/9753710/setup-ejabberd-with-postgresql)
相关文章推荐
- win8.1安装mongodb
- 使用phpexcel类实现excel导入mysql数据库功能(实例代码)
- SQL恢复master数据库方法 只有mdf文件的数据库如何恢复
- SQL Server阻止保存修改表结构的解决方法
- Ubuntu 14.04下mysql安装配置教程
- SQL查询语句行转列横向显示实例解析
- SQLJoin连接详解
- mysql found_row()使用详解
- 图文详解Ubuntu下安装配置Mysql教程
- Ubuntu下mysql安装和操作图文教程
- MySQL 5.7 JSON 新特性 用法总结
- Memcache
- Oracle用户和权限
- PLSQL整理
- MySQL常用命令
- SQL SERVER 数据库 怎么从一个服务器一个表中把数据插入到另一个服务器中的一个表内(纯复制)
- Oracle 同义词(synonyms) 详解
- MongoDB副本集(Replica Set)搭建
- 生僻sql
- sql 视图