You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Rajesh Kishore <ra...@gmail.com> on 2018/01/29 03:26:01 UTC

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

Re: starting Ignite server in embedded mode

Posted by Rajesh Kishore <ra...@gmail.com>.
Thanks it perfectly answers my query

Thanks,
Rajesh

On Mon, Jan 29, 2018 at 3:31 PM, Stanislav Lukyanov <st...@gmail.com>
wrote:

> 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 <ra...@gmail.com>
> *Sent: *29 января 2018 г. 6:26
> *To: *user@ignite.apache.org
> *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
>
>
>

RE: starting Ignite server in embedded mode

Posted by Stanislav Lukyanov <st...@gmail.com>.
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: user@ignite.apache.org
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