DROP COLUMN FAMILY from cassandra CLI不会删除CF [英] DROP COLUMN FAMILY from cassandra CLI will not drop the CF
问题描述
我们尝试使用cassandra cli删除CF。
We tried to drop CF's using cassandra cli
DROP COLUMN FAMILY cfName
当我们从CLI列出CF不是在那里,当我试图通过hector获得现有的CF
And when we list the CF from CLI it was not there and when i tried to get the existing CF's via hector
我仍然可以看到CF名称
I still could see the CF name
KeyspaceDefinition keyspaceDefinition = newConnection().describeKeyspace(keyspaceName);
keyspaceDefinition.getCfDefs();
CF内的数据不存在,CF仍然被列出,如果我做一个cassandra -cli列的列族我可以看到我的删除CF再次
Data inside the CF is not there however, the CF is still listed, after listing the CFs via hector if i do a cassandra -cli list column families i can see my deleted CF again
推荐答案
我不得不处理这个问题在Cassandra 1.1上。基本上,我的列族已经损坏,并且改变其模式的唯一方法是删除/恢复键空间(DataStax在当时走过我)。
I had to deal with this issue back on Cassandra 1.1 as well. Basically, my column family had become corrupted, and the only way to alter its schema, was to drop/restore the keyspace (which DataStax walked me through, at the time).
如果您有与DataStax的支持合同,我强烈建议您在继续之前与他们联系。他们会告诉你的第一件事是,这是Cassandra 1.1的特定版本中的一个错误,并且你应该升级。我没有测试它,但根据他们,就地升级将允许您在新版本中修改您的架构。因此,您可以通过升级到1.2或2.0来解决此问题。
If you have a support contract with DataStax, I would HIGHLY recommend contacting them before proceeding. The first thing they'll tell you, is that this is a bug in specific versions of Cassandra 1.1, and that you should upgrade. I haven't tested it, but according to them an in-place upgrade would allow you to modify your schema in the new version. So you might be able to fix this by upgrading to 1.2 or 2.0.
在我的情况下(生产,企业环境),现场升级不是一个选择。为了解决这个问题,我基本上不得不删除我的整个键空间,重新创建它(和我的列系列),并从快照恢复。我松散地遵循此处的说明:
In my case (production, enterprise environment) upgrading on-the-spot was not an option. To fix this, I basically had to drop my entire keyspace, re-create it (and my column families), and recover from a snapshot. I loosely followed the instructions found here:
- 在每个节点上获取键空间的快照。快照文件应存储在[keyspaceName] / snapshots dir中,但是我将其复制到另一个非Cassandra位置,只是为了安全。
- 删除您的键空间。
- 在每个节点上,删除keyspace目录中的.db文件(而不是快照目录)。 $
- 重新启动一个节点
- 从该节点的<$ c
- 重新启动您的键盘空间。
- Take a snapshot of the keyspace on each node. The snapshot files should be stored in the [keyspaceName]/snapshots dir, but I copied mine to another non-Cassandra location just to be on the safe side.
- DROP your keyspace.
- Stop all nodes.
- On each node, delete the .db files in the keyspace directory (but not the snapshot dir).
- Copy the files from the snapshot directory back into the keyspace directory.
- Restart one node
- From that node's
cassandra-cli
re-create your keyspace. - Verify that your data is there.
- Restart the remaining nodes.
这篇关于DROP COLUMN FAMILY from cassandra CLI不会删除CF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!