Tigase负载平衡配置信息-----7.1.2

发布时间: 5年前 (2020-04-16)浏览: 858评论: 0

8.10。Tigase负载平衡

从版本5.2.0开始,Tigase引入了负载平衡功能,允许用户重定向到最合适的群集节点。功能依赖于其他主机XMPP流错误消息。该机制的基本原理是,如果实现返回的主机与用户当前尝试连接的主机不同,则用户将获得重定向。要求知道用户JID才能使重定向正常工作。

8.10.1。可用的实现

像往常一样,Tigase实现是可扩展的,并且允许使用不同的,可插拔的重定向策略来实现该SeeOtherHostIfc接口。

当前有三种策略可用:

  • SeeOtherHost -最基本的实现返回init.properties文件中配置的单个主机或当前主机的名称;

  • SeeOtherHostHashed(默认)-SeeOtherHostIfc群集环境基于用户JID的哈希值返回重定向主机的默认实现;默认情况下,将从中进行选择的可用节点列表组成并反映所有连接的节点,或者可以在init.properties中配置主机列表;

  • SeeOtherHostDB -SeeOtherHost的扩展实现,它使用来自数据库的重定向信息,形式为user_id和node_id对,应将给定用户重定向到该对。

8.10.2。配置选项

最基本的配置与实际重定向实现的选择有关:

--cm-see-other-host=

可能的值为:

  • tigase.server.xmppclient.SeeOtherHost

  • tigase.server.xmppclient.SeeOtherHostHashed

  • tigase.server.xmppclient.SeeOtherHostDB

  • tigase.server.xmppclient.SeeOtherHostDualIP

  • none -禁用重定向

其余所有选项均基于每个连接管理器进行配置,因此所有选项都必须带有相应的连接管理器ID前缀,即c2s,bosh或ws;我们将在示例中使用c2s:

  • c2s/cm-see-other-host/default-host=host1;host2;host3 -用分号分隔的主机列表,用于重定向;

  • c2s/cm-see-other-host/active=OPEN;LOGIN -以分号分隔的阶段列表,其中的重定向应该处于活动状态,当前可能的值为:

    • OPEN 在打开XMPP流期间启用重定向;

    • LOGIN 它可以在验证用户会话时进行重定向;

默认情况下,当前仅在OPEN阶段中启用重定向

SeeOtherHostDB

为了SeeOtherHostDB实现,还有其他选项:

  • c2s/cm-see-other-host/db-url-应该用于查询重定向信息的JDBC连接URI;如果未配置,将使用--user-db-uri;

  • c2s/cm-see-other-host/get-host-query -SQL查询,应返回重定向主机名;

  • c2s/cm-see-other-host/get-all-data-query -SQL帮助程序查询,应从数据库返回所有重定向数据;

  • c2s/cm-see-other-host/get-all-query-timeout -允许为执行的查询设置超时。

SeeOtherHostDualIP

此机制将内部Tigase群集节点与查找表进行匹配,以提供匹配和相关的重定向主机名/ IP。默认情况下,cluster_nodes将使用内部Tigase 表(并将使用适当的存储库实现)。

要启用此重定向机制,应使用以下配置/类:

--cm-see-other-host=tigase.server.xmppclient.SeeOtherHostDualIP

可以在每个连接管理器的基础上进行配置

<connector>/cm-see-other-host[S]=tigase.server.xmppclient.SeeOtherHostDualIP

它提供以下配置选项:

  • data-source-重定向信息源的配置-默认情况下,cluster_nodes将使用内部Tigase 表(并将使用适当的存储库实现);或者可以使用eventbus源;

  • db-url-应该用于查询重定向信息的JDBC连接URI;如果未配置,--user-db-uri将使用;

  • get-all-data-query -SQL帮助程序查询,应从数据库返回所有重定向数据;

  • get-all-query-timeout -允许为执行的查询设置超时;

  • fallback-redirection-host-如果不存在重定向信息(即未为特定节点配置辅助主机名),将不会生成重定向;这样就可以配置回退重定向地址。

可以全局配置所有选项(不提供type参数)

--cm-see-other-host/db-url=jdbc:<database>://<uri> --cm-see-other-host/data-source=<class implementing tigase.server.xmppclient.SeeOtherHostDualIP.DualIPRepository> --cm-see-other-host/get-all-data-query=select * from cluster_nodes --cm-see-other-host/get-all-query-timeout=10 --cm-see-other-host/fallback-redirection-host=<hostname>

或按组件

<connector>/cm-see-other-host/db-url[S]=jdbc:<database>://<uri> <connector>/cm-see-other-host/data-source[S]=<class implementing tigase.server.xmppclient.SeeOtherHostDualIP.DualIPRepository> <connector>/cm-see-other-host/get-all-data-query[S]=select * from cluster_nodes <connector>/cm-see-other-host/get-all-query-timeout[I]=10 <connector>/cm-see-other-host/fallback-redirection-host[S]=<hostname>
EventBus作为信息源

可以将EventBus和内部Tigase事件用作重定向数据的源。为此,eventbus应将其用作data-source配置选项的值另外,需要在ClusterConnectionManager中启用EventBus事件。配置示例:

cl-comp/eventbus-repository-notifications[B]=true --cm-see-other-host/data-source=eventbus

或按组件:

cl-comp/eventbus-repository-notifications[B]=true <connector>/cm-see-other-host/data-source[S]=eventbus


标签:

上一篇: Tigase MUC组件配置信息 ----7.1.2
下一篇: Freeswitch总结大全

相关文章暂无相关
评论列表暂无评论
发表评论
验证码

«   2024年4月   »
1234567
891011121314
15161718192021
22232425262728
2930
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
    文章归档
    网站收藏
    友情链接
    • RainbowSoft Studio Z-Blog
    • 订阅本站的 RSS 2.0 新闻聚合
    ︿
    Top