Cassandra:只能在CLUSTERING ORDER指令中定义聚类键列

时间:2016-09-06 19:29:34

标签: cassandra

cqlsh> CREATE TABLE mykeyspace.counts (     company text,     day bigint,     type text,     host inet,     eventcount counter,    PRIMARY KEY ((company, day), type, host) ) WITH CLUSTERING ORDER BY (company ASC, day ASC, ftype ASC, host ASC);

InvalidRequest: code=2200 [Invalid query] message="Only clustering key columns can be defined in CLUSTERING ORDER directive"

为什么呢?怎么解决?

由于

1 个答案:

答案 0 :(得分:0)

您不能排序location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi.conf; add_header Cache-Control "public"; access_log off; } location [IF PHP FILE IN wp-admin FOLDER] { add_header Cache-Control "no-store"; } location ~* \.(js|css|svg|png|jpg|jpeg|gif|ico|eot|otf|ttf|woff)$ { add_header Access-Control-Allow-Origin *; add_header Cache-Control "public"; access_log off; log_not_found off; expires 1y; } ,因为这些密钥声明数据如何在群集中传播,不能用于范围查询。在将数据放在节点上之前对分区键进行哈希处理,因此除非您使用ByteOrderedPartitioner(不使用此),否则排序几乎无关紧要,因为您需要对所有节点进行全面扫描实际上对这些列进行范围查询。

我建议查看一些基本的数据建模会谈,以获得更多相关信息:

Data Modeling at Cassandra Day Chicago 2015