Hi Maureen, Client and server nodes found each other and created a cluster, so it can't be possible that there're two caches in the same cluster with the same name.
On client node you can check ignite.cacheNames() before cache = ignite.getOrCreateCache(cfg); call. To make sure that IMAGE_CACHE is already exist and visible by client. Thanks, Mikhail. On Tue, Jul 18, 2017 at 7:27 PM, Maureen Lawless <[email protected]> wrote: > Hi, > > I am trying to use apache ignite cache for the first time. I have 2 java > spring boot applications, the first one is configured as an ignite server: > > Snippet from ignite-config-dev.xml: > > <property name="clientMode" value="false"/> > > And it is creating a cache on start -up: > > public void initCache() { > Ignite ignite = Ignition.start(igniteConfigura > tion.getIgniteConfigurationFilename()); > CacheConfiguration cfg = new CacheConfiguration("IMAGE_CACHE"); > cache = ignite.getOrCreateCache(cfg); > } > > The application also inserts some objects into the cache which i would > like to read from the second application. > > The second java application is started as an ignite client: > > Snippet from ignite-config-dev.xml: > > <property name="clientMode" value="true"/> > > And it trys to get the cache created by the server: > > Ignite ignite = Ignition.start(igniteConfigura > tion.getIgniteConfigurationFilename()); > > CacheConfiguration cfg = new CacheConfiguration("IMAGE_CACHE"); > cache = ignite.getOrCreateCache(cfg); > > However, it looks like the call to getOrCreateCache in the client is > creating a new cache rather than accessing the one created by the server. > > When the server starts up i see the following in the logs: > > ================================================ > > >> +----------------------------------------------------------- > -----------+ > > >>> Ignite ver. 2.0.0#20170430-sha1:d4eef3c68f > f116ee34bc13648cd82c640b3ea072 > > >>> +----------------------------------------------------------- > -----------+ > > >>> OS name: Linux 3.10.0-514.26.2.el7.x86_64 amd64 > > >>> CPU(s): 1 > > >>> Heap: 0.48GB > > >>> VM name: [email protected] > > >>> Local node [ID=7C898CEA-E4EE-430F-9468-3DF185AC4D75, order=1, > clientMode=false] > > >>> Local node addresses: [m.lawlessvm/0:0:0:0:0:0:0:1%lo, m.lawlessvm/ > 10.0.2.15, /127.0.0.1, /192.168.122.1] > > >>> Local ports: TCP:11211 TCP:47100 TCP:47500 > > > [15:44:52] Topology snapshot [ver=1, *servers=1, clients=0*, CPUs=1, > heap=0.48GB] > > 2017-07-18 15:44:52.577 INFO 28522 --- [ main] > o.a.i.i.m.d.GridDiscoveryManager : Topology snapshot [ver=1, > servers=1, clients=0, CPUs=1, heap=0.48GB] > > *2017-07-18 15:44:52.664 INFO 28522 --- [orker-#26%null%] > o.a.i.i.p.cache.GridCacheProcessor : Started cache [name=IMAGE_CACHE, > memoryPolicyName=null, mode=PARTITIONED]* > > > 2017-07-18 15:45:52.587 INFO 28522 --- [orker-#15%null%] > org.apache.ignite.internal.IgniteKernal : > > Metrics for local node (to disable set 'metricsLogFrequency' to 0) > > ^-- Node [id=7c898cea, name=null, uptime=00:01:00:016] > > ^*-- H/N/C [hosts=1, nodes=1, CPUs=1]* > > ^-- CPU [cur=6.67%, avg=11.9%, GC=0%] > > ^-- PageMemory [pages=4300] > > ^-- Heap [used=96MB, free=80.49%, comm=247MB] > > ^-- Non heap [used=98MB, free=-1%, comm=100MB] > > ^-- Public thread pool [active=0, idle=0, qSize=0] > > ^-- System thread pool [active=0, idle=8, qSize=0] > > ^-- Outbound messages queue [size=0] > > *Once the client node starts i see the following in the server log:* > > 2017-07-18 15:49:01.851 INFO 28522 --- [omm-0-#17%null%] > o.a.i.s.c.tcp.TcpCommunicationSpi :* Accepted incoming > communication connection [locAddr=/0:0:0:0:0:0:0:1:47100, > rmtAddr=/0:0:0:0:0:0:0:1:42962]* > > 2017-07-18 15:49:52.600 INFO 28522 --- [orker-#15%null%] > org.apache.ignite.internal.IgniteKernal : > > Metrics for local node (to disable set 'metricsLogFrequency' to 0) > > ^-- Node [id=7c898cea, name=null, uptime=00:05:00:034] > > ^--* H/N/C [hosts=1, nodes=2, CPUs=1]* > > ^-- CPU [cur=0.67%, avg=3.21%, GC=0%] > > ^-- PageMemory [pages=4300] > > ^-- Heap [used=119MB, free=75.91%, comm=247MB] > > ^-- Non heap [used=99MB, free=-1%, comm=101MB] > > ^-- Public thread pool [active=0, idle=0, qSize=0] > > ^-- System thread pool [active=1, idle=6, qSize=0] > > ^-- Outbound messages queue [size=0] > > > *When the client starts up i see the following in the logs:* > > > >>> +----------------------------------------------------------- > -----------+ > > >>> Ignite ver. 2.0.0#20170430-sha1:d4eef3c68f > f116ee34bc13648cd82c640b3ea072 > > >>> +----------------------------------------------------------- > -----------+ > > >>> OS name: Linux 3.10.0-514.26.2.el7.x86_64 amd64 > > >>> CPU(s): 1 > > >>> Heap: 0.5GB > > >>> VM name: [email protected] > > >>> Local node [ID=6BAAA95E-D0E1-42C7-A3C6-74ABEB6E29D1, order=2, > * clientMode=true*] > > >>> Local node addresses: [m.lawlessvm/0:0:0:0:0:0:0:1%lo, m.lawlessvm/ > 10.0.2.15, /127.0.0.1, /192.168.122.1] > > >>> Local ports: TCP:47101 > > > [15:49:03] *Topology snapshot [ver=2, servers=1, clients=1, CPUs=1, > heap=0.98GB]* > > 2017-07-18 15:49:03.000 INFO 28694 --- [ main] > o.a.i.i.m.d.GridDiscoveryManager : Topology snapshot [ver=2, > servers=1, clients=1, CPUs=1, heap=0.98GB] > > 2017-07-18 15:49:55.976 INFO 28694 --- [-notifier-timer] > o.a.i.i.p.cluster.GridUpdateNotifier : Update status is not available. > > 2017-07-18 15:50:02.930 INFO 28694 --- [orker-#15%null%] > org.apache.ignite.internal.IgniteKernal : > > Metrics for local node (to disable set 'metricsLogFrequency' to 0) > > ^-- Node [id=6baaa95e, name=null, uptime=00:01:00:043] > > ^-- *H/N/C [hosts=1, nodes=2, CPUs=1]* > > ^-- CPU [cur=0.33%, avg=6.45%, GC=0%] > > ^-- PageMemory [pages=0] > > ^-- Heap [used=122MB, free=75.29%, comm=494MB] > > ^-- Non heap [used=65MB, free=-1%, comm=66MB] > > ^-- Public thread pool [active=0, idle=0, qSize=0] > > ^-- System thread pool [active=0, idle=1, qSize=0] > > ^-- Outbound messages queue [size=0] > > *2017-07-18 15:52:24.303 INFO 28694 --- [orker-#24%null%] > o.a.i.i.p.cache.GridCacheProcessor : Started cache [name=IMAGE_CACHE, > memoryPolicyName=null, mode=PARTITIONED]* > > 2017-07-18 15:53:02.950 INFO 28694 --- [orker-#15%null%] > org.apache.ignite.internal.IgniteKernal : > > Metrics for local node (to disable set 'metricsLogFrequency' to 0) > > > From looking at the logs (and from using a debugger during client start > up) it seems to me that the client has discovered the server but is > creating a new cache and not seeing the one created by the server. > > Any suggestions on where i might be going wrong with my configuration? > > Thanks, > Maureen > -- Thanks, Mikhail.
