GridGain Cloud Documentation

The GridGain Cloud Developer Hub

Welcome to the GridGain Cloud developer hub. You'll find comprehensive guides and documentation to help you start working with GridGain Cloud as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Thin Client

Prerequisites

Make sure to download a GridGain Client Cloud Pack or another GridGain distribution and the SSL certificate before establishing a connection to your GridGain Cloud deployment, as explained here.

Connection Info

Ignite provides thin clients for Java, .NET, Python, PHP, and Node.JS applications, which can be used to communicate with the cluster running on GridGain Cloud, over a TCP socket connection.

To connect to the cluster, click on the Name column of your running cluster and obtain the Thin Client connection string from the Cluster Info screen that looks like the one below:

Java Thin Client

Ignite provides IgniteClient API to obtain an instance of cache and perform cache operations.

To use this API:

  • Provide ignite-core.jar to the classpath. Refer to [Java Thin Client (https://apacheignite.readme.io/docs/java-thin-client) general documentation for more details.
  • Download the SSL Certificate named keystore.jks from the Cluster Info dialog. Then, in your code, set the cluster address - host and port, username, password, as well as SSL certificate information in ClientConfiguration.
  • Provide this configuration in the Ignition.startClient(ClientConfiguration) method to establish a secure connection to the cluster and obtain an instance of IgniteClient

Here is an example code snippet:

String thinClient = "13.57.50.182:9490"; // Provide actual thinClient address from the "Cluster Info" dialog.
String username = "ignite"; // This is a pre-defined username provided by GG Cloud.
String pwd = "myclusterpassword"; // Provide actual cluster password from the "Cluster Info" dialog.
String sslPwd = "LO4B0E0A3LtV7nwETnhY"; // Provide actual SSL password from the "Cluster Info" dialog.
String store = "/path/to/SSL/keyStore.jks"; // Provide the path where the file is stored after downloading from GG Cloud.

ClientConfiguration cfg = new ClientConfiguration()
        .setAddresses(thinClient)
        .setUserName(username)
        .setUserPassword(pwd)
        .setSslMode(SslMode.REQUIRED)
        .setSslClientCertificateKeyStorePath(store)
        .setSslClientCertificateKeyStoreType("JKS")
        .setSslClientCertificateKeyStorePassword(sslPwd)
        .setSslTrustCertificateKeyStorePath(store)
        .setSslTrustCertificateKeyStoreType("JKS")
        .setSslTrustCertificateKeyStorePassword(sslPwd)
        .setSslKeyAlgorithm("SunX509")
        .setSslTrustAll(false)
        .setSslProtocol(SslProtocol.TLS);

try (IgniteClient igniteClient = Ignition.startClient(cfg)) {
    final String CACHE_NAME = "put-get-example";

    ClientCache<Integer, String> cache = igniteClient.getOrCreateCache(CACHE_NAME);

    System.out.format(">>> Created cache [%s].\n", CACHE_NAME);

    Integer key = 1;
    String val = "Hello";

    cache.put(key, val);

    System.out.format(">>> Saved [%s] in the cache.\n", val);

    String cachedVal = cache.get(key);

    System.out.format(">>> Loaded [%s] from the cache.\n", cachedVal);
}
catch (Exception e) {
    System.err.format("Unexpected failure: %s\n", e);

    e.printStackTrace();
}

See the Java Thin Client Documentation for more information about the API.

.NET Thin Client

.NET applications can use .NET thin client to connect to the cluster running on GridGain Cloud and perform supported cache operations.

To use this API:

  • Install .NET Thin Client dependencies.
  • Download the SSL Certificate named client.pfx from the Cluster Info dialog. Then, in your code, set the cluster address - host and port, username, password, as well as SSL certificate information in IgniteClientConfiguration.
  • Provide this configuration in the Ignition.StartClient(ClientConfiguration) method to establish a secure connection to the cluster and obtain an instance of ICacheClient.

Here is an example code snippet:

IgniteClientConfiguration cfg = new IgniteClientConfiguration()
{
    Host = "18.144.56.147", // Provide actual thin client host address from the "Cluster Info" dialog.
    Port = 9790, // Provide actual thin client port from the "Cluster Info" dialog.
    Username = "ignite", // This is a pre-defined username provided by GG Cloud.
    Password = "myclusterpassword", // Provide actual cluster password from the "Cluster Info" dialog.

    SslStreamFactory = new SslStreamFactory
    {
        CertificatePath = @"C:\path\to\client.pfx", // Provide the path where the file is stored after downloading from GG Cloud.
        CertificatePassword = "jb5GtvpSfWVjQZ84T1ud", // Provide actual SSL password from the "Cluster Info" dialog.
        SkipServerCertificateValidation = true
    }
};

using (var cli = Ignition.StartClient(cfg))
{
    ICacheClient<Int32, String> cache = cli.GetOrCreateCache<Int32, String>("myCache");

    Console.WriteLine(">>> Created cache");

    cache.Put(1, "Hello");

    Console.WriteLine(">>> Saved value to cache");

    String val = cache.Get(1);

    Console.WriteLine(">>> Loaded value from cache: " + val);
 
    cli.DestroyCache("myCache");
}

See the .NET Thin Client Document for more information about the API.

C++ Thin Client

C++ applications can use C++ thin client to connect to the cluster running on GridGain Cloud and perform supported cache operations.

To use this API:

  • Follow the C++ thin client installation instructions.
  • Download the SSL Certificate named client.pem from the Cluster Info dialog. Then, in your code, set the cluster address - host and port, username, password, as well as SSL certificate information in IgniteClientConfiguration.
  • Provide this configuration in the IgnitionClient.Start(ClientConfiguration) method to establish a secure connection to the cluster and obtain an instance of ICacheClient.

Here is an example code snippet:

int main()
{
    using namespace ignite::thin;
    using namespace boost::chrono;

    IgniteClientConfiguration cfg;
    cfg.SetEndPoints("[CONNECTION_STRING]");
    cfg.SetSslMode(SslMode::REQUIRE);
    cfg.SetSslCertFile("/path/to/SSL/client.pem"); // Provide the path where the file is stored after downloading from GG Cloud.
    cfg.SetSslCaFile("/path/to/SSL/client.pem");
    cfg.SetSslKeyFile("/path/to/SSL/client.pem");
    cfg.SetUser("ignite"); // This is a pre-defined username provided by GG Cloud.
    cfg.SetPassword("myclusterpassword"); // Provide actual cluster password from the "Cluster Info" dialog.

    int retcode = 0;

    try
    {
        IgniteClient client = IgniteClient::Start(cfg);
        cache::CacheClient<int32_t, int32_t> intCache = client.GetOrCreateCache<int32_t, int32_t>("test");

        intCache.Put(1, 1);

    }
    catch (const ignite::IgniteError& err)
    {
        std::cout << err.GetText() << std::endl;

        retcode = err.GetCode();
    }
    catch (const std::exception& err)
    {
        std::cout << err.what() << std::endl;

        retcode = -1;
    }

    std::cout << std::endl;
    std::cout << std::endl;

    return retcode;
}

Python Thin client

Python applications can use Python thin client to connect to the cluster running on GridGain Cloud and perform supported cache operations.

To use this API:

  • Install pyignite from PyPI using the command $ pip install pyignite, or follow the installation instructions from here.
  • Download the SSL Certificate named client.pem from the Cluster Info dialog.
  • In your code, set the cluster address - host and port, username, password, as well as SSL certificate information in Client and establish a secure connection to the cluster.

Here is an example code snippet:

from pyignite import Client

client = Client(
    username='ignite', # This is a pre-defined username provided by GG Cloud.
    Password = "myclusterpassword", # Provide actual cluster password from the "Cluster Info" dialog.
    use_ssl=True,
    ssl_keyfile='/path/to/SSL/client.pem', # Provide the path where the file is stored after downloading from GG Cloud.
    ssl_certfile='/path/to/SSL/client.pem'
)
client.connect('13.57.50.182', 9490) # Provide actual thinClient address from the "Cluster Info" dialog.

my_cache = client.create_cache('myCache')

my_cache.put('my key', 42)

result = my_cache.get('my key')
print(result)

PHP Thin client

PHP applications can use PHP thin client to connect to the cluster running on GridGain Cloud and perform supported cache operations.

To use this API:

  • Follow the PHP thin client installation instructions.
  • Download the SSL Certificate named client.pem from the Cluster Info dialog.
  • In your code, set the cluster address - host and port, username, password, as well as SSL certificate information in ClientConfiguration and establish a secure connection to the cluster.

Here is an example code snippet:

<?php

require_once '/src/vendor/autoload.php';

use Apache\Ignite\Client;
use Apache\Ignite\ClientConfiguration;

class PhpBench
{
    public function start(): void
    {
        $client = new Client();
        $client->connect(new ClientConfiguration("CONNECTION_STRING"));
        $tlsOptions = [
            'local_cert' => '/path/to/SSL/client.pem', // Provide the path where the file is stored after downloading from GG Cloud.
            'cafile' => '/path/to/SSL/client.pem',
            'verify_peer' => false, // This is a workaround; shouldn't be used in production
            'verify_peer_name' => false // This is a workaround; shouldn't be used in production
        ];
        $config = (new ClientConfiguration("CONNECTION_STRING"))
                ->setUserName("ignite") // This is a pre-defined username provided by GG Cloud.
                ->setPassword("myclusterpassword") // Provide actual cluster password from the "Cluster Info" dialog.
                ->setTLSOptions($tlsOptions);

        $client->connect($config);
        $cache = $client->getOrCreateCache("myCache");
        $cache->put(1, 1);
    }
}

(new PhpBench())->start();

Node.JS Thin client

Node.JS applications can use Node.JS thin client to connect to the cluster running on GridGain Cloud and perform supported cache operations.
To use this API:

  • Follow the Node.JS thin client installation instructions.
  • Download the SSL Certificate named client.pem from the Cluster Info dialog.
  • In your code, set the cluster address - host and port, username, password, as well as SSL certificate information in IgniteClientConfiguration and establish a secure connection to the cluster.

Here is an example code snippet:

const FS = require('fs');

IgniteClient = require('apache-ignite-client');
IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;

igniteClient = new IgniteClient();

async function start() {
   const connectionOptions = {
       'cert' : FS.readFileSync('/path/to/SSL/client.pem'),
       'ca' : FS.readFileSync('/path/to/SSL/client.pem'),
       'key' : FS.readFileSync('/path/to/SSL/client.pem'),
       'rejectUnauthorized': false
    };
  
    await igniteClient.connect(new IgniteClientConfiguration("[CONNECTION_STRING]")
        .setUserName("ignite") // This is a pre-defined username provided by GG Cloud.
        .setPassword("myclusterpassword") // Provide actual cluster password from the "Cluster Info" dialog.
        .setConnectionOptions(true, connectionOptions));
    setTimeout(run, 7);
}

async function run() {
    cache = await igniteClient.getOrCreateCache("test");
    await cache.put(1, 1);
}
start();

Binary Client Protocol

Ignite provides thin clients for Java .Net, Python, PHP, and Node.JS. For other languages, Binary Client Protocol can be used directly to establish a connection to the cluster deployed on GG Cloud, and perform various cache operations.

Thin Client


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.