Q:

Hazelcast as a Linux Service

I have configured Hazelcast in my application and deployed it in glassfish, and tested it with ome simple methods in a REST service.
Now I want to install it in my servers as a Linux Service, to start running when the servers start, and I want to my glassfish application to be able to recognize this service and read or set variables in my map, using distributed lock.
How can I achieve this?

A:

You can create an init.d script to start Hazelcast node and use HazelcastClient in your application to connect to Hazelcast node.
Look at an answer to a similar question:
Hazelcast dedicated nodes
And blog post about starting standalone nodes;
Hazelcast: Starting standalone Hazelcast nodes
To connect Hazelcast node using HazelcastClient in your app deployed to Glassfish;
ClientConfig config = new ClientConfig();
config.getNetworkConfig().addAddress("localhost");
HazelcastInstance client = HazelcastClient.newHazelcastClient(config);
Map map = client.getMap("map");

