2016-05-30 59 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' 
}; 
相关问题