Jabber服务器之ejabberd
2010-04-03 14:54:56 阿炯

ejabberd is a free and open source instant messaging server written in Erlang/OTP.ejabberd is a distributed, fault-tolerant technology that allows the creation of large-scale instant messaging applications. The server can reliably support thousands of simultaneous users on a single node and has been designed to provide exceptional standards of fault tolerance. As an open source technology, based on industry-standards, ejabberd can be used to build bespoke solutions very cost effectively.

ejabberd是的Jabber/XMPP协议的即时通讯服务器,尊守GPLv2许可下(自由和开放源码) ,在其它特性中, ejabberd是跨平台、容错、集群和模块化。ejabberd采用 ErLang编写,ErLang被称之为并行变成之王,不但具有跨平台的能力,在性能方面尤其是在多核并行运行方面的效率是其它语言所无法比拟的,ErLang支持Linux,window,Unix等多种平台。Ejabberd号称是可扩展性最好的一种Jabber/XMPP服务器,支持分布多个服务器,ejabberd拥有并行容错处理能力,单台ejabberd服务器失效不影响整个ejabberd服务器集群的工作。Jabber/XMPP(Extensible Messaging and Presence Protocol),是一种开发的基于XML的协议,主要用于即是通信。大名鼎鼎的gtalk就是采用Jabber/XMPP协议开发的。基于 Jabber/XMPP协议通信需要服务器端和客户端,ejabberd就是作为Jabber/XMPP的服务端,而比较著名的Jabber客户端有pidgin、spark(java版本的客户端)等。

ejbberd,技术先进,性能优越,易用性好。

ejabber的开发语言,是erlang,这是爱立信发布的一种开源的语言,AXD301交换机就是用这个语言开发的。erlang内置支持分布式并发应用,代码热更新等高可用性的功能。erlang是一种典型的FP(函数语言),相对的,JAVA则是OO(面向对象)语言。关于erlang,最近慢慢热起来,要是细说起来有点枯燥,就不说了。

和wildfire相反,ejabberd的优点来自于erlang语言,并发性能非常好,分布式应用扩展非常方便,代码更新不需要重启程序(高可用性);它和java一样有内存管理功能但比java强(java启动程序的时候需要预先申请最大内存,运行中如果超过了这个值jvm就崩溃了,有测试的时候经常把jvm搞到崩溃。如果你在windows中用那个install4j来启动wildfire,永远别想到达1000个并发连接)。JSF之前用的是jabberd1.4,对于换server,他们的理由有三:1、尽量使用开源软件 2、稳定性 3、扩展性。

ejabberd的弱点,一是目前熟悉这门语言的人还是偏少。二是对主流关系数据库支持不够,lib也不够丰富,这和第一点也是相关的,这也意味着 ejabberd与外部系统整合难度大一些。

从编程语言角度看,主流的XMPP Server主要是JAVA和Erlang。JAVA语言的优势是类库完备,容易招人。Erlang的优势是hot code swap, live console, 高并发。ejabberd与Openfire/Tigase比较而言,最大的优势是相对优雅的集群方案以及更高的并发性能。

从各种XMPP Server支持的特性看,ejabberd是对XMPP协议支持最好、实现最为全面的server。

从开源协议看,Tigase采用AGPL开源协议,因此只要有代码修改,就必须对代码进行开源。Openfire采用Apache开源协议,修改代码后可以闭源。ejabberd采用GPL v2开源协议,如果只在服务端提供服务,而不进行代码二次分发,修改代码以后也可以闭源。

关键功能

    跨平台的: ejabberd可以运行在Microsoft Windows和Unix派生系统,例如Linux, FreeBSD和
    分布式的: 你可以在一个集群的机器上运行ejabberd,并且所有的机器都服务于同一个或一些Jabbe域. 当你需要更大容量的时候,你可以简单地增加一个廉价节点到你的集群里. 因此,你不需要买一个昂贵的高端机器来支持上万个并发用户.
    容错: 你可以布署一个ejabberd集群,这样一个正常运行的服务的所有必需信息将被复制到所有节点. 这意味着如果其中一个节点崩溃了, 其他节点将无中断的继续运行. 另外, 也可以‘不停机’增加或更换节点.
    易于管理: ejabberd建立于开源的 所以你不需要安装外部服数据库, 外部web服务器, 除此以外因为每个东西都已经包含在里面, 并且处于开箱可用状态. 其他管理上的好处包括:
        详尽的文档.
        便捷的安装程序,包括在Linux, Mac OS X, 以及Windows系统下.
        Web管理.
        共享名册组.
        命令行管理工具.
        可外部集成的验证机制.
        发送匿名消息的能力.
    国际化: ejabberd领导国际化. 非常适合全球化. 相关功能包括:
        翻译成25种语言.
        支持IDNA.
    开放标准: ejabberd是的一个完全支持XMPP标准的开源Jabber服务器.
        完全兼容
        基于XML的协议.
        支持的协议很多.

额外功能

ejabberd广泛支持的其他先进特性:

    模块化
        只装在你想要的模块.
        在你自己的自定义模块扩展
    安全性
        支持c2s和s2s连接的SASL和
        支持s2s连接的STARTTLS和
        可通过HTTPS安全访问的Web管理.
    数据库
        快速布署的内部数据库(Mnesia).
        原生的MySQL支持.
        原生的PostgreSQL支持.
        支持ODBC数据存储.
        支持Microsoft SQL Server.
    验证
        内部验证.
        PAM, LDAP 和
        外部验证脚本.
    其他
        支持虚拟主机.
        XML流压缩 (XEP-0138).
        统计 (XEP-0039).
        支持IPv6的c2s和s2s连接.
        支持集群和HTML日志的多用户聊天模块.
        基于用户vCards的用户目录.
        支持基于PubSub的个人事件的发行-订阅组件.
        支持web客户端:HTTP轮询和HTTP绑定(BOSH)服务.
        IRC网关.
        组件支持: 安装特定网关之后和外部网络的接口,如 AIM, ICQ等.

ejabberd is cross-platform, distributed, fault-tolerant, and based on open standards to achieve real-time communication.

ejabberd is designed to be a rock-solid(坚硬如岩石的;绝对可靠的) and feature rich XMPP server.

ejabberd is suitable for small deployments, whether they need to be scalable or not, as well as extremely big deployments.

General

Cross-platform
ejabberd runs under Microsoft Windows and Unix derived systems such as Linux, Mac OS X, FreeBSD and NetBSD.

Distributed
You can run ejabberd on a cluster of machines and all of them will serve the same Jabber domain(s). When you need more capacity you can simply add a new cheap node to your cluster. Accordingly, you do not need to buy an expensive high-end machine to support tens of thousands concurrent users.

Fault-tolerant
You can deploy an ejabberd cluster so that all the information required for a properly working service will be replicated permanently on all nodes. This means that if one of the nodes crashes, the others will continue working without disruption. In addition, nodes also can be added or replaced `on the fly'.

Administrator Friendly
ejabberd is built on top of the Open Source Erlang. As a result you do not need to install an external database, an external web server, amongst others because everything is already included, and ready to run out of the box.

Jabber/XMPP

XMPP Compliancy
ejabberd supports all XMPP Core 1.0 and XMPP IM 1.0. Check the supported protocols.

Encryption of Client Communication
SASL authentication, STARTTLS encryption and old SSL

Encryption of Server Communication
In 2.1.6 option to require server encryption and verify certificates.
STARTTLS+Dialback and STARTTLS+SASL

Statistics Gathering
Internationalization Using xml:lang

Translated to 24 languages.

Administration

Easy Installation
There is not only a source code package and a public Git repository available, but there are also first-party installers for Microsoft Windows 98/2000/XP, Linux x86 and MacOS X PowerPC. Furthermore, several operating system distributions include ejabberd in their repositories.

Virtual Hosts
Multiple Jabber domains can be hosted on the same ejabberd instance. As simple as adding a new domain name to the list of hosts in the configuration file.

IPv6
ejabberd supports IPv6 both for client-2-server (c2s) as well as server-2-server (s2s) connections.

Shared Roster Groups
Added in 2.1.6 support for LDAP storage.
The administrator can setup a common list of Jabber users for all users on the server. Those users are virtually added to all rosters. They cannot be removed, but can be renamed or moved into different roster groups. Does not require client implementation. Not related to XEP-0144: Roster Item Exchange.

Web-based Administration Interface
With HTTPS secure access. Screenshots

Command line Administration Tool
Some basic administration task can be acomplished using the command line: register/remove users, backup/restore database.

Adminstrate Using a Jabber Client
With support for XEP-0133: Service Administration. Screenshots

Embedded Components

Multi-User Chat
As described in XEP-0045: Multi-User Chat. Allows chatroom logging to HTML.

Publish-Subscribe
As described in XEP-0060: Publish-Subscribe, and XEP-0163: PEP.

Jabber Users Directory
The directory searches information stored on users' vCards

HTTP-Binding
As described in XEP-0124: BOSH

HTTP-Polling
As described in XEP-0025: Jabber HTTP Polling

Proxy65 file transfer proxy
As described in XEP-0065: Proxy65

HTTP file server
This simple file server can be used to publish MUC HTML files, or web clients like JWChat or MUCkl.

Interaction with Other Software

LDAP Authentication
Accounts can authenticate against an LDAP server.

PAM Authentication
Accounts can authenticate using PAM in *nix systems.

Authentication using External script
Accounts can authenticate using an external authentication script.

ODBC Data Storage
Support for ODBC data storage. ODBC requests can be load balanced between multiple connections.

Relational Database Storage
Native database storage to PostgreSQL or MySQL gives a better performance than ODBC.

Ability to Interface with External Components (PyAIMt, PyICQt, PyMSNt, PyYIMt, amongst others)
And there are several tutorials describing the process.

Migration from/to Another XMPP Server
ejabberd includes the ability to import jabberd 1.4 spool directories, and PIEFXIS files following XEP-0227. This feature allows you to migrate from/to other XMPP servers.
------------------------------


最新版本:17.08
该版本支持 XEP-0198, XEP-0321, SIP, 和 TURN,此外还包含其他的改进和 bug 修复。

------------------------------
官方主页:
http://www.ejabberd.im/
http://www.process-one.net/en/ejabberd/

该文章最后由 阿炯 于 2017-09-09 20:53:21 更新,目前是第 4 版。