user1221
user1221

Reputation: 11

Connect Hazelcast Mancenter to externally Hazelcast server by using jar instead of setting hazelcast server config

I started hazelcast server using

java  -jar hazelcast-3.10.1/lib/hazelcast-3.10.1.jar

which started server on

   Members {size:1, ver:1} [
    Member [127.0.0.1]:5701 - f7cf5a82-c89c-4341-8e72-0f446df422ad this
]

after that I started mancenter as below

java -jar hazelcast-management-center-3.10.1/mancenter-3.10.1.war 8080 mancenter

then I tried to connect my spring boot application to mancenter as below

@Bean
    public Config mancenterConfig() {
        Config cfg = new Config();
        cfg.getManagementCenterConfig().setEnabled(true).setUrl("http://localhost:8080/mancenter");
        return cfg;
    }

But it does not connect to already started server, it starts a new hazelcast server on port 5702 as below

Members {size:1, ver:1} [
    Member [127.0.0.1]:5702 - f7cf5a82-c89c-4341-8e72-0f446df422ad this
]

How can I connect mancenter to already started hazelcast server on port 5701 instead of starting a new hazelcast server on port 5702?

Upvotes: 0

Views: 979

Answers (2)

Scott M
Scott M

Reputation: 84

As Neil said, the cluster members initiate the connection back to the Management Center and the Management Center URL needs to be set in the members before they start. Reasons for this design are both performance and security related.

If you really need to have the Man Center url dynamic though, you can usually achieve this through network setup. On a small scale, you can simply use the host file on the member machines to map the configured name to an IP or DNS name. If the members can't connect to Management Center at start up, they will continue to try at intervals, so a change in the host file will eventually be picked up. On a larger scale, you might make changes in your DNS system to point the members to the proper address.

Upvotes: 0

Neil Stevenson
Neil Stevenson

Reputation: 3150

You can't, the connection is initiated from the Hazelcast Server to the Hazelcast Management Center, so the server has to have the management server URL enabled when it starts.

See http://docs.hazelcast.org/docs/management-center/3.10.2/manual/html/index.html#change-url

Upvotes: 2

Related Questions