Apache Ignite Documentation

GridGain Developer Hub - Apache Ignitetm

Welcome to the Apache Ignite developer hub run by GridGain. Here you'll find comprehensive guides and documentation to help you start working with Apache Ignite as quickly as possible, as well as support if you get stuck.

 

GridGain also provides Community Edition which is a distribution of Apache Ignite made available by GridGain. It is the fastest and easiest way to get started with Apache Ignite. The Community Edition is generally more stable than the Apache Ignite release available from the Apache Ignite website and may contain extra bug fixes and features that have not made it yet into the release on the Apache website.

 

Let's jump right in!

 

Documentation     Ask a Question     Download

 

Javadoc     Scaladoc     Examples

Redis

Connect to Ignite using Redis compatible client.

Ignite is partially Redis compliant and enables users to store and retrieve distributed data from Apache Ignite caches using any Redis compatible client.

The following commands are supported by Ignite client:
Connection

String

Keys

  • DEL (limitation: number of submitted keys returned)
  • EXISTS

Server

Cluster nodes accept Redis requests listening on a particular socket. By default, each Ignite node is listening for incoming requests on [host]:11211. You can override the host and port using ConnectorConfiguration.

<bean class="org.apache.ignite.configuration.IgniteConfiguration">
  	...
	<property name="connectorConfiguration">
	    <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
		<property name="host" value="localhost"/>
		<property name="port" value="6379"/>
	    </bean>
	</property>
</bean>

Configure default cache

You have to configure default redis-ignite-internal-cache-0 cache that will be used as your default Redis database and also as a template for other databases you switch to with SELECT command.

You can connect to Ignite using your favorite Redis client. See basic examples for some languages below

Java

To connect to Ignite using a Java client for Redis, you need to have an Ignite cluster/node configured, if necessary, as shown above, and running.

To connect to Ignite running on port 6379 with, for instance, Jedis

JedisPoolConfig jedisPoolCfg = new JedisPoolConfig();

// your pool configurations.

JedisPool pool = new JedisPool(jedisPoolCfg, "localhost", 6379, 10000);

try (Jedis jedis = pool.getResource()) {
    jedis.set("key1", "1");
    System.out.println("Value for 'key1': " + jedis.get("key1"));
}

pool.destroy();

Python

To connect to Ignite using a Python client for Redis, you need to have an Ignite cluster/node configured, if necessary, as shown above and running.

To connect to Ignite running on port 6379 with, for instance, redis-py

>>> import redis
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0)
>>> r.set('k1', 1)
True
>>> r.get('k1')
'1'

PHP

To connect to Ignite using a PHP client for Redis, you need to have an Ignite cluster/node configured, if necessary, as shown above and running.

To connect to Ignite running on port 6379 with, for instance, predis

// Load the library.
require 'predis/autoload.php';
Predis\Autoloader::register();

// Connect.
try {
    $redis = new Predis\Client();

    echo ">>> Successfully connected to Redis. \n";

    // Put entry to cache.
    if ($redis->set('k1', '1'))
        echo ">>> Successfully put entry in cache. \n";

    // Check entry value.
    echo(">>> Value for 'k1': " . $redis->get('k1') . "\n");
}
catch (Exception $e) {
    echo "Couldn't connected to Redis";
    echo $e->getMessage();
}