You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Piubelli, Manuel " <ma...@citi.com> on 2016/08/16 10:14:31 UTC

Local mode recommended setup

Hi All,

I am trying to setup a cluster in Local Mode: all my data fits in RAM and operations are read only , data is loaded from a cache or disk at startup. I have a very simple question:

How can I configure some code to be run at startup of every node? When defining an own start class the ignite node expectedly stops after loading the cache? Is there any stayAlive() method or similar I can execute on the ignite or cluster object?

Sample Code:

public static void main(String[] args) throws URISyntaxException, IOException {
              Ignition.setClientMode(false);

              try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
                     IgniteCache<String, FullOrd> cache = FullOrdCacheLoader.getCacherLoader().loadAndGetCache();
                     // load complete, now stay alive to receive client requests
              }
}

Much appreciated,
Manuel

RE: Local mode recommended setup

Posted by "Piubelli, Manuel " <ma...@citi.com>.
Perfect, that answers my question, thank you Vladislav.

From: Vladislav Pyatkov [mailto:vldpyatkov@gmail.com]
Sent: 16 August 2016 11:49
To: user@ignite.apache.org
Subject: Re: Local mode recommended setup

Hello,

If I understand correctly, you want to create node which works until it will by cancelation by system (for eample by kill comand).
If yes, you need do not invoke ignite.close() (explisitly or in try{} block):

public static void main(String[] args) throws URISyntaxException, IOException {
              Ignition.setClientMode(false);

              Ignite ignite = Ignition.start("examples/config/example-ignite.xml");

              IgniteCache<String, FullOrd> cache = FullOrdCacheLoader.getCacherLoader().loadAndGetCache();
}

On Tue, Aug 16, 2016 at 1:14 PM, Piubelli, Manuel <ma...@citi.com>> wrote:
Hi All,

I am trying to setup a cluster in Local Mode: all my data fits in RAM and operations are read only , data is loaded from a cache or disk at startup. I have a very simple question:

How can I configure some code to be run at startup of every node? When defining an own start class the ignite node expectedly stops after loading the cache? Is there any stayAlive() method or similar I can execute on the ignite or cluster object?

Sample Code:

public static void main(String[] args) throws URISyntaxException, IOException {
              Ignition.setClientMode(false);

              try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
                     IgniteCache<String, FullOrd> cache = FullOrdCacheLoader.getCacherLoader().loadAndGetCache();
                     // load complete, now stay alive to receive client requests
              }
}

Much appreciated,
Manuel



--
Vladislav Pyatkov

Re: Local mode recommended setup

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hello,

If I understand correctly, you want to create node which works until it
will by cancelation by system (for eample by kill comand).
If yes, you need do not invoke ignite.close() (explisitly or in try{}
block):

public static void main(String[] args) throws URISyntaxException,
IOException {
              Ignition.setClientMode(false);

              Ignite ignite =
Ignition.start("examples/config/example-ignite.xml");

              IgniteCache<String, FullOrd> cache =
FullOrdCacheLoader.getCacherLoader().loadAndGetCache();
}

On Tue, Aug 16, 2016 at 1:14 PM, Piubelli, Manuel <ma...@citi.com>
wrote:

> Hi All,
>
>
>
> I am trying to setup a cluster in Local Mode: all my data fits in RAM and
> operations are read only , data is loaded from a cache or disk at startup.
> I have a very simple question:
>
>
>
> How can I configure some code to be run at startup of every node? When
> defining an own start class the ignite node expectedly stops after loading
> the cache? Is there any stayAlive() method or similar I can execute on the
> ignite or cluster object?
>
>
>
> Sample Code:
>
>
>
> *public* *static* *void* *main*(*String*[] args) *throws*
> *URISyntaxException*, *IOException* {
>
>               *Ignition*.*setClientMode*(*false*);
>
>
>
>               *try* (Ignite *ignite* = *Ignition*.*start*("examples/config/example-ignite.xml"))
> {
>
>                      IgniteCache<String, FullOrd> *cache* =
> *FullOrdCacheLoader*.*getCacherLoader*().loadAndGetCache();
>
>                      // load complete, now stay alive to receive client
> requests
>
>               }
>
> }
>
>
>
> Much appreciated,
>
> Manuel
>



-- 
Vladislav Pyatkov