【问题标题】:import schema in Cassandra 3.11.0Cassandra 3.11.0 中的导入模式
【发布时间】:2018-01-14 11:16:58
【问题描述】:

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 cassandra-3.0


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      cassandra-cli 已弃用,请改用cqlsh(您的 sn-p 也是需要 cqlsh 的 CQL(cassandra 查询语言))。您可以在尝试创建表之前创建您的键空间。

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

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

      【讨论】:

      • 已经创建了测试调度器键空间。 @ 987654326@IDEA_WORKSPACE/SPARROW/time-engine/cassandra-migrations/scheduler-02-cf-TaskSchedule.schema:18:SyntaxException: 第 2:2 行不匹配输入 'with' 期望 '(' (创建 columnfamily TaskSchedule [with] column_type ...)
      猜你喜欢
      • 2013-05-02
      • 2012-07-25
      • 1970-01-01
      • 2020-02-18
      • 2021-04-24
      • 1970-01-01
      • 2013-08-09
      • 1970-01-01
      • 2014-01-03
      相关资源
      最近更新 更多