在 Cassandra 3.11.0 中导入模式

import schema in Cassandra 3.11.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”这个例子,我当前的 cassandra 版本不支持 "cassandra-cli" 命令。如何将上述模式导入 cassandra-3.11.0。谢谢。

cassandra-cli 已弃用,请改用 cqlsh(您的代码段也在需要 cqlsh 的 CQL(cassandra 查询语言)中)。您可以在尝试创建表之前创建密钥空间。

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

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

您应该使用 create table 而不是 create columnfamily 格式正确

查看 datastax 文档 http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateTable.html#cqlCreateTable