[翻译] Hazelcast Clustering Plugin 部署指南(未完待续)

来源:互联网 发布:名字分析软件 编辑:程序博客网 时间:2024/05/16 09:01


概述

Hazelcast插件支持运行多个冗余的Openfire服务器组建集群。作为群集运行的Openfire,您可以分发几个服务器之间的连接负载,同时还提供服务器故障自动转移。这个插件替换了原来的Openfire集群插件,使用开源的Hazelcast数据分布框架代替昂贵的专有第三方产品。

本插件当前稳定版本为 2.5.1.

安装

要创建一个Openfire的集群,你应该至少有两台Openfire服务器,每个服务器必须安装有Hazelcast集群插件。要安装Hazelcast,只需将插件安装包hazelcast.jar拖放到$OPENFIRE_HOME/plugins目录,同其他你已经安装的插件目录。您也可以使用openfire的插件管理页面,从管理控制台安装插件。需要注意的是必须配置一个集群中的所有服务器共享一个单一的外部数据库如mysql,而不是嵌入式DB(Embedded DB)。

Openfire的启动/初始化过程在默认情况下,服务器会通过UDP(组播)发现对方,通过一个可配置的IP地址和端口的数据包交换。但是,请注意,许多其他初始化选项是可用的,你可以自行配置,比如你的网络不支持组播通信(见下面的配置)。

Hazelcast插件部署到每个服务器后,你可以用位于管理控制台的(Clustering 页面)上的单选按钮控制来启用/启动集群。你只需要启用集群一次;这项更改会自动传播到其他服务器。刷新Clustering 页后,你将能看到所有服务器已成功加入集群。

需要注意的是Hazelcast与早期的集群插件(clustering.jar enterprise.jar)是相互排斥的。 Hazelcast安装到您的Openfire服务器之前,你将需要删除的任何现有旧的集群类插件。

随着群集的建立和运行,现在你将需要通过负载平衡器负责分发您的Openfire集群成员之间的连接负载。有几个商业和开源项目。例如,如果您使用的是 HTTP/BOSH Openfire connector 连接倒Openfire ,您可以给 Apache Web服务器(httpd)加上相应的代理平衡器模块 (例如:mod_proxy_balancer)。其他一些流行的选择包括F5 LTM 商业插件)和 HAProxy(开源),以及更多

一个简单的DNS轮循配置可以帮助分发XMPP连接 一个集群中的多个Openfire的服务器。虽然这是一种轻量级的和低成本的方式提供基本的可扩展性。需要注意的是,这种做法并不是真正的负载平衡,也不提供高可用性(HA)。如果您正在评估这些项目,你可以在这里查看更多。

插件升级

相对于安装,升级Hazelcast插件的过程需要一些额外的步骤,由于正在运行的集群内跨服务器的依赖与传统的插件。实事求是地讲,集群中的所有成员必须运行同一版本的插件,以防止各种错误和数据同步问题。

情景一: 离线升级

注意:此升级过程是干净的,但会产生一个短暂的服务中断。

  1. 关闭集群中的所有Openfire服务器
  2. 对集群中的每一个服务器,按照以下顺序执行:
    1. 如果存在,移除进群插件,插件位于 plugins/hazelcast.jar
    2. 删除插件目录,位于 plugins/hazelcast 
    3. 复制最近的插件文件 hazelcast.jar 到 plugins 目录
    4. 重新启动Openfire服务器,解压并安装hazelcast插件
  3. 重复以上操作直到所有服务器升级完毕

情景二: 在线升级

注意:只有你希望在升级过程中能够继续使用XMPP服务才使用这种方法。

  1. 关闭所有的服务器,只保留一个.
  2. 在保留的服务器中使用插件管理页面,移除当前的Hazelcast 插件.
  3. 上传最新的 Hazelcast 插件 提交后安装 (如果需要可以刷新页面)
  4. 使用上面 "离线升级" 的步骤 完成其他服务器的升级,并重启.

情景三 : Split-Brain

注意使用这种方法,您只能访问到Openfire控制台。需要注意的是,用户可能不能够互相通信,在升级过程中(如果它们连接到不同的服务器上)。

  1. From the Clustering page in the Openfire admin console, disable clustering. This will disable clustering for all members of the cluster.
  2. For each server, update the Hazelcast plugin using the Plugins page.
  3. After upgrading the plugin on all servers, use the Clustering page to enable clustering. This will activate clustering for all members of the cluster.

配置

Hazelcast插件在Openfire的系统属性的配置选项:

  1. hazelcast.startup.delay.seconds (5): Number of seconds to wait before launching the Hazelcast plugin. This allows Openfire to deploy any other plugins before initializing the cluster caches, etc.
  2. hazelcast.startup.retry.count (1): Number of times to retry initialization if the cluster fails to start on the first attempt.
  3. hazelcast.startup.retry.seconds (10): Number of seconds to wait between subsequent attempts to start the cluster.
  4. hazelcast.max.execution.seconds (30): Maximum time to wait when running a synchronous task across members of the cluster.
  5. hazelcast.config.xml.filename (hazelcast-cache-config.xml): Name of the Hazelcast configuration file. By overriding this value you can easily install a custom cache configuration file in the Hazelcast plugin /classes/ directory, in the directory named via the hazelcast.config.xml.directory property (described below), or in the classpath of your own custom plugin.
  6. hazelcast.config.xml.directory ({OPENFIRE_HOME}/conf): Directory that will be added to the plugin's classpath. This allows a custom Hazelcast configuration file to be located outside the Openfire home directory.
  7. hazelcast.config.jmx.enabled (false): Enables JMX support for the Hazelcast cluster if JMX has been enabled via the Openfire admin console. Refer to the Hazelcast JMX docs for additional information.

Hazelcast插件使用XML配置生成器来生成配置 ,通过这些配置设定初始化集群。例如使用默认配置,集群服务器试图通过多播发现对方所在的位置:

  • IP Address: 224.2.2.3
  • Port: 54327
Note that these values can be overridden in the plugin's /classes/hazelcast-cache-config.xml file (via the multicast-group and multicast-port elements). Many other initialization and discovery options exist, as documented in the Hazelcast configuration docs noted above. For example, to set up a two-node cluster using well-known DNS name/port values, try the following alternative:
...<join>    <multicast enabled="false"/>    <tcp-ip enabled="true">      <hostname>of-node-a.example.com:5701</hostname>      <hostname>of-node-b.example.com:5701</hostname>    </tcp-ip>    <aws enabled="false"/></join>...

Please refer to the Hazelcast reference manual for more information.


以后会慢慢补充 , 翻译插件的XML配置文件

交流请联系请在微博上私信  


转载请保留出处及连接  谢谢

0 0
原创粉丝点击