Tim Peierls
unread,Feb 16, 2011, 2:59:24 PM2/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Hazelcast
For those who are interested in running a Hazelcast cluster as part of
an Amazon Web Services Elastic Beanstalk application, I am happy to
report that I've had good preliminary results using a "blackboard"
approach with S3. As others have noted, AWS EC2 does not support
multicast, so you have to use TCP/IP. In Elastic Beanstalk, however,
you don't know the IP addresses of the participants in advance, and
there is no well-known "master" address that you can rely on, so there
needs to be a discovery phase. At application startup, before creating
the HazelcastInstance, I take the following steps:
1. Sign in, i.e., write this host's IP address as an object to a known
directory in S3 (specific to the application's environment).
2. Wait a little bit for any other potential cluster members being
started at roughly the same time to write their IP addresses.
3. Read all the IP addresses out of the S3 directory and use these
values in the Config object.
4. Use the Config object to create the HazelcastInstance.
5. Register a LifecycleListener with the LifecycleService associated
with the newly created HazelcastInstance.
The listener waits for a SHUTDOWN state and then signs out, i.e.,
removes its IP address from the S3 directory. I'm planning a
refinement that would add a timestamp to each address and periodic
refreshing of the sign in so that addresses that were not signed out
properly could be culled.
The IP addresses that are written are the EC2 "private" IP addresses,
which are afaict not routable outside of the EC2 zone, but are
routable within it.
This appears to work well, but I confess I've only tried it with up to
three members. My question is whether anyone sees any potential
pitfalls with this approach, and if so, how to get around them.
--tim