did anyone successfully bootstrapped a three-node ignite cluster on EMR without any issues? if so can someone help with step by step process how to resolve.
Thanks
Sri
I followed below blog which worked for me.
https://www.gridgain.com/docs/8.7.6/installation-guide/aws/manual-install-on-ec2
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration" >
<!-- other properties -->
<!-- Explicitly configure TCP discovery SPI to provide a list of nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>172.31.81.211</value>
<value>172.31.82.21</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
Related
I have a query re. the setup of the GridGain near cache, we have a single server node with the config as listed below and have a single thick client connecting successfully to it ~
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- PEER CLASS LOADING -->
<property name="peerClassLoadingEnabled" value="true"/>
<!-- CACHE CONFIG-->
<property name="cacheConfiguration">
<list>
<!-- ENTER CACHE TEMPLATE-->
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="cache1"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="rebalanceMode" value="SYNC"/>
<property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration">
<property name="nearEvictionPolicyFactory">
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicyFactory">
<property name="maxSize" value="100000"/>
</bean>
</property>
</bean>
</property>
</bean>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="cache2"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="rebalanceMode" value="SYNC"/>
<property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration">
<property name="nearEvictionPolicyFactory">
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicyFactory">
<property name="maxSize" value="100000"/>
</bean>
</property>
</bean>
</property>
</bean>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="cache3"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="rebalanceMode" value="SYNC"/>
<property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration">
<property name="nearEvictionPolicyFactory">
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicyFactory">
<property name="maxSize" value="100000"/>
</bean>
</property>
</bean>
</property>
</bean>
</list>
</property>
<!-- DISCOVERY-->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder">
<property name="namespace" value="gridgain"/>
<property name="serviceName" value="gridgain-service"/>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
In setting the server up like this it was my understanding that as per the documentation here , that "Once configured in this way, the near cache is created on any node that requests data from the underlying cache, including both server nodes and client nodes. When you get an instance of the cache, as shown in the following example, the data requests go through the near cache.
IgniteCache<Integer, Integer> cache = ignite.cache("myCache");
int value = cache.get(1);
Based on this I do not believe that I have any need to create the near cache config on our client? and have just implemented code as ~
IgniteCache<Object, Object> cache = ignite.cache(ourCacheName);
The issue I see is that when I peek at the local cache to try and find values in there, after searching for them ~
cache_.localPeek(key, CachePeekMode.NEAR)
The objects are not found, despite being searched for several times, and it looks like they are not added to our near cache setup, everything just refers to the underlying cache. Previously we had programmatically created the Near cache on the client and it had worked, but we would like to config the solution on the server if possible. Our client node is just using default config, if this makes a difference.
Any thoughts why we are not seeing a near cache?
Thanks,
LS
In order to use the cache I suggest you create the near cache explicitly using the following syntax:
IgniteCache<Integer, Integer> clientCache = client.getOrCreateNearCache(cacheCfg.getName(), nearCfg);
...
clientCache.get(1);
System.out.println(clientCache.localPeek(1, CachePeekMode.NEAR));
There are some tickets like IGNITE-15960 or IGNITE-1163 with discussions about the API improvements. I suppose the cache has to be declared on the servers first and then you would be able to create it explicitly on the clients. Agree, the docs and API are super confusing and have to be reworked.
Also, the near cache is local to a node, i.e. you might have them for some clients/servers and do not want to create it for other ones.
I want to enable persistence in ignite so that when ignite docker container is restarted or replaced with new version cache data is not lost.
I am using ignite 2.6.0. Here is the configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true" />
</bean>
</property>
<property name="storagePath" value="/opt/ignite/apache-ignite-fabric/data/persistence" />
<property name="walPath" value="/opt/ignite/apache-ignite-fabric/data/wal" />
<property name="walArchivePath" value="/opt/ignite/apache-ignite-fabric/data/wal/archive" />
</bean>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<value>127.0.0.1:47500..47502</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
I ran following command to deploy ignite docker container
sudo docker run -d -e "CONFIG_URI=" -e "OPTION_LIBS=ignite-core,ignite-spring,ignite-indexing,ignite-rest-http" -v /var/ignitedata:/opt/ignite/apache-ignite-fabric/data -p 9005:8080 --name=apacheignite apacheignite/ignite:2.6.0
I did not pass any value to CONFIG_URI is because i replace the default-config.xml file in the docker container.
I created a new cache using ignite rest api
http://localhost:9005/ignite?cmd=getorcreate&cacheName=myCache
Added sample values to cache
http://localhost:9005/ignite?cmd=put&key=10&val=2018-01-01&cacheName=myCache&keyType=int&valueType=date
I can retrieve the cache value
http://172.30.5.28:9005/ignite?cmd=get&key=10&cacheName=myCache&keyType=int&valueType=date
Now if i restart the docker container and try retrieving value, it does not return value
http://localhost:9005/ignite?cmd=get&key=10&cacheName=myCache&keyType=int&valueType=date
Has anyone seen this issue?
Thanks,
Rahul
Did you activate the cluster after you started it? When you use persistence, you need to tell Ignite how many nodes it should expect to see (called the "baseline").
You do that by running the control.sh script:
./control.sh --activate
You have to make sure that docker container still has same storage mounted, and also set consistentId to same value in configuration.
If you do that, cluster will auto-activate once all nodes have joined. You only have to activate it manually once.
Thank you Andrei Aleksandrov for pointing me to correct direction. I added working directory path and that helped in resolving the issue.
Posting the updated default-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Enabling Apache Ignite Persistent Store. -->
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true" />
</bean>
</property>
</bean>
</property>
<property name="workDirectory" value="/opt/ignite/apache-ignite-fabric/data" />
<!-- Explicitly configure TCP discovery SPI to provide a list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
<value>127.0.0.1:47500..47502</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
I want to setup Ignite cluster on 3 nodes on different IPs. I am following the official guideand using this configuration. I have listed the node IPs in multicastGroup property - unfortunately this does not work, throwing following exception
[09:08:40,852][SEVERE][main][TcpDiscoverySpi] Failed to register local node address in IP finder on start (retrying every 2000 ms; change 'reconnectDelay' to configure the frequency of retries).
class org.apache.ignite.spi.IgniteSpiException: Unknown multicast group: 10.10.17.1,10.10.17.2,10.10.17.3
This is my configuration file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--
Alter configuration below as needed.
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="multicastGroup" value="10.10.17.1,10.10.17.2,10.10.17.3"/>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
How to setup correctly?
You've configured node IPs in the wrong place. Please configure them as follow:
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
<value>10.10.17.1:47500..47509</value>
<value>10.10.17.2:47500..47509</value>
<value>10.10.17.3:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
We are using the above configuration. Unfortunately always the node mentioned on top ( here 10.10.17.1:47500..47509) is getting discovered but the other two nodes remain undiscovered.
Sample project showing issue
What I'm noticing is that session.removeAttribute doesn't really remove the attribute, it only sets the value to null.
I'm not sure if this is a setup issue on my end or what.
I thought this might be related to jsf, removed jsf and the issue persists.
Really want to use ignite but am struggling to get this working correctly.
Any input would be helpful, has anyone else seen this?
Thanks in advance, could use some help! If anyone has any idea's please let me know and thank you.
dshaw
The closest issue that I could find to my particular issue was:
https://github.com/apache/ignite/pull/2243
I patched my local ignite repo with #2243 , redeployed to tomcat and 2
ignite nodes but am seeing the same issue.
My setup (client/server):
Ignite 2.5.0 (2 node cluster)
Apache Tomcat 7
Java 9
tomcat 7 setenv.sh
#!/bin/sh
export JAVA_HOME=/opt/java/jdk-10.0.1
export PATH=$JAVA_HOME/bin:$PATH
export CATALINA_OPTS="--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
--add-exports java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED
--add-exports jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED
--add-modules java.xml.bind"
export CATALINA_HOME=/opt/apache/apache-tomcat-7.0.86_node
Config use by 3 tomcat nodes
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!--
Alter configuration below as needed.
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="clientMode" value="true"/>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>172.24.2.156:47500..47509</value>
<value>172.24.3.28:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
tomcat web.xml snip
<listener>
<listener-class>org.apache.ignite.startup.servlet.ServletContextListenerStartup</listener-class>
</listener>
<filter>
<filter-name>IgniteWebSessionsFilter</filter-name>
<filter-class>org.apache.ignite.cache.websession.WebSessionFilter</filter-class>
</filter>
<!-- You can also specify a custom URL pattern. -->
<filter-mapping>
<filter-name>IgniteWebSessionsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Specify Ignite configuration (relative to META-INF folder or Ignite_HOME). -->
<context-param>
<param-name>IgniteConfigurationFilePath</param-name>
<param-value>config/client-config.xml</param-value>
</context-param>
<!-- Specify the name of Ignite cache for web sessions. -->
<context-param>
<param-name>IgniteWebSessionsCacheName</param-name>
<param-value>medata-replicated</param-value>
</context-param>
Config used by 2 ignite nodes
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!--
Alter configuration below as needed.
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Enable cache events. -->
<property name="includeEventTypes">
<util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
</property>
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Cache name. -->
<property name="name" value="medata-replicated"/>
<!-- Cache mode. -->
<property name="cacheMode" value="REPLICATED"/>
</bean>
</list>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>172.24.2.156:47500..47509</value>
<value>172.24.3.28:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
This issue is also discussed on Apache Ignite user forum: http://apache-ignite-users.70518.x6.nabble.com/Session-removeAttribute-is-not-working-as-expected-td21762.html
I have an ignite server running in replicated mode and many clients on same node which has near cache enabled. Now I don't find a significant performance difference when I run client with near cache and without near cache.
My understanding of near cache is that frequently used key and value would be stored on client itself, so there won't be an actual Get() call made to server. please correct me if I am wrong.
Can someone share a working near cache configuration xml.
SERVER CONFIG:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="cacheMode" value="LOCAL" />
<!-- Enable near cache to cache recently accessed data. -->
<!-- <property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration"/>
</property> -->
<property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration">
</bean>
</property>
</bean>
</property>
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<!--
Ignite provides several options for automatic discovery that can be used
instead os static IP based discovery.
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> -->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
<!-- <value>127.0.0.1:48550..48551</value> -->
<value>XXX.ZZZ.yyy.36:47500..47501</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
CLIENT CONFIG:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="cacheMode" value="LOCAL" />
<!-- Enable near cache to cache recently accessed data. -->
<!-- <property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration"/>
</property> -->
<property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration">
</bean>
</property>
</bean>
</property>
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<!--
Ignite provides several options for automatic discovery that can be used
instead os static IP based discovery.
-->
<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> -->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<!-- In distributed environment, replace with actual host IP address. -->
<!-- <value>127.0.0.1:48550..48551</value> -->
<value>XXX.ZZZ.yyy.38:47500..47501</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
Yes, near cache improves performance by caching often used entries on node locally, but it doesn't make sense if you run all tests on single machine or JVM. Near cache allows not to go on remote node for data, but in your test everything already works locally.
Also Near cache have no sense for server nodes on REPLICATED or PARTITIONED cache, where number of backups equals or bigger than number of data nodes, because all data set already available for each node locally.
So to get performance boost you need to configure client node to use Near cache, when server nodes work on remote machines. Do not forget to warm up near cache before measuring.
Here is XML snippet for setting Near cache:
...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Your other cache config -->
<property name="nearConfiguration">
<bean class="org.apache.ignite.configuration.NearCacheConfiguration"/>
</property>
</bean>
...