You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Yasser <ya...@gmail.com> on 2017/08/16 21:30:04 UTC

JDBC discovery adds 127.0.0.1 to tbl_addrss causing communication failure notices

I am using ignite 2.1. There are two nodes  with jdbc discovery.
I had the sys admins open a port 19080 for cluster communication and
configured the tcpdiscoveryapi to use it.
The problem I see is that the table tbl_addrs has three entries (for two
nodes). The third entry is 127.0.0.1. I think due to this entry, the logs
are filled with warnings of node communication failures.

I have another environment with 5 nodes - same codebase but using 47500
default port for cluster communication and it works fine without adding any
127.0.0.1 in the tbl_addrs table.

Why is 127.0.0.1 getting registered as a node? How do I avoid that?
Is opening one port good enough for cluster communication?


Here is the relevant log snippet: (the xx.xx.xx.xx are all internal IPs)

08-16-2017 00:03:01,862 WARNING [org.apache.ignite.internal.diagnostic]
(exchange-worker-#34%grid%) Failed to wait for partition map exchange
[topVer=AffinityTopologyVersion [topVer=558, minorTopVer=0],
node=11d12b4e-5ccc-41df-b29d-b6e005c01db6]. Dumping pending objects that
might be the cause:
08-16-2017 00:03:01,863 WARNING [org.apache.ignite.internal.diagnostic]
(exchange-worker-#34%grid%) Ready affinity version: AffinityTopologyVersion
[topVer=557, minorTopVer=0]
08-16-2017 00:03:01,863 WARNING [org.apache.ignite.internal.diagnostic]
(exchange-worker-#34%grid%) Last exchange future:
GridDhtPartitionsExchangeFuture [dummy=false, forcePreload=false,
reassign=false, discoEvt=DiscoveryEvent [evtNode=TcpDiscoveryNode
[id=b1208ea4-d7bb-498e-b061-c78437a7b402, addrs=[xx.xx.xx.xx, 127.0.0.1],
sockAddrs=[xxx.com/xx.xx.xx.xx:19080, /127.0.0.1:19080], discPort=19080,
order=558, intOrder=280, lastExchangeTime=1502855841588, loc=false,
ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false], topVer=558,
nodeId8=11d12b4e, msg=Node joined: TcpDiscoveryNode
[id=b1208ea4-d7bb-498e-b061-c78437a7b402, addrs=[xx.xx.xx.xx, 127.0.0.1],
sockAddrs=[xxx.com/xx.xx.xx.xx:19080, /127.0.0.1:19080], discPort=19080,
order=558, intOrder=280, lastExchangeTime=1502855841588, loc=false,
ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false], type=NODE_JOINED,
tstamp=1502855841791], crd=TcpDiscoveryNode
[id=11d12b4e-5ccc-41df-b29d-b6e005c01db6, addrs=[xx.xx.xx.xx, 127.0.0.1],
sockAddrs=[/127.0.0.1:19080, xxx.com/xx.xx.xx.xx:19080], discPort=19080,
order=1, intOrder=1, lastExchangeTime=1502856181580, loc=true,
ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false],
exchId=GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion
[topVer=558, minorTopVer=0], nodeId=b1208ea4, evt=NODE_JOINED], added=true,
initFut=GridFutureAdapter [ignoreInterrupts=false, state=DONE, res=true,
hash=975374880], init=true, lastVer=null, partReleaseFut=GridCompoundFuture
[rdc=null, initFlag=1, lsnrCalls=4, done=true, cancelled=false, err=null,
futs=[true, true, true, true]], exchActions=null, affChangeMsg=null,
skipPreload=false, clientOnlyExchange=false, initTs=1502855841791,
centralizedAff=false, changeGlobalStateE=null, forcedRebFut=null,
done=false, evtLatch=0, remaining=[b1208ea4-d7bb-498e-b061-c78437a7b402],
super=GridFutureAdapter [ignoreInterrupts=false, state=INIT, res=null,
hash=435336887]]
08-16-2017 00:03:01,863 WARNING
[org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager]
(exchange-worker-#34%grid%) First 10 pending exchange futures [total=0]
08-16-2017 00:03:01,863 WARNING [org.apache.ignite.internal.diagnostic]
(exchange-worker-#34%grid%) Last 10 exchange futures (total: 558):



@Configuration
public class GridConfiguration {

    private static final String DEFAULT_MEMORY_POLICY =
"default_memory_policy";
    //could have used a more generic name for cache and instance
    private static final String CACHE_NAME = "cache";
    private static final String GRID_INSTANCE_NAME = "grid";

    //disable backups because the cluster is anyways HA, even if one node
fails, the re-balancing feature
    //should take care of distributing fallen node data to other nodes.
Memory space is saved with no backups
    private static final int NUM_OF_BACKUPS = 0;

    //ignite uses 100 as default. scans for additional 100 ports before
givin up
    private static final int LISTEN_PORT_RANGE = 0;

    @Setter
    @Value("${grid.offheap.initsize}")
    private Long heapInitSize;

    @Setter
    @Value("${grid.metrics.print.frequency}")
    private Long metricsPrintFrequency;

    @Setter
    @Value("${grid.inter.cluster.comm.port}") //19080 is the port opened
    private Integer interClusterCommPort;

    @Setter
    @Value("${grid.datasource.jndi-name}")
    private String jndiName;

    @Autowired
    private DataLoader dataLoader;

    @Autowired
    private TcpDiscoverySpi tcpDiscoverySpi;

    /**
     * Spring bean creation on server startup creates an Apache ignite
instance as per configuration in
     * this method.
     *
     * @return Ignite instance
     */
    @Bean
    public Ignite igniteInstance() {
        CacheConfiguration<String, String> cacheConfiguration = new
CacheConfiguration<>();
        cacheConfiguration.setName(CACHE_NAME)
                .setAtomicityMode(CacheAtomicityMode.ATOMIC)
                .setBackups(NUM_OF_BACKUPS)
                .setCacheMode(CacheMode.PARTITIONED)
                // https://apacheignite.readme.io/docs/performance-tips
                //JCache standard requires cache providers to support
store-by-value semantics
                // which means that when you read a value from the cache,
you don't get the reference
                // to the object that is actually stored, but rather a copy
of this object.
                // Ignite behaves this way by default, but it's possible to
override this
                //behavior via the CacheConfiguration. copyOnRead
configuration property:
                .setCopyOnRead(false)
                .setMemoryPolicyName(DEFAULT_MEMORY_POLICY)
                .setStatisticsEnabled(true)
                .setWriteBehindEnabled(true)
                .setWriteThrough(true)
                .setReadThrough(true)
                .setCacheStoreFactory(FactoryBuilder.factoryOf(dataLoader));

        MemoryPolicyConfiguration memoryPolicyConfiguration = new
MemoryPolicyConfiguration()
                .setName(DEFAULT_MEMORY_POLICY)
                .setInitialSize(heapInitSize)
                //Randomly evicts pages in offheap when 80% RAM capacity is
reached
                .setPageEvictionMode(DataPageEvictionMode.RANDOM_2_LRU);

        MemoryConfiguration memCfg = new MemoryConfiguration()
                .setDefaultMemoryPolicyName(DEFAULT_MEMORY_POLICY)
                .setMemoryPolicies(memoryPolicyConfiguration);

        IgniteConfiguration cfg = new IgniteConfiguration();
        cfg.setIgniteInstanceName(GRID_INSTANCE_NAME)
                .setDiscoverySpi(tcpDiscoverySpi)
                .setCacheConfiguration(cacheConfiguration)
                .setMemoryConfiguration(memCfg)
                .setMetricsLogFrequency(metricsPrintFrequency);

        return Ignition.start(cfg);
    }

    /**
     * This is for server cluster node discovery using database backed
implementation
     * This must not be used in local profile
     *
     * @return discovery api
     */
    @Profile("!local")
    @Bean
    public TcpDiscoverySpi tcpDiscoverySpi() {
        return new TcpDiscoverySpi()
                .setLocalPort(interClusterCommPort)
                .setLocalPortRange(LISTEN_PORT_RANGE)
                .setIpFinder(new TcpDiscoveryJdbcIpFinder()
                        .setDataSource(dataSource())
                        .setShared(true));
    }

    /**
     * Return JNDI based datasource to use on app server deployments
     * Method marked for spring profiles not to be run in local
     *
     * @return datasource
     */
    @Profile("!local")
    @Bean(destroyMethod = "")
    public DataSource dataSource() {
        JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup();
        return dataSourceLookup.getDataSource(jndiName);
    }

    /**
     * The main cache that stores key value pairs
     *
     * @return ignite cache
     */
    @Bean
    public IgniteCache<String, String> grid() {
        return igniteInstance().cache(CACHE_NAME);
    }
}

Re: JDBC discovery adds 127.0.0.1 to tbl_addrss causing communication failure notices

Posted by vkulichenko <va...@gmail.com>.
Ignite binds to all available interfaces by default, and publishes all of
them as well to IP finder. Having localhost registered in IP finder is fine
and I highly doubt this is causing the warnings. Can you attach full logs?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/JDBC-discovery-adds-127-0-0-1-to-tbl-addrss-causing-communication-failure-notices-tp16240p16268.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.