Pacific-Design.com

    
Home Index

1. Cassandra

2. Schema

Cassandra / Schema /


-- ------------------------------------------------------------------------------------------------------ --
DROP KEYSPACE IF EXISTS production;
CREATE KEYSPACE production WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };
DESCRIBE KEYSPACES;
-- ------------------------------------------------------------------------------------------------------ --
CREATE TABLE IF NOT EXISTS
production.store (
    id              text,
    date            timestamp,
    name            text,
    title           text,
    description     text,
    category        text,
    published       timestamp,
    score           float,
    comments        int,
    PRIMARY KEY (id)
)
WITH comment     = 'production store'
 AND compression = { 'sstable_compression' : '' }
 AND compaction  = { 'class' :  'LeveledCompactionStrategy' };
-- ------------------------------------------------------------------------------------------------------ --
DESCRIBE production 

Multi Data Center


-- ------------------------------------------------------------------------------------------------------ --
CREATE KEYSPACE "kevin" WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'dc1' : 1, 'dc2' : 1; }
-- ------------------------------------------------------------------------------------------------------- --

References:

Time Series Data Modeling