5

我正在尝试从我的数据库中删除一个表/列族,但我无法做到。

我尝试了以下命令,它们的响应是:

cqlsh:testreducedb> DROP_COLUMNFAMILY largest_time_total;
Bad Request: line 1:0 no viable alternative at input 'DROP_COLUMNFAMILY'
cqlsh:testreducedb> DROP COLUMNFAMILY largest_time_total;
Bad Request: unconfigured columnfamily largest_time_total
cqlsh:testreducedb> DROP COLUMN FAMILY largest_time_total;
Bad Request: line 1:5 no viable alternative at input 'COLUMN'
cqlsh:testreducedb> DROP COLUMN FAMILY 'largest_time_total';
Bad Request: line 1:5 no viable alternative at input 'COLUMN'
cqlsh:testreducedb> DROP COLUMN FAMILY "largest_time_total";
Bad Request: line 1:5 no viable alternative at input 'COLUMN'

并且:

cqlsh:testreducedb> DROP_TABLE largest_time_total;
Bad Request: line 1:0 no viable alternative at input 'DROP_TABLE'
cqlsh:testreducedb> DROP TABLE largest_time_total;
Bad Request: unconfigured columnfamily largest_time_total
cqlsh:testreducedb> DROP TABLE 'largest_time_total';
Bad Request: line 1:11 no viable alternative at input 'largest_time_total'
cqlsh:testreducedb> DROP TABLE "largest_time_total";
Bad Request: unconfigured columnfamily largest_time_total

有人知道如何在 Cassandra 2.0.5 中删除表/列族吗?

我在用:

[cqlsh 4.1.1 | Cassandra 2.0.5 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
4

1 回答 1

5

我将检查您遇到的错误,以便您可以清楚地了解正在发生的事情,但首先要注意 columnfamily == table.

cqlsh:testreducedb> DROP_COLUMNFAMILY maximum_time_total; 错误请求:第 1:0 行在输入“DROP_COLUMNFAMILY”处没有可行的替代方案

DROP_COLUMNFAMILY不是一个有效的命令。它应该是DROP COLUMFAMILYDROP TABLE假设您已经在使用存储上述表(又名列族)的键空间(数据库)。如果您没有为您的客户端指定密钥空间,那么您可以在 drop 语句中指定它:

DROP TABLE <keyspace>.<columnfamily>;
DROP TABLE <keyspace>.<table>;
# the below is an actual statement assuming grocerystore is the keyspace and
# shoppers is the columnfamily 
DROP TABLE "grocerystore"."shoppers";

cqlsh:testreducedb> DROP COLUMNFAMILY maximum_time_total; 错误请求:未配置的列族最大时间总计

列族实际上并不存在。基于只看到cqlsh我敢打赌你没有指定使用存储 *largest_time_total* 的键空间。尝试USE <keyspace>在 cqlsh 中使用,例如USE grocerystore;

其余的错误只是上述的重复。

PSCOLUMN你真的很接近这个,但是和之间有一个太多的空间FAMILY:)

cqlsh:testreducedb> DROP COLUMN FAMILY large_time_total; 错误请求:第 1:5 行在输入“COLUMN”处没有可行的替代方案

尝试:

USE testreducedb;
DROP COLUMNFAMILY largest_time_total;
于 2014-04-05T23:05:08.120 回答