choks25
choks25

Reputation: 1

Apache Ignite: start both client and server nodes in the same JVM

Is it possible to start both client and server nodes in the same JVM?

Upvotes: 0

Views: 1121

Answers (1)

Valentin Kulichenko
Valentin Kulichenko

Reputation: 8390

Yes, you can start several nodes within one JVM. You only need to make sure that IgniteConfiguration.getGridName() property is unique for each node. Here is the example:

public static void main(String[] args) {
    Ignite server = startNode("server-node");
    Ignite client = startNode("client-node");

    ...
}

private static Ignite startNode(String name) {
    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setGridName(name);

    return Ignition.start(cfg);
}

Upvotes: 1

Related Questions