cassandra - 检查 Cassandra 中哪些表是空的
问题描述
我需要通过几个键空间检查 Cassandra 中哪些表是空的,并且有超过 20 个表。我可以对每张桌子进行计数,但这有点麻烦......
有没有办法在不输入所有 20 多个查询的情况下查看不同键空间中每个表的计数?如果有帮助,我会将表格放在逗号分隔的列表中。
编辑:我使用 python 来帮助解决这个问题,但对 Cassandra 解决方案感兴趣。
解决方案
您也可以在命令行级别尝试nodetool tablestats
:
» bin/nodetool tablestats stackoverflow | grep "Table\:\|partitions"
Table: cart_product
Number of partitions (estimate): 1
Table: keyvalue
Number of partitions (estimate): 0
Table: last_message_by_group
Number of partitions (estimate): 2
Table: mytable
Number of partitions (estimate): 5
Table: temps_by_item
Number of partitions (estimate): 2
Table: users
Number of partitions (estimate): 1
当然,这仅反映命令所在的节点。但是您应该能够通过此或tablestats
输出中可用的其他几个统计信息来确定表是否为空。
推荐阅读
- python - 嗨,我正在用 python 制作一个 2d 光线追踪器,如果对我的阴影系统有任何帮助,我将不胜感激
- visual-studio-code - 表情符号未显示在 VSCode 编辑器中
- angular - 从 Angular 11 更新到 12 时,MatSelect overlayDir 现在是私有的。我现在如何访问它?
- python - 如何使用正确的 sklearn 版本解开和适应机器学习
- c++ - 从暂停到播放时 Gstreamer 管道失败?
- python-3.x - 如何将 read_region 读取的 Tiff 文件图像的一部分再次转换为 Openslide 对象
- python - GPT 2 - TypeError:无法根据规则“安全”将数组数据从 dtype('O') 转换为 dtype('int64')
- reactjs - 在反应中根据用户角色显示组件
- mpi - 使用胖树架构的 HPC 进程数量增加导致速度下降
- angularjs - angularjs 1.6x - 一个接一个地运行http进程