mp911de / spinach

Scalable Java Disque client
Apache License 2.0
34 stars 4 forks source link

Reconnect sticks to the last known connection point and does not use additional connection points #7

Closed pulse00 closed 9 years ago

pulse00 commented 9 years ago

Is it possible to connect to more than one node? We'd like to run a cluster of disque nodes, and currently it looks like we can only pass a single URI to the DisqueClient.

mp911de commented 9 years ago

You can pass multiple connection points encapsulated within the DisqueURI. There is only one connection at a time, the hosts are used as HA failover hosts. If a connection goes down, another host is used for reconnect. I'm open for discussion how to balance load amongst different hosts from the client perspective. Use the scheme disque://[password@]host[:port][,host2[:port2]][,hostN[:port2N]] to specify multiple hosts.

Robert Gründler notifications@github.com schrieb am Fr., 21. Aug. 2015 um 13:30:

Is it possible to connect to more than one node? We'd like to run a cluster of disque nodes, and currently it looks like we can only pass a single URI to the DisqueClient.

— Reply to this email directly or view it on GitHub https://github.com/mp911de/spinach/issues/7.

pulse00 commented 9 years ago

Alright, we'll give that a try. Thanks a lot for the fast response.

pulse00 commented 9 years ago

I've tried the following setup:

When start the application, the client seems to connect to the first node running on 7711. Now when i stop that node, i'm seeing this in the logs:

2015-08-21 16:18:09.239 DEBUG c.l.redis.protocol.ConnectionWatchdog    : Reconnecting, last destination was /192.168.205.10:7711
2015-08-21 16:18:09.239 DEBUG c.l.redis.protocol.ConnectionWatchdog    : Cannot connect: java.net.ConnectException: Connection refused: /192.168.205.10:7711 
2015-08-21 16:18:09.239 DEBUG c.l.redis.protocol.ConnectionWatchdog    : scheduleReconnect()  

The client seems to try to reconnect to the same node over and over, without ever trying the 2nd node. Is there anything we might configure additionally to the disque uri?

mp911de commented 9 years ago

You've done everything right. I'll label the issue as bug then.

Robert Gründler notifications@github.com schrieb am Fr., 21. Aug. 2015 um 16:23:

I've tried the following setup:

  • 2 Nodes running in a vagrant box on different ports
  • The client has been setup with the URI disque://192.168.205.10:7711, 192.168.205.10:7712
  • The 2 nodes run clustered (disque -p 7711 cluster meet 127.0.0.1 7712 )

When start the application, the client seems to connect to the first node running on 7711. Now when i stop that node, i'm seeing this in the logs:

2015-08-21 16:18:09.239 DEBUG c.l.redis.protocol.ConnectionWatchdog : Reconnecting, last destination was /192.168.205.10:7711 2015-08-21 16:18:09.239 DEBUG c.l.redis.protocol.ConnectionWatchdog : Cannot connect: java.net.ConnectException: Connection refused: /192.168.205.10:7711 2015-08-21 16:18:09.239 DEBUG c.l.redis.protocol.ConnectionWatchdog : scheduleReconnect()

The client seems to try to reconnect to the same node over and over, without ever trying the 2nd node. Is there anything we might configure additionally to the disque uri?

— Reply to this email directly or view it on GitHub https://github.com/mp911de/spinach/issues/7#issuecomment-133441147.

pulse00 commented 9 years ago

Thanks. Let me know if i can provide more details to help debugging.

mp911de commented 9 years ago

Fixed, uploaded spinach-0.2-SNAPSHOT to https://oss.sonatype.org/content/repositories/snapshots/. Please retest.

pulse00 commented 9 years ago

Great, that fixed it. Failover works now, thanks a lot!

pulse00 commented 9 years ago

Is there another release planned in the near future, or should we stick to the SNAPSHOT repo?

mp911de commented 9 years ago

It depends on how you define near future. I need to implement https://github.com/mp911de/spinach/issues/5 to publish a 0.2 release. I'm targeting Sep 7 for releasing 0.2 unless some blocker bugs cross the way. Feedback appreciated.

pulse00 commented 9 years ago

Great, thanks for the info.

pulse00 commented 9 years ago

Would creating a minor release be much of a hassle for you? We're working on an apache-camel component which uses spinach, and it would be great to have failover support.

Another question: Would you accept a PR implementing JMX support for spinach?

mp911de commented 9 years ago

Ok, I'll release a 0.1.1 later this day.

What do you want to expose by JMX? I'm thinking a while about a statistics publisher to expose latencies and so forth. You can catch me on IRC (freenode) or Gitter (https://gitter.im/mp911de/lettuce) for a chat

mp911de commented 9 years ago

@pulse00 Just released https://github.com/mp911de/spinach/releases/tag/0.1.1 Should be available on mvn central in a couple of hours

pulse00 commented 9 years ago

Superb, thanks!