2016-05-30 89 views

回答

1

使用DataStax Java驅動程序(創建密鑰空間,創建表等)是否有可能建立卡桑德拉?

當然:

Session session = ... 

session.execute("CREATE KEYSPACE ...."); 
session.execute("CREATE TABLE ..."); 
2

如果你正在尋找司機的流暢API中的相應方法:

SchemaStatement stmnt = SchemaBuilder.createKeyspace("test") 
     .with() 
     .replication(ImmutableMap.of("class", "SimpleStrategy", "replication_factor", 3)); 
session.execute(stmnt); 

會導致:

cqlsh> describe keyspace test; 

CREATE KEYSPACE test WITH replication = { 
    'class': 'SimpleStrategy', 
    'replication_factor': '3' 
}; 
相關問題