Revision as of 00:05, July 16, 2016 by Dkozlova (talk | contribs)
Jump to: navigation, search

Initialization Cassandra scripts for Chat Server

Create keyspace

CREATE KEYSPACE genesys_chat_server 
WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
 
USE genesys_chat_server;

Create tables without a cleanup procedure

CREATE TABLE transcripts (
   id text,
   creatorid text,
   transcript text,
   PRIMARY KEY (id, creatorid) ) 
WITH CLUSTERING ORDER BY (creatorid ASC);

Table owner
CREATE TABLE owner (
   id text,
   ownership_start_time timeuuid,
   creatorid text,
   PRIMARY KEY (id, ownership_start_time) )
WITH CLUSTERING ORDER BY (ownership_start_time DESC);

Create tables with a cleanup procedure

You can specify default_time_to_live and gc_grace_seconds, as shown in the following example, where 1209600 is the number of seconds in two weeks:

CREATE TABLE transcripts (
   id text,
   creatorid text,
   transcript text,
   PRIMARY KEY (id, creatorid) ) 
WITH CLUSTERING ORDER BY (creatorid ASC)
AND default_time_to_live = 1209600 AND gc_grace_seconds = 1209600;

Table owner
CREATE TABLE owner (
   id text,
   ownership_start_time timeuuid,
   creatorid text,
   PRIMARY KEY (id, ownership_start_time) )
WITH CLUSTERING ORDER BY (ownership_start_time DESC)
AND default_time_to_live = 1209600 AND gc_grace_seconds = 1209600;

For more information, see Deploying Chat Server with Cassandra.

Comments or questions about this documentation? Contact us for support!