Project

General

Profile

chat with multi vhosts

hurry wang
Added over 2 years ago

Hi,

I ran my program in cluster mode with two vhosts, I use spark to regist users with different vhost and try to chat with each other ,but I failed ,could you show me how it can be impleted,,I upload my attachment of the configration of my tigase,thanks a lot.


Replies (9)

Added by Wojciech Kapcia TigaseTeam over 2 years ago

hurry wang wrote:

Hi,

I ran my program in cluster mode with two vhosts, I use spark to regist users with different vhost and try to chat with each other ,but I failed ,could you show me how it can be impleted,,I upload my attachment of the configration of my tigase,thanks a lot.

You should be able to chat (sending direct messages) just fine between different configured vhosts.

It will fail for MUC chat, as you are using non-clustered version of the component (and clustered version requires ACS clustering):

--comp-name-5 = muc
--comp-class-5 = tigase.muc.MUCComponent

Added by hurry wang over 2 years ago

Hi,

I tried again ,but also failed ,I use two clients of spark,one regist user t1 with tigmsgstore.test.com vhsot domain,another regist user t2 with tigsendtochatroom.test.com vhost domain, when t1 add friend t2,it shows t2 not online ,t2 can not recive message from t1, there must be some wrong configuration,could you help me find it out please,thank you.

Added by Wojciech Kapcia TigaseTeam over 2 years ago

Your configuration looks correct.

Please share full stanza exchange from your clients as well as logs from the server (but please clear logs before starting the server and trying to reproduce the case).

Added by hurry wang over 2 years ago

Hi,I had a long holiday for 7 days ,so I did not give you reponse,sorry.

I use DNS for loadbalance tigase cluster mode with two nodes,every node configed different hostname which is used as --virt-hosts,and also used as DNS domain names,they are tigmsgstore.ttvlove.com & tigsendtochatroom.ttvlove.com, I used two spark clients with these domain to register two users, the issue is they can't be added each other. The configration file and logs are in the attachment, look forward you reply.thank you.

Here is my DNS configration:

@               IN NS   tig.come.
tigmsgstore     IN A    192.168.55.219
tigmsgstore     IN A    192.168.55.217
tigsendtochatroom IN A    192.168.55.219
tigsendtochatroom IN A    192.168.55.217
logs.zip (345 KB) logs.zip

Added by hurry wang over 2 years ago

let me add:

I found an exception in log helpful,could you help me to analysis it :

2016-10-09 15:21:37.140 [eventbus tasks]   ThreadExceptionHandler.uncaughtException()  SEVERE: Uncaught thread: "eventbus tasks" exception
java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1463)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1461)
        at tigase.component.responses.ResponseManager.checkTimeouts(ResponseManager.java:65)
        at tigase.component.AbstractComponent.everyMinute(AbstractComponent.java:223)
        at tigase.server.AbstractMessageReceiver$3.run(AbstractMessageReceiver.java:1249)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
2016-10-09 15:21:53.968 [in_0-s2s]         S2SConnectionManager.processPacket()  WARNING: Missing 'to' attribute, ignoring packet...from=sess-man@tigmsgstore.tig.come, to=null, DATA=<iq type="get" from="ppp@tigsendtochatroom.tig.come/Spark" xmlns="jabber:client" to="" id="aG8H8-19"><query xmlns="jabber:iq:last"/></iq>, SIZE=141, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=AUTH, TYPE=get
 This most likely happens due to missconfiguration of components domain names.
2016-10-09 15:22:03.991 [in_0-s2s]         S2SConnectionManager.processPacket()  WARNING: Missing 'to' attribute, ignoring packet...from=sess-man@tigmsgstore.tig.come, to=null, DATA=<iq type="get" from="ppp@tigsendtochatroom.tig.come/Spark" xmlns="jabber:client" to="" id="aG8H8-21"><vCard xmlns="vcard-temp"><JABBERID/>
</vCard>
</iq>, SIZE=157, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=AUTH, TYPE=get

Added by Wojciech Kapcia TigaseTeam over 2 years ago

The exception is irrelevant in this case.

Bottomline - your DNS configuration is not exactly the best.

You should separate machine hostnames from the domains that you want serve. Currently it looks like you've configured both machines with the same hostname:

2016-10-08 12:31:16.718 [main]             DNSResolverDefault.<init>()        WARNING:  Resolving default host name: tigmsgstore.ttvlove.come took: 4

This causes a lot of problems (not only for Tigase but I'll focus on that):

  • Tigase uses machine hostname to identify machines and store information about all the cluster nodes in cluster_nodes table;

  • Tigase uses this hostnames to open cluster connections - if both machines have the same hostname than usually connection is open to the same node (but we prevent that and reject that connections);

  • Tigase calculates a password for each cluster nodes to make establishing cluster connection secure (only nodes with the passwords information can connect) - but your nodes override this information constantly because they use the same hostname!

What you should do:

  • correctly set distinct machine hostnames, for example node1.tigase.ttlove.com (192.168.55.219) and node2.tigase.ttlove.com (192.168.55.217);

  • configure domains (VHosts) to point to those machines (already done, but you could setup a CNAME entry, for example cluster.tigase.ttlove.com pointing to both machines and point particular domains only to the CNAME)

Added by hurry wang over 2 years ago

Thank you for your answer, but there's somewhere not clear for me ,if I use CNAME to point to both nodes ,and it produces two different jids(user1@node1,user2@node2) for users in the database?

If user1 and user2 could chat with each other?

Added by Wojciech Kapcia TigaseTeam about 2 years ago

No!

Please notice the distinction between domain/VHost and machine hostnames. You can server single domain (@domain1@) using multiple machines (@node1@, node2@, @node3@...). User is identified by @username@domain but it can connect to the server node1 or node2 or node3 and machine name to which user connects doesn't influence user JID (or domain that he is using).

Added by hurry wang about 2 years ago

Hi,

Thanks a lot, I finally figure out this problem , because I add user with out users' jid, and I configured DNS as you told me,and more clear about domain and hostname ,thank you.

    (1-9/9)