【问题标题】:Cassandra Datastax Node.js driver can't find keyspaceCassandra Datastax Node.js 驱动程序找不到密钥空间
【发布时间】:2018-04-29 12:09:27
【问题描述】:

刚刚安装了 Cassandra (3.11.1) 和 Datastax node.js 驱动程序 (3.3.0)。

创建了一个简单的结构:

CREATE KEYSPACE CaseBox
   WITH REPLICATION={
     'class': 'SimpleStrategy',
     'replication_factor': 1};
USE CaseBox;

CREATE TABLE Regions (
    regionId int,
    name varchar,
    PRIMARY KEY ((regionId))
);

尝试连接到密钥空间但没有成功:

const client = new cassandra.Client({
  contactPoints: ['localhost'],
  keyspace: 'CaseBox'
});

await client.connect();

错误:Keyspace 'CaseBox' does not exist。 如果我将所需的 kayspace 更改为 system 它可以工作。 怎么了?请帮忙。

您可以找到我的完整 Cassandra 配置、CQL 和 js 脚本here

【问题讨论】:

    标签: node.js cassandra datastax cassandra-3.0 datastax-node-driver


    【解决方案1】:

    Keyspace names are forced lower case when unquoted in CQL.

    在 CQL 中使用 CREATE KEYSPACE "CaseBox" 或在 Node 中使用 keyspace: 'casebox'

    通常只使用snake_case 名称,因为您不会像这样经常被困。

    【讨论】:

      猜你喜欢
      • 2016-02-27
      • 2017-01-20
      • 2018-02-15
      • 2013-12-23
      • 2015-10-25
      • 2020-02-01
      • 2016-10-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多