在Cassandra 3.11.0中导入模式

时间:2017-08-07 07:59:50

标签: cassandra cassandra-3.0

Cassandra架构,

use testscheduler;
create columnfamily TaskSchedule
with column_type = 'Standard'


and comparator = 'CompositeType(DateType,UTF8Type,UTF8Type)'
  and default_validation_class = 'UTF8Type'
  and key_validation_class = 'CompositeType(Int32Type,UTF8Type)'
  and read_repair_chance = 0.2
  and dclocal_read_repair_chance = 0.0
  and populate_io_cache_on_flush = false
  and gc_grace = 43200
  and min_compaction_threshold = 4
  and max_compaction_threshold = 32
  and replicate_on_write = true
  and compaction_strategy = 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'
  and caching = 'KEYS_ONLY'
  and compression_options = null;

我试过" Keyspace schema import and export in Cassandra"这个例子,我的currunt cassandra版本不支持" cassandra-cli"命令。如何将上面提到的模式导入到cassandra-3.11.0。感谢。

2 个答案:

答案 0 :(得分:0)

不推荐使用

cassandra-cli,而是使用cqlsh(您的代码段也是CQL(cassandra查询语言),需要cqlsh)。您可以在尝试创建表之前创建键空间。

CREATE KEYSPACE testscheduler WITH replication = {'class':'SimpleStrategy',
   'replication_factor' : 1};

有一些很好的教程,例如https://www.tutorialspoint.com/cassandra/https://academy.datastax.com/

答案 1 :(得分:0)

您应该使用 create table 而不是以适当的格式创建columnfamily

请参阅datastax文档 http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#cqlCreateTable