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

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

问题描述

我有一个键空间填充了生成昂贵的数据。我想在我的群集中的这个数据的两个副本。我想结束两个关键空间:让它们 mydata mydatabackup ,它们都包含相同的数据我不介意如果Cassandra时间戳不同)。



有没有一个简单的方法来做到这一点?我能找到一个答案最近的事情是使用sstable2json和json2sstable 建议响应一个类似问题?有更好的方法吗?

解决方案

有更好的方法吗?



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



p>


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

  2. 系统键空间的一个文件夹

  3. * - 包含真实数据的Data.db文件


  4. * - Filter.db文件

  5. db文件的索引

  6. ...

要复制数据,



在我们的团队中,ops使用crontab以这种方式安排Cassandra数据的定期备份。



注意:有时,您可能会遗漏仍在内存或memtable中的实时数据,而不能刷新到磁盘。您可以在备份数据文件之前触发完全压缩。






更好的答案:使用提供的工具您的快照DB:



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


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).

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?"

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. One folder per keyspace
  2. One folder for system keyspace
  3. Some folder for authentication etc..

    Inside each keyspace folder, you'll have

  4. *-Data.db files which contain your real data

  5. *-Filter.db files
  6. *-Index.db files for index
  7. ...

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

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

Note: sometimes, you may miss live data which are still in memory or in memtable and not flushed yet to disk. You can trigger a full compaction before backuping data files. But full compaction may hurt you perf so be careful


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天全站免登陆