【发布时间】:2015-06-23 21:08:10
【问题描述】:
我最近启动了一个包含 3 台机器的 Cassandra 集群。我让它一切正常,但是在我不得不重置其中一个节点(在这篇文章的底部解释)之后,我在读取最大的表之一时遇到了问题(见下面的跟踪)。
我认为我有一个非常明显的分区和集群键设置,并且在崩溃之前我没有遇到这个问题,所以我认为这不是问题。
CREATE TABLE datachannel_6min (
channel_id int,
time_start timestamp,
power_avg float,
power_min float,
power_max float,
energy float,
temperature_in float,
PRIMARY KEY (channel_id, time_start)
);
查询是使用复合键的单行选择。
select * from datachannel_6min where channel_id = 1028 order by time_start desc limit 1;
这里有 4 个痕迹示例……正如您所见,它们并不总是完全相同。
activity | timestamp | source | source_elapsed
--------------------------------------------------------------------------------------------------+--------------+----------+----------------
execute_cql3_query | 09:00:11,930 | 10.1.1.5 | 0
Parsing select * from datachannel_6min where channel_id = 1042 order by time_start desc limit 1; | 09:00:11,930 | 10.1.1.5 | 102
Preparing statement | 09:00:11,930 | 10.1.1.5 | 233
Executing single-partition query on datachannel_6min | 09:00:11,931 | 10.1.1.5 | 1135
Acquiring sstable references | 09:00:11,931 | 10.1.1.5 | 1163
Merging memtable tombstones | 09:00:11,931 | 10.1.1.5 | 1185
Key cache hit for sstable 14912 | 09:00:11,931 | 10.1.1.5 | 1223
Seeking to partition indexed section in data file | 09:00:11,931 | 10.1.1.5 | 1230
Key cache hit for sstable 14823 | 09:00:11,984 | 10.1.1.5 | 53805
Seeking to partition indexed section in data file | 09:00:11,984 | 10.1.1.5 | 53851
Key cache hit for sstable 14786 | 09:00:12,059 | 10.1.1.5 | 129027
Seeking to partition indexed section in data file | 09:00:12,059 | 10.1.1.5 | 129060
Key cache hit for sstable 14749 | 09:00:12,241 | 10.1.1.5 | 311521
Seeking to partition indexed section in data file | 09:00:12,241 | 10.1.1.5 | 311558
Key cache hit for sstable 14714 | 09:00:12,242 | 10.1.1.5 | 311843
Seeking to partition indexed section in data file | 09:00:12,242 | 10.1.1.5 | 311849
Partition index with 0 entries found for sstable 14913 | 09:00:12,242 | 10.1.1.5 | 312153
Seeking to partition indexed section in data file | 09:00:12,242 | 10.1.1.5 | 312159
Partition index with 0 entries found for sstable 14914 | 09:00:12,354 | 10.1.1.5 | 423820
Seeking to partition indexed section in data file | 09:00:12,354 | 10.1.1.5 | 423849
Partition index with 0 entries found for sstable 14916 | 09:00:12,354 | 10.1.1.5 | 424455
Seeking to partition indexed section in data file | 09:00:12,354 | 10.1.1.5 | 424463
Partition index with 0 entries found for sstable 14915 | 09:00:12,420 | 10.1.1.5 | 490468
Seeking to partition indexed section in data file | 09:00:12,420 | 10.1.1.5 | 490501
Partition index with 0 entries found for sstable 14917 | 09:00:12,492 | 10.1.1.5 | 561711
Seeking to partition indexed section in data file | 09:00:12,492 | 10.1.1.5 | 561748
Partition index with 146 entries found for sstable 14918 | 09:00:12,696 | 10.1.1.5 | 766248
Seeking to partition indexed section in data file | 09:00:12,696 | 10.1.1.5 | 766306
Skipped 0/11 non-slice-intersecting sstables, included 0 due to tombstones | 09:00:12,696 | 10.1.1.5 | 766323
Merging data from memtables and 11 sstables | 09:00:12,696 | 10.1.1.5 | 766329
Read 2 live and 0 tombstoned cells | 09:00:12,773 | 10.1.1.5 | 842632
Request complete | 09:00:12,773 | 10.1.1.5 | 843350
activity | timestamp | source | source_elapsed
--------------------------------------------------------------------------------------------------+--------------+----------+----------------
execute_cql3_query | 09:05:46,255 | 10.1.1.4 | 0
Message received from /10.1.1.4 | 09:05:46,250 | 10.1.1.5 | 21
Executing single-partition query on datachannel_6min | 09:05:46,250 | 10.1.1.5 | 520
Acquiring sstable references | 09:05:46,250 | 10.1.1.5 | 593
Merging memtable tombstones | 09:05:46,250 | 10.1.1.5 | 609
Bloom filter allows skipping sstable 14912 | 09:05:46,250 | 10.1.1.5 | 630
Bloom filter allows skipping sstable 14823 | 09:05:46,250 | 10.1.1.5 | 641
Bloom filter allows skipping sstable 14786 | 09:05:46,250 | 10.1.1.5 | 647
Bloom filter allows skipping sstable 14749 | 09:05:46,250 | 10.1.1.5 | 654
Bloom filter allows skipping sstable 14714 | 09:05:46,251 | 10.1.1.5 | 757
Bloom filter allows skipping sstable 14913 | 09:05:46,251 | 10.1.1.5 | 763
Bloom filter allows skipping sstable 14914 | 09:05:46,251 | 10.1.1.5 | 770
Bloom filter allows skipping sstable 14916 | 09:05:46,251 | 10.1.1.5 | 776
Bloom filter allows skipping sstable 14915 | 09:05:46,251 | 10.1.1.5 | 783
Bloom filter allows skipping sstable 14917 | 09:05:46,251 | 10.1.1.5 | 789
Parsing select * from datachannel_6min where channel_id = 1036 order by time_start desc limit 1; | 09:05:46,255 | 10.1.1.4 | 103
Preparing statement | 09:05:46,255 | 10.1.1.4 | 223
Sending message to /10.1.1.5 | 09:05:46,256 | 10.1.1.4 | 673
Partition index with 17 entries found for sstable 14918 | 09:05:46,534 | 10.1.1.5 | 283815
Seeking to partition indexed section in data file | 09:05:46,534 | 10.1.1.5 | 283851
Skipped 0/11 non-slice-intersecting sstables, included 0 due to tombstones | 09:05:46,534 | 10.1.1.5 | 283867
Merging data from memtables and 1 sstables | 09:05:46,534 | 10.1.1.5 | 283873
Read 2 live and 0 tombstoned cells | 09:05:46,571 | 10.1.1.5 | 321319
Enqueuing response to /10.1.1.4 | 09:05:46,571 | 10.1.1.5 | 321439
Sending message to /10.1.1.4 | 09:05:46,571 | 10.1.1.5 | 321613
Message received from /10.1.1.5 | 09:05:46,579 | 10.1.1.4 | 323621
Processing response from /10.1.1.5 | 09:05:46,579 | 10.1.1.4 | 323730
Request complete | 09:05:46,579 | 10.1.1.4 | 324458
activity | timestamp | source | source_elapsed
--------------------------------------------------------------------------------------------------+--------------+----------+----------------
execute_cql3_query | 05:39:12,430 | 10.1.1.4 | 0
Parsing select * from datachannel_6min where channel_id = 1030 order by time_start desc limit 1; | 05:39:12,430 | 10.1.1.4 | 164
Preparing statement | 05:39:12,430 | 10.1.1.4 | 310
Sending message to /10.1.1.6 | 05:39:12,431 | 10.1.1.4 | 829
Message received from /10.1.1.4 | 05:39:12,432 | 10.1.1.6 | 19
Executing single-partition query on datachannel_6min | 05:39:12,433 | 10.1.1.6 | 719
Acquiring sstable references | 05:39:12,433 | 10.1.1.6 | 742
Merging memtable tombstones | 05:39:12,433 | 10.1.1.6 | 769
Bloom filter allows skipping sstable 1476 | 05:39:12,433 | 10.1.1.6 | 830
Partition index with 0 entries found for sstable 1475 | 05:39:12,433 | 10.1.1.6 | 904
Seeking to partition indexed section in data file | 05:39:12,433 | 10.1.1.6 | 919
Partition index with 2 entries found for sstable 1346 | 05:39:12,434 | 10.1.1.6 | 1403
Seeking to partition indexed section in data file | 05:39:12,434 | 10.1.1.6 | 1425
Partition index with 2 entries found for sstable 1472 | 05:39:12,434 | 10.1.1.6 | 1511
Seeking to partition indexed section in data file | 05:39:12,434 | 10.1.1.6 | 1522
Partition index with 0 entries found for sstable 586 | 05:39:12,434 | 10.1.1.6 | 1567
Seeking to partition indexed section in data file | 05:39:12,434 | 10.1.1.6 | 1578
Partition index with 146 entries found for sstable 5 | 05:39:12,434 | 10.1.1.6 | 2132
Seeking to partition indexed section in data file | 05:39:12,434 | 10.1.1.6 | 2152
Skipped 0/6 non-slice-intersecting sstables, included 0 due to tombstones | 05:39:12,434 | 10.1.1.6 | 2177
Merging data from memtables and 5 sstables | 05:39:12,434 | 10.1.1.6 | 2192
Read 2 live and 0 tombstoned cells | 05:39:13,106 | 10.1.1.6 | 673858
Enqueuing response to /10.1.1.4 | 05:39:13,106 | 10.1.1.6 | 674163
Sending message to /10.1.1.4 | 05:39:13,107 | 10.1.1.6 | 674329
Message received from /10.1.1.6 | 05:39:13,107 | 10.1.1.4 | 676882
Processing response from /10.1.1.6 | 05:39:13,107 | 10.1.1.4 | 677118
Request complete | 05:39:13,107 | 10.1.1.4 | 677344
activity | timestamp | source | source_elapsed
--------------------------------------------------------------------------------------------------+--------------+----------+----------------
execute_cql3_query | 05:40:41,322 | 10.1.1.4 | 0
Parsing select * from datachannel_6min where channel_id = 1028 order by time_start desc limit 1; | 05:40:41,322 | 10.1.1.4 | 104
Preparing statement | 05:40:41,322 | 10.1.1.4 | 257
Sending message to /10.1.1.5 | 05:40:41,322 | 10.1.1.4 | 569
Message received from /10.1.1.4 | 05:40:41,324 | 10.1.1.5 | 9
Executing single-partition query on datachannel_6min | 05:40:41,324 | 10.1.1.5 | 401
Acquiring sstable references | 05:40:41,324 | 10.1.1.5 | 410
Merging memtable tombstones | 05:40:41,324 | 10.1.1.5 | 427
Bloom filter allows skipping sstable 15658 | 05:40:41,324 | 10.1.1.5 | 451
Bloom filter allows skipping sstable 15666 | 05:40:41,324 | 10.1.1.5 | 476
Bloom filter allows skipping sstable 15892 | 05:40:41,324 | 10.1.1.5 | 489
Bloom filter allows skipping sstable 15749 | 05:40:41,324 | 10.1.1.5 | 503
Bloom filter allows skipping sstable 15874 | 05:40:41,324 | 10.1.1.5 | 514
Bloom filter allows skipping sstable 15682 | 05:40:41,324 | 10.1.1.5 | 523
Partition index with 14 entries found for sstable 14918 | 05:40:42,152 | 10.1.1.5 | 828365
Seeking to partition indexed section in data file | 05:40:42,152 | 10.1.1.5 | 828406
Skipped 0/7 non-slice-intersecting sstables, included 0 due to tombstones | 05:40:42,152 | 10.1.1.5 | 828422
Merging data from memtables and 1 sstables | 05:40:42,152 | 10.1.1.5 | 828427
Read 2 live and 0 tombstoned cells | 05:40:42,300 | 10.1.1.5 | 976825
Enqueuing response to /10.1.1.4 | 05:40:42,301 | 10.1.1.5 | 976984
Message received from /10.1.1.5 | 05:40:42,301 | 10.1.1.4 | 978829
Sending message to /10.1.1.4 | 05:40:42,301 | 10.1.1.5 | 977105
Processing response from /10.1.1.5 | 05:40:42,301 | 10.1.1.4 | 979018
Request complete | 05:40:42,301 | 10.1.1.4 | 979239
这是我的集群的历史和我遇到的错误。
- 在西欧 Azure 数据中心的虚拟网络中安装了 3 个节点。我启动了将 API 记录到 Cassandra 的服务。 (约 10/s)。我启动了第二个服务,它使用添加的数据来计算新数据(这是使用上面选择的地方)
- 将旧数据(MSSQL 中的5 亿行)移至 Cassandra。在大约 3 天内将此与我的服务并行运行。
- [错误] 硬盘已满。我犯了一个愚蠢的错误,忘记为数据添加单独的磁盘。我在每台机器上安装了 4 个磁盘并将它们“合并”到一个(http://blog.metricshub.com/2012/12/27/running-cassandra-on-azure-step-by-step-gotcha-by-gotcha/)。我将日志和数据目录移动到所有三个节点上的新磁盘。其中两个节点运行良好,但第三个节点我必须彻底清理(删除数据/日志)。我的复制因子为 2,因此没有数据丢失。我在“新”节点上运行了 nodetool repair。
- 当我再次开始查询集群时,我注意到我的选择不一致。如果我在 Datastax Devcenter 中运行查询,我无法获得查询结果,但经过 3-5 次尝试后,我得到了完整回复。我将查询更改为使用 Quorom 而不是似乎可以解决问题的 ONE。
- 我还在两个好的节点上运行了 nodetool cleanup。
- 最后我在一个好的节点上运行 nodetool repair 并且现在也在最后一个节点上运行它(运行大约需要 1 天)。
【问题讨论】:
标签: cassandra