Apache cassandra in 2016

Click here to load reader

  • date post

    08-Jan-2017
  • Category

    Technology

  • view

    358
  • download

    1

Embed Size (px)

Transcript of Apache cassandra in 2016

  • Apache Cassandra en 2016DuyHai DOANvangliste Apache Cassandra

  • 2

  • Prsentation et use-cases

  • @doanduyhai

    Caractristiques principales

    4

    massivement scalable (1000+ nuds sur un seul cluster)

    disponibilit extrme (mme en cas de perte de N-1 nuds, N=RF)

    gestion du multi-data center/multi-cloud provider

    data modle riche

    co-systme tendu (Apache Spark, Apache Mesos, Apache Zeppelin)

  • @doanduyhai

    Cas dutilisation

    5 Messaging

    Collections/ Playlists

    Fraud detection

    Recommendation/ Personalization

    Internet of things/ Sensor data

  • @doanduyhai

    Cas dutilisation

    6 Messaging

    Collections/ Playlists

    Fraud detection

    Recommendation/ Personalization

    Internet of things/ Sensor data

  • @doanduyhai

    Cas dutilisation

    7

  • @doanduyhai

    Cas dutilisation

    8

  • @doanduyhai

    Cas dutilisation

    9

  • @doanduyhai

    Cas dutilisation

    10

  • @doanduyhai

    Cas dutilisation

    11

  • @doanduyhai

    Cas dutilisation

    12

  • @doanduyhai

    Cas dutilisation

    13

  • @doanduyhai

    Popularit (db-engines.com)

    14

  • Utilisateurs de Apache Cassandra

  • @doanduyhai

    Quelques noms

    16

  • @doanduyhai

    Quelques (nouveaux) noms

    17

    User management Ads Analytics

    Locations

    Realtime BI

    State management Live streaming

  • @doanduyhai

    Quelques noms chez nous

    18

    Les 6 top banques

    franaises

  • Fonctionnalits dApache Cassandra

  • @doanduyhai

    Tables distribues

    20

    H

    A

    E

    D

    B C

    G F

    user_id1

    user_id2

    user_id3

    user_id4

    user_id5

  • @doanduyhai

    DDL

    21

    CREATE/ALTER/DROP KEYSPACE CREATE/ALTER/DROP TABLE

    CREATE/ALTER/DROP TYPE

    CREATE/ALTER/DROP USER CREATE/ALTER/DROP ROLE

    GRANT/REVOKE ON TO

  • @doanduyhai

    DML

    22

    INSERT INTO users(login, name, age) VALUES('jdoe', 'John DOE', 33);

    UPDATE users SET age = 34 WHERE login = 'jdoe';

    DELETE age FROM users WHERE login = 'jdoe';

    SELECT age FROM users WHERE login = 'jdoe';

  • @doanduyhai

    Collections

    23

    CREATE TABLE xxx( , li list, se set, ma map, );

    UPDATE xxx SET li = li + [append] UPDATE xxx SET se = se + {append} UPDATE xxx SET ma[key] = value

  • @doanduyhai

    User Defined Type (UDT)

    24

    CREATE TYPE address ( number int, street text, zipcode text, city text, country text);

  • @doanduyhai

    Lightweight Transactions

    25

    INSERT INTO users() VALUES(...) IF NOT EXISTS;

    DELETE users WHERE ... IF EXISTS;

    UPDATE users SET age = xxx WHERE ... IF age = 30;

  • @doanduyhai

    Time to live

    26

    INSERT INTO users() VALUES(...) USING TTL = 3600;

    UPDATE users USING TTL = 3600 SET age = xxx WHERE ...;

  • @doanduyhai

    User Defined Functions/Aggregates

    27

    CREATE FUNCTION toUpperCase(input text)RETURNS NULL ON NULL INPUT RETURNS intLANGUAGE javaAS $$ return input.toUpperCase(); $$;

    SELECT toUpperCase(firstname) FROM users WHERE

    SELECT max(salary) FROM users WHERE ...

  • Nouvelles fonctionnalits dApache Cassandra en 2016

  • @doanduyhai

    Delete by range

    29

    DELETE timeseriesWHERE sensor_id = xxxAND date= zzz

    Cassandra 3.0

  • @doanduyhai

    Vues matrialises

    30

    CREATE MATERIALIZED VIEW user_by_salaryAS SELECT * FROM userWHERE id IS NOT NULL AND salary > 100000PRIMARY KEY((salary), id);

    Cassandra 3.0

  • @doanduyhai

    Vues matrialises

    31

    CREATE MATERIALIZED VIEW rich_usersAS SELECT * FROM userWHERE id IS NOT NULL AND salary > 100000PRIMARY KEY((salary), id);

    CREATE MATERIALIZED VIEW rich_french_usersAS SELECT * FROM userWHERE id IS NOT NULL AND country = France AND salary > 100000PRIMARY KEY((country), id);

    Cassandra 3.10

    Cassandra 3.0

  • @doanduyhai

    Mise jour atomique UDT (1er niveau)

    32

    UPDATE usersSET address.street = 12WHERE id = xxx;

    Cassandra 3.6

  • @doanduyhai

    Nouveau index SASI

    33

    CREATE CUSTOM INDEX albums_title_idx ON music.albums(title) USING 'org.apache.cassandra.index.sasi.SASIIndexWITH OPTIONS = {

    'mode': 'CONTAINS', 'analyzer_class':

    'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer', 'tokenization_enable_stemming': 'true',

    'analyzed': 'true', 'tokenization_normalize_lowercase': 'true };

    Cassandra 3.5

  • @doanduyhai

    GROUP BY

    34

    SELECT avg(salary)FROM users_by_countryGROUP BY country, city;

    Cassandra 3.10

  • Demo 35

  • 36

    Q & A

    ! "

  • 37

  • 38

    @doanduyhai

    duy_hai.doan@datastax.com

    https://academy.datastax.com/

    Merci