Skip to content

Latest commit

 

History

History
85 lines (70 loc) · 4.33 KB

README.md

File metadata and controls

85 lines (70 loc) · 4.33 KB

Elassandro Databases Synchronizer - Advanced synchronizer

Elassandro is a basic databases synchronizer, that guarantees data synchronization between Cassandra and Elasticsearch.

Structure

Cassandra is considered as a primary data storage. Every inserted row in Cassandra will has its own respective document stored in Elasticsearch. Following the same logic, each update or delete method invoked on Cassandra, will systematically be invoked on Elasticsearch.

Configuration

This API is built over Cassandra 3.0.9 and Elasticsearch 5.4.1.

Cassandra

Before running this API, you can create a keyspace using this command :
CREATE KEYSPACE your_keyspace_name;
USE your_keyspace_name;

After that, you can create your table ; Example :

CREATE TABLE city(
   name text,
   prefecture text,
   country text,
   population bigint,
   PRIMARY KEY (name, prefecture)
);

Elasticsearch

At this point, you can create the respective Elasticsearch index for your Cassandra Table, with this command :

Using kibana :

PUT cities
{
  "mappings": {
  "city": {
    "properties": {
      "name": {
        "type": "text"
      },
      "prefecture": {
        "type": "text"
      },
      "country": {
        "type": "text"
      },
      "population": {
        "type": "long"
      }
      }
    }
  }
  }

Using CURL :

curl -XPUT "http://localhost:9200/cities" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "city": {
      "properties": {
          "name": {
              "type": "text"
          },
          "prefecture": {
              "type": "text"
          },
          "country": {
              "type": "text"
          },
          "population": {
              "type": "long"
          }
      }
    }
  }
}'

Note :

The work on this branch is not completed ... You may take a look at the basic synchronizer (complete) : https://github.com/ghazi-naceur/elassandro-dbs-synchronizer/tree/elassandro-basic-synchronizer .
The aim of this branch (advanced synchronizer/master branch) is to integrate Apache Camel and ActiveMQ in order to provide an Asynchronous CRUD in distinct routes.
In order to provide a synchronization between Cassandra and Elasticsearch, I recommend using Cassandra Trigger :
https://github.com/ghazi-naceur/cassandra-trigger (forked from gardeup)