AntidoteDB
  • Overview
  • Quickstart
  • Examples & Applications
    • Timeseries Load Generator
    • Antidote Web Shell
    • Calendar App
    • Todo List App
  • Tutorials
    • Java Tutorial
  • Related Projects
  • Architecture
    • Overview
    • Ring
    • Log
    • Materializer
    • Transaction Manager
    • Inter-DC Communication
    • Failure Modes
    • Datatypes in Antidote
    • Commit Hooks
    • Features Configuration
  • Deployment
    • Natively (Linux)
    • Local Docker Setup
    • Docker Compose Setups
    • Docker Swarm
    • Kubernetes
  • Monitoring
    • Prometheus and Grafana
  • API
    • Native (Erlang)
    • Protocol Buffer API
    • Erlang
    • Java
    • JavaScript
    • Go
    • Python
  • Benchmarking
    • Setup
    • Basho Bench
  • Tools
    • Logs and Cache Dump
  • Development
    • Setup & Environment
    • Building a Release
    • Testing
    • Contributing
    • Archived Works
  • Release Notes
    • 0.2.1
    • 0.1.1
    • 0.0.1
Powered by GitBook
On this page
  • Requirements
  • Create a cluster
  • Connecting to AntidoteDB
  • Interacting with AntidoteDB

Quickstart

This guide will walk you through the core features of AntidoteDB.

PreviousOverviewNextExamples & Applications

Last updated 4 years ago

We will use Docker to run AntidoteDB nodes. Please refer to the complete installation guide below if you wish to build the nodes from source:

In this guide, you will accomplish the following steps:

  • Start two AntidoteDB nodes as single-node data centers and connect them together

  • Start and commit a transaction

  • Use the Bounded Counter data type

Requirements

  • Install the latest version of Docker ()

  • Install the latest version of

Create a cluster

If you prefer to skip the steps to build the cluster manually, there is a Docker Compose file available at: .

  • Download the deployment setup for a 2 data center single shard setup ()

  • Run docker-compose up

We now have an AntidoteDB setup with two DCs (i.e. data is replicated once).

Connecting to AntidoteDB

In two separate terminals, connect to the console of each node:

docker exec -it antidote1 /antidote/bin/antidote remote_console
docker exec -it antidote2 /antidote/bin/antidote remote_console

Alternatively, you can use docker-compose to connect

docker-compose exec antidote1 /antidote/bin/antidote remote_console

Interacting with AntidoteDB

Start a new transaction and increment the value of a bounded counter. By default, if the counter does not exist, one is created automatically.

{ok, TxId} = antidote:start_transaction(ignore, []).
antidote:update_objects([{ {counter_key, antidote_crdt_counter_b, test_bucket}, increment, {10, client1}}], TxId).
antidote:commit_transaction(TxId).
# output: {ok, ...}

The counter can be decremented in the replica where it was created:

{ok, TxId1} = antidote:start_transaction(ignore, []).
antidote:update_objects([{ {counter_key, antidote_crdt_counter_b, test_bucket}, decrement, {1, client1}}], TxId1).
antidote:commit_transaction(TxId1).
# output: {ok, ...}

And the value of the counter can be read on the other replica (use the other terminal):

{ok, TxId} = antidote:start_transaction(ignore, []).
{ok, [Obj]} = antidote:read_objects([{counter_key, antidote_crdt_counter_b, test_bucket}], TxId).
antidote_crdt_counter_b:permissions(Obj).
# output: 9

But cannot be decremented:

{error, _} = antidote:update_objects([{ {counter_key, antidote_crdt_counter_b, test_bucket}, decrement, {1, client2}}], TxId).
# output: {error,{aborted, ...}}

At this point, the transaction aborts and the system will automatically fetch permissions from another replica. After the resources are transfered between nodes, it is possible to decrement the counter.

{ok, TxId1} = antidote:start_transaction(ignore, []).
antidote:update_objects([{ {counter_key, antidote_crdt_counter_b, test_bucket}, decrement, {1, client2}}], TxId1).
antidote:commit_transaction(TxId1).
# output: {ok, ...}
Docker Installation Guide
docker-compose
https://github.com/mweberUKL/antidote_dev/tree/master/docker_dcs
docker-compose file