Hello You start a client node, do you start a server node too?
Cheers Gianluca On Mon, 15 May 2023 at 13:26, Krishna.Mulumudi.ril.com via user < user@ignite.apache.org> wrote: > It’s persisting data after reboot and able to retrieve inserted records > from cache. Only problem is, cache.size getting reset to zero after first > restart of the cluster. > > > > Please find output of requested commands and code snippet for getting > cache.size . > > ############################################ > > > > [tibusr@******~]$ df > > Filesystem 1K-blocks Used Available Use% Mounted on > > devtmpfs 7812268 0 7812268 0% /dev > > tmpfs 7823392 4 7823388 1% /dev/shm > > tmpfs 7823392 795764 7027628 11% /run > > tmpfs 7823392 0 7823392 0% /sys/fs/cgroup > > /dev/mapper/vg_os-lv_root 103080888 47604952 50216672 49% / > > /dev/sda2 999320 106456 824052 12% /boot > > /dev/mapper/vg_os-lv_app 103080888 22497672 75323952 23% /app > > tmpfs 1564680 0 1564680 0% /run/user/1002 > > tmpfs 1564680 0 1564680 0% /run/user/7071 > > [tibusr@****** ~]$ lsattr /app > > -------------e-- /app/snapshots1 > > -------------e-- /app/datastore1 > > -------------e-- /app/logs > > [tibusr@******~]$ lsattr /app/datastore1 > > -------------e-- /app/datastore1/archive > > -------------e-- /app/datastore1/data > > -------------e-- /app/datastore1/wal > > -------------e-- /app/datastore1/metadataWorkDir > > [tibusr@******~]$ > > > > ###################################### JAVA CODE Snippet to get cache size > ######################################## > > > > /** > > * > > */ > > package com.jio.digitalapi.edif.util.operations; > > > > import java.util.Arrays; > > import java.util.Properties; > > import java.util.UUID; > > > > import org.apache.ignite.Ignite; > > import org.apache.ignite.IgniteCache; > > import org.apache.ignite.Ignition; > > import org.apache.ignite.cache.CachePeekMode; > > import org.apache.ignite.configuration.BinaryConfiguration; > > import org.apache.ignite.configuration.IgniteConfiguration; > > import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; > > import > org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; > > > > > > import com.jio.digitalapi.jtl.edif.model.JtlCustomer; > > > > import javax.swing.*; > > > > /** > > * @author Gangaiah Gundeboina > > * > > */ > > public class CacheSizes { > > > > public static <K, V> void main(String[] args) { > > > > String igniteNodeIpAddress = "IPADDRESS"; > > > > String igniteInstanceName = null; > > try { > > String[] ipAddrArray = > igniteNodeIpAddress.split(",", -1); > > > System.setProperty("java.net.preferIPv4Stack", "true"); > > IgniteConfiguration cfg = new > IgniteConfiguration(); > > > cfg.setPeerClassLoadingEnabled(true); > > cfg.setClientMode(true); > > String random = > (UUID.randomUUID().getMostSignificantBits() + "").toString().replace("-", > ""); > > String igniteFullInstaneName = > igniteInstanceName + random; > > > cfg.setIgniteInstanceName(igniteFullInstaneName); > > cfg.setDiscoverySpi((new > TcpDiscoverySpi().setJoinTimeout(2400000) > > > .setIpFinder((new > TcpDiscoveryVmIpFinder()).setAddresses(Arrays.asList(ipAddrArray))))); > > Ignite ignite = > Ignition.start(cfg); > > IgniteCache<String, > JtlCustomer> cache = > ignite.cache("JtlCustomerCache"); > > > System.out.println("PRIMARY:"+Integer.valueOf(cache.size(new > CachePeekMode[]{CachePeekMode.PRIMARY})).toString()); > > > } catch (Exception e) { > > e.printStackTrace(); > > System.exit(0); > > } > > System.exit(0); > > > > } > > > > } > > ############################################################## > > > > > "*Confidentiality Warning*: This message and any attachments are intended > only for the use of the intended recipient(s), are confidential and may be > privileged. If you are not the intended recipient, you are hereby notified > that any review, re-transmission, conversion to hard copy, copying, > circulation or other use of this message and any attachments is strictly > prohibited. If you are not the intended recipient, please notify the sender > immediately by return email and delete this message and any attachments > from your system. > > *Virus Warning:* Although the company has taken reasonable precautions to > ensure no viruses are present in this email. The company cannot accept > responsibility for any loss or damage arising from the use of this email or > attachment." >