Skip to main content

Code Sandbox

Overview

This is a sandbox application where you can write client code in several languages and interact with a remotely-hosted Aerospike Database instance. The database includes sample data that tracks UFO sightings.

Experiment with your code

The default namespace for the sandbox is sandbox and there are 5,000 records loaded into the set ufodata. Check out the code samples below or add your own data to get started.

  • Code Editor

  • Terminal

  • Blank
  • Setup
  • Create
  • Read
  • Update
  • Delete

Console

?
Close

First time here?

Our sandbox lets you run code and interact with an Aerospike enterprise cluster, right from your browser.

Code Samples

Java

Setup your environment by importing the Aerospike client library and other modules.

// Import the Aerospike client library and other modules
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;
import java.util.List;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.AerospikeException;
import com.aerospike.client.policy.Policy;
import com.aerospike.client.policy.WritePolicy;
import com.aerospike.client.Bin;
import com.aerospike.client.Key;
import com.aerospike.client.Record;
import com.aerospike.client.Value;
import com.aerospike.client.cdt.MapOrder;
import com.aerospike.client.cdt.MapPolicy;
import com.aerospike.client.cdt.MapOperation;
import com.aerospike.client.policy.RecordExistsAction;

// This is for formatting output in the sandbox
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Gson gson = new GsonBuilder().setPrettyPrinting().create();

// Define base policy
Policy policy = new Policy();
policy.sendKey = true;

System.out.println("Setup complete");

Next steps

Visit the Aerospike notebooks repository to run additional Aerospike notebooks.

Explore the sample data locally

Download the sandbox dataset from the Interactive Notebooks GitHub repository. Sandbox Dataset

This file is a full database backup made with the Aerospike Backup tool. You can transfer the data to a new Aerospike Database instance, regardless of version, by restoring this backup with Aerospike Restore.