【问题标题】:Too many key parts specified; max 1 parts allowed cassandra engine and mariadb指定的关键部分过多;最多允许 1 个部件 cassandra 引擎和 mariadb
【发布时间】:2016-07-16 07:58:34
【问题描述】:

我正在尝试实现 cassandra SE 和 MariaDB 的互操作性。在cqlsh 中,我可以使用复合键创建表。当我在 mariadb 中尝试相同的操作时,我收到错误 ERROR 1070 (42000): Too many key parts specified; max 1 parts allowed。 这是我在cqlsh中使用的代码:

cqlsh:mariadbtest> create table test (test1 int, test2 bigint, test3 varchar, primary key (test1, test2)) with compact STORAGE;

Mariadb

MariaDB [test]> set global cassandra_default_thrift_host='localhost';

MariaDB [test]> create table random (test1 int(5), test2 bigint(5), test3 varchar(20), PRIMARY KEY (test1, test2)) engine=cassandra keyspace='historian' thrift_host='localhost' column_family='test';
ERROR 1070 (42000): Too many key parts specified; max 1 parts allowed

当我使用单列作为主键时,它可以正常工作,没有错误。请帮助我解决复合键问题。 任何帮助将不胜感激。

【问题讨论】:

    标签: mysql cassandra datastax


    【解决方案1】:

    存储引擎不支持此功能。根据docs

    注意:目前不支持多列主键。未来版本可能会添加支持,具体取决于是否有需求。

    尚不清楚您是否能够定义复合分区键(即PRIMARY KEY ((test1, test2)))。我也不确定这是否适合您的需求。如果你需要的话,听起来你应该声明你的兴趣。

    【讨论】:

    • 我尝试了复合分区键,但我得到了同样的错误。是的,我的桌子需要它。您能否提供一个关于如何在 cassandra SE 和 MySQL 上使用复合键的示例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    • 2015-12-18
    相关资源
    最近更新 更多