31
Orient DB on the Cloud Un approccio pratico Gabriele De Carli - @Gabber_84 Luigi Dell’Aquila - @ldellaquila

Orient DB on the cloud - Cloud Party 2013

Embed Size (px)

DESCRIPTION

OrientDB, graph/document database, portato sulla piattaforma cloud di Amazon

Citation preview

Page 1: Orient DB on the cloud - Cloud Party 2013

Orient DB on the Cloud

Un approccio pratico

Gabriele De Carli - @Gabber_84 Luigi Dell’Aquila - @ldellaquila

Page 2: Orient DB on the cloud - Cloud Party 2013

Cos’è Orient DB?

• NoSQL*

• Document/Graph Database

• REST/JSON

• Scalable

• Multi Platform

• ACID Transaction

Page 3: Orient DB on the cloud - Cloud Party 2013

Il modello dei dati

• Database

• Cluster

• Class - Inheritance• Vertex/Edge• Document

• Schema• Schemaful• Schemaless• Schema-mixed

Page 4: Orient DB on the cloud - Cloud Party 2013

Interfacce di interrogazione

• HTTP REST

• Native• Java• Scala• JavaScript• PHP• C• Ruby• .NET• Python• Node.js• Clojure

• Tinkerpop Blueprints compliant

Page 5: Orient DB on the cloud - Cloud Party 2013

NoSQL ma…

Page 6: Orient DB on the cloud - Cloud Party 2013

SQL!

Page 7: Orient DB on the cloud - Cloud Party 2013

Esempi

CREATE CLASS PERSON;

INSERT INTO PERSON (NAME, SURNAME) VALUES (“MARIO”, “ROSSI”);

SELECT * FROM PERSON WHERE SURNAME = “ROSSI”;

SELECT NAME, SURNAME, ADDRESS.CITY.REGION.COUNTRY FROM PERSON WHERE SURNAME = “ROSSI” AND ADDRESS.CITY.REGION.COUTRY.CONTINENT.NAME = “EUROPE”;

CREATE CLASS PERSON EXTENDS V;

CREATE CLASS FRIEND EXTENDS E;

CREATE VERTEX PERSON SET NAME = “MARIO”, SURNAME = “ROSSI”

CREATE VERTEX PERSON SET NAME = “MARCO”, SURNAME = “VERDI”

CREATE EDGE FRIEND FROM #10:1 TO #10:2

CREATE EDGE FRIEND FROM (SELECT FROM PERSON WHERE SURNAME = “ROSSI”) TO (SELECT FROM PERSON WHERE SURNAME = “VERDI”)

Page 8: Orient DB on the cloud - Cloud Party 2013

Esempi

SELECT FROM CITY WHERE COUNTRY.NAME.substring(1,3).toUpperCase() = “TAL”

SELECT FROM AGENDA WHERE EMAIL MATCHES '\bA-Z0-9._%[email protected]?+\.A-Z?{2,4}\b’

SELECT MAX(INCOMING) AS MAX_INCOMING, MAX(COST) AS MAX_COST FROM BALANCE

Page 9: Orient DB on the cloud - Cloud Party 2013

In più (in ordine sparso)

• Supporto Transazionale

• Javascript nativo

• Funzioni

• TinkerPop - Gremlin

• Java Object API

• Local/remote/embedded mode

• Veloce! 150.000 record/secondo (flat, no index)

Page 10: Orient DB on the cloud - Cloud Party 2013

Replication (high availability)

Page 11: Orient DB on the cloud - Cloud Party 2013

Replication

HAZELCAST

Page 12: Orient DB on the cloud - Cloud Party 2013

Replication

HAZELCAST HAZELCASTmulticast

Page 13: Orient DB on the cloud - Cloud Party 2013

Replication

HAZELCAST HAZELCAST

HAZELCAST

Multi Master

Page 14: Orient DB on the cloud - Cloud Party 2013

Replication

HAZELCAST HAZELCASTmulticast

AWS

Page 15: Orient DB on the cloud - Cloud Party 2013

Replication

HAZELCAST HAZELCAST

HAZELCAST

Amazon

Elastic Load

Balancing+

Auto Scaling

Page 16: Orient DB on the cloud - Cloud Party 2013

Replication

• ~ 0 config

• Multi Master

• Load Balancing, Auto Scaling

• Fault Tolerant

Page 17: Orient DB on the cloud - Cloud Party 2013

HOW-TO 1/7

• Orient DB >= 1.6.0-SNAPSHOT

• Istanziare una macchina su EC2 (Micro è OK)

• Installare Orient DB (distributed) sulla macchina come servizio e configurare Hazelcast per usare AWS

• Creare una AMI dall’istanza

Page 18: Orient DB on the cloud - Cloud Party 2013

HOW-TO 2/7

Amazon key pairs

Page 19: Orient DB on the cloud - Cloud Party 2013

HOW-TO 3/7

Amazon security group

Page 20: Orient DB on the cloud - Cloud Party 2013

HOW-TO 4/7

Amazon New Instance (T1 Micro)

Page 21: Orient DB on the cloud - Cloud Party 2013

HOW-TO 5/7

Amazon New Instance (T1 Micro)

Page 22: Orient DB on the cloud - Cloud Party 2013

HOW-TO 6/7

Orient/bin/orientdb.sh (+ link simbolico in /etc/rcX.d/)

Page 23: Orient DB on the cloud - Cloud Party 2013

HOW-TO 7/7

Orient/config/hazelcast.xml

Page 24: Orient DB on the cloud - Cloud Party 2013

DEMO

Page 25: Orient DB on the cloud - Cloud Party 2013

Java (Graph API)

Page 26: Orient DB on the cloud - Cloud Party 2013

Java (Graph API)

Page 27: Orient DB on the cloud - Cloud Party 2013

JavaScript

Page 28: Orient DB on the cloud - Cloud Party 2013

Risorse

Page 30: Orient DB on the cloud - Cloud Party 2013

Libri