每 10 分钟将数据从一个 table 加载到另一个 - Cassandra

Load data from one table to another every 10 mins - Cassandra

我们每 10 分钟就有一个数据流 Table A。没有保存历史。每次在 Table A 中加载数据时,现有数据都必须刷新到新的 table B。这可以在 Cassandra 中动态或自动完成吗?

我可以考虑将 Table A 加载到 CSV 文件中,然后在每次刷新 Table A 时加载回 Table B。但我想在数据库级别本身做一些事情。 任何想法或建议表示赞赏。

谢谢, 阿伦

对于少量数据,您可以将其放入 cron:

https://dba.stackexchange.com/questions/58901/what-is-a-good-way-to-copy-data-from-one-cassandra-columnfamily-to-another-on-th

如果更大且 运行 更新版本的 cassandra (3.8+)

http://cassandra.apache.org/doc/latest/operating/cdc.html https://issues.apache.org/jira/browse/CASSANDRA-8844

然后将数据重播到您需要的 table(通过某种外部进程、脚本、应用程序等...)。

基本上已经有一些工具了,比如: https://github.com/carloscm/cassandra-commitlog-extract

您可以使用那里的示例来涵盖您的用例。

但对于大多数用例,这是在应用程序级别处理的,使用 cassandra 写入相对便宜。