generated from DataStax-Examples/datastax-examples-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSampleCode4x_CONNECT_CreateKeyspace.java
39 lines (34 loc) · 1.25 KB
/
SampleCode4x_CONNECT_CreateKeyspace.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.datastax.samples;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Create a keyspace with Simple Strategy and replication factor 1 (for local environment)
*
* Pre-requisites:
* - Cassandra running at (ip=127.0.0.1, port=9042, datacenter=datacenter1)
*
* This code below will execute the following CQL statement:
* --------------------------------------------------------------------
* CREATE KEYSPACE killrvideo
* WITH replication =
* {'class': 'SimpleStrategy',
* 'replication_factor': '1'}
* AND durable_writes = true;
* ---------------------------------------------------------------------
*
* @author DataStax Developer Advocate Team
*
* Need Help ? Join us on community.datastax.com to ask your questions for free.
*/
public class SampleCode4x_CONNECT_CreateKeyspace implements ExampleSchema {
/** Logger for the class. */
private static Logger LOGGER = LoggerFactory.getLogger(SampleCode4x_CONNECT_CreateKeyspace.class);
/**
* StandAlone program relying on main method to easy copy/paste.
*/
public static void main(String[] args) {
LOGGER.info("Starting 'CreateKeyspace' sample...");
ExampleUtils.createKeyspace();
System.exit(0);
}
}