我应该如何复制集群中的键空间 [英] How should I copy a keyspace within a cluster

查看:13
本文介绍了我应该如何复制集群中的键空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个键空间填充了生成成本很高的数据.我想在我的集群中复制这个数据的两个副本.我想最终得到两个键空间:让我们称它们为 mydatamydatabackup,它们都包含相同的数据(我不介意 Cassandra 时间戳是否不同).

I have a keyspace populated with data that was expensive to generate. I want two copies of this data within my cluster. I would like to end up with two keyspaces: lets call them mydata and mydatabackup, both of which contain identical data (I don't mind if the Cassandra timestamps are different).

有没有简单的方法可以做到这一点?我能找到的最接近的答案是使用 sstable2json 和 json2sstable 作为回应类似的问题?有没有更好的办法?

Is there an easy way to do this? Closest thing I can find to an answer is to use sstable2json and json2sstable as suggested in response to a similar question? Is there a better way?

推荐答案

"有没有更好的方法?"

" Is there a better way?"

所有 Cassandra 数据都存储在 data/文件夹中(检查 cassandra.yaml 中的配置值 data_file_directories).您还可以检查 saved_caches_directorycommitlog_directory 配置.

All Cassandra data are stored in the data/ folder (check config value data_file_directories in cassandra.yaml). You may also check the saved_caches_directory and commitlog_directory config.

在数据文件夹中,您将拥有

Inside the data folder, you'll have

  1. 每个键空间一个文件夹

  1. One folder per keyspace

系统键空间的一个文件夹

One folder for system keyspace

一些用于身份验证等的文件夹.

Some folder for authentication etc..

在每个键空间文件夹中,您将拥有

Inside each keyspace folder, you'll have

*-Data.db 文件,其中包含您的真实数据

*-Data.db files which contain your real data

*-Filter.db 文件

*-Filter.db files

*-Index.db 文件用于索引

*-Index.db files for index

...

要复制数据,您需要对这些文件夹进行普通副本.

To replicate data, you do a plain copy of those folders.

在我们的团队中,运维人员使用 crontab 以这种方式安排定期备份 Cassandra 数据.

In our team, the ops use a crontab to schedule regular backup of Cassandra data this way.

注意:有时,您可能会错过仍在内存或内存表中且尚未刷新到磁盘的实时数据.您可以在备份数据文件之前触发完全压缩.但是完全压缩可能会损害您的性能,所以要小心

更好的答案:使用提供的工具为您的数据库拍摄快照:

Better answer: use the provided tool to take a snapshot of you DB:

http://www.datastax.com/docs/1.0/operations/backup_restore

这篇关于我应该如何复制集群中的键空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆