Hi,
You can start Ignite in the same JVM as your application by using
Ignition.start() method. You can start multiple Ignite instances,
just create different IgniteConfiguration for them with different instance
names.
IgniteConfiguration serverConfig = new IgniteConfiguration()
.setIgniteInstanceName("my-server")
.setDiscoverySpi(new TcpDiscoverySpi()
.setIpFinder(
new TcpDiscoveryVmIpFinder()
.setAddresses(Collections.singleton("127.0.0.1:47500..47502"))
));
Ignite server = Ignition.start(serverConfig);
IgniteConfiguration clientConfig = new IgniteConfiguration()
.setIgniteInstanceName("my-client")
.setDiscoverySpi(new TcpDiscoverySpi()
.setIpFinder(
new TcpDiscoveryVmIpFinder()
.setAddresses(Collections.singleton("127.0.0.1:47500..47502"))
))
.setClientMode(true);
Ignite client = Ignition.start(clientConfig);
// ... client and server run together here ...
// don't forget to close ignite instances when your application
finishes, or JVM won't be able to exit
client.close();
server.close();
However, you generally shouldn't need two instances of ignite in the same
application. If you want your application to natively use Ignite and
have server running alongside it, you can just make API calls on the server
instance, no need to create an additional client for that.
Stan
From: Rajesh Kishore
Sent: 29 января 2018 г. 6:26
To: [email protected]
Subject: starting Ignite server in embedded mode
Hi All,
We have requirement to manage Ignite server and client by the same application
in embedded mode. Whats the way forward?
Thanks,
Rajesh