在生产最佳实践中改变 Cassandra Compression,nodetool upgradesstables 是首选吗?
Altering Cassandra Compression at production best practices, is nodetool upgradesstables preferred?
我们有一个 cassandra 密钥空间,它有 2 个生产表。我们已将其压缩策略从 LZ4Compressor
(默认)更改为 DeflateCompressor
正在使用
ALTER TABLE "Keyspace"."TableName" WITH compression = {'class': 'DeflateCompressor'};
因为我的 cassandra 5 节点集群的每个节点都有大约 300 GB 的数据,复制因子为 2。是
nodetool upgradesstables
建议或不作为最佳做法。
来自我们已阅读的所有来源
If necessary
我可以使用 nodetool upgradesstables 命令。但我想知道 实际上什么是最佳实践 因为我们的数据在生产中?
来源:
When you add compression to an existing column family, existing SSTables on disk are not
compressed immediately. Any new SSTables that are created will be compressed, and any existing SSTables will be
compressed during the normal Cassandra compaction process. If necessary, you can force existing SSTables to be
rewritten and compressed by using nodetool upgradesstables (Cassandra 1.0.4 or later) or nodetool scrub
所有节点完成后upgradesstables
我的 cassandra 日志中没有遇到大量异常
更新 - 在 运行 upgradesstables
之后,现在我的集群抛出了很多错误
样本
`
ERROR [ReadRepairStage:74899] 2018-04-08 14:50:09,779
CassandraDaemon.java:229 - Exception in thread
Thread[ReadRepairStage:74899,5,main]
org.apache.cassandra.exceptions.ReadTimeoutException: Operation timed
out - received only 0 responses. at
org.apache.cassandra.service.DataResolver$RepairMergeListener.close(DataResolver.java:171)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.db.partitions.UnfilteredPartitionIterators.close(UnfilteredPartitionIterators.java:182)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.db.transform.BaseIterator.close(BaseIterator.java:82)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.service.DataResolver.compareResponses(DataResolver.java:89)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.service.AsyncRepairCallback.runMayThrow(AsyncRepairCallback.java:50)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
~[apache-cassandra-3.10.jar:3.10] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
~[na:1.8.0_144] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
~[na:1.8.0_144] at
org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator[=18=](NamedThreadFactory.java:79)
~[apache-cassandra-3.10.jar:3.10] at
java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_144] EBUG
[ReadRepairStage:74889] 2018-04-08 14:50:07,777 ReadCallback.java:242
- Digest mismatch: org.apache.cassandra.service.DigestMismatchException: Mismatch for key
DecoratedKey(1013727261649388230, 715cb15cc5624c5a930ddfce290a690b)
(d728e9a275616b0e05a0cd1b03bd9ef6 vs d41d8cd98f00b204e9800998ecf8427e)
at
org.apache.cassandra.service.DigestResolver.compareResponses(DigestResolver.java:92)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.service.ReadCallback$AsyncRepairRunner.run(ReadCallback.java:233)
~[apache-cassandra-3.10.jar:3.10] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[na:1.8.0_144] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[na:1.8.0_144] at
org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator[=18=](NamedThreadFactory.java:79)
[apache-cassandra-3.10.jar:3.10] at
java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_144] DEBUG
[GossipStage:1] 2018-04-08 14:50:08,490 FailureDetector.java:457 -
Ignoring interval time of 2000213620 for /10.196.22.208 DEBUG
[ReadRepairStage:74899] 2018-04-08 14:50:09,778 DataResolver.java:169
- Timeout while read-repairing after receiving all 1 data and digest responses ERROR [ReadRepairStage:74899] 2018-04-08 14:50:09,779
CassandraDaemon.java:229 - Exception in thread
Thread[ReadRepairStage:74899,5,main]
org.apache.cassandra.exceptions.ReadTimeoutException: Operation timed
out - received only 0 responses. at
org.apache.cassandra.service.DataResolver$RepairMergeListener.close(DataResolver.java:171)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.db.partitions.UnfilteredPartitionIterators.close(UnfilteredPartitionIterators.java:182)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.db.transform.BaseIterator.close(BaseIterator.java:82)
~[apache-cassandra-3.10.jar:3.10] at
org.apache.cassandra.service.DataResolver.compareResponses(DataResolver.java:89)
~[apache-cassandra-3.10.jar:3.10]`
当您使用 nodetool upgradesstables
时,它会从现有但使用您指定的新选项写入新的 SSTable。这是 IO-intensive 可能会影响集群性能的过程,因此您需要相应地进行规划。您还需要有足够的磁盘 space 来执行此操作。此命令还应 运行 作为 运行s Cassandra 的同一用户。
这真的取决于你的需求——如果不紧急,你可以简单地等到正常的压缩发生,然后数据就会re-compressed。
我们有一个 cassandra 密钥空间,它有 2 个生产表。我们已将其压缩策略从 LZ4Compressor
(默认)更改为 DeflateCompressor
正在使用
ALTER TABLE "Keyspace"."TableName" WITH compression = {'class': 'DeflateCompressor'};
因为我的 cassandra 5 节点集群的每个节点都有大约 300 GB 的数据,复制因子为 2。是
nodetool upgradesstables
建议或不作为最佳做法。
来自我们已阅读的所有来源
If necessary
我可以使用 nodetool upgradesstables 命令。但我想知道 实际上什么是最佳实践 因为我们的数据在生产中?
来源:
When you add compression to an existing column family, existing SSTables on disk are not compressed immediately. Any new SSTables that are created will be compressed, and any existing SSTables will be compressed during the normal Cassandra compaction process. If necessary, you can force existing SSTables to be rewritten and compressed by using nodetool upgradesstables (Cassandra 1.0.4 or later) or nodetool scrub
所有节点完成后upgradesstables
我的 cassandra 日志中没有遇到大量异常
更新 - 在 运行 upgradesstables
之后,现在我的集群抛出了很多错误
样本 `
ERROR [ReadRepairStage:74899] 2018-04-08 14:50:09,779 CassandraDaemon.java:229 - Exception in thread Thread[ReadRepairStage:74899,5,main] org.apache.cassandra.exceptions.ReadTimeoutException: Operation timed out - received only 0 responses. at org.apache.cassandra.service.DataResolver$RepairMergeListener.close(DataResolver.java:171) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.db.partitions.UnfilteredPartitionIterators.close(UnfilteredPartitionIterators.java:182) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.db.transform.BaseIterator.close(BaseIterator.java:82) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.service.DataResolver.compareResponses(DataResolver.java:89) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.service.AsyncRepairCallback.runMayThrow(AsyncRepairCallback.java:50) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[apache-cassandra-3.10.jar:3.10] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_144] at org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator[=18=](NamedThreadFactory.java:79) ~[apache-cassandra-3.10.jar:3.10] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_144] EBUG [ReadRepairStage:74889] 2018-04-08 14:50:07,777 ReadCallback.java:242 - Digest mismatch: org.apache.cassandra.service.DigestMismatchException: Mismatch for key DecoratedKey(1013727261649388230, 715cb15cc5624c5a930ddfce290a690b) (d728e9a275616b0e05a0cd1b03bd9ef6 vs d41d8cd98f00b204e9800998ecf8427e) at org.apache.cassandra.service.DigestResolver.compareResponses(DigestResolver.java:92) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.service.ReadCallback$AsyncRepairRunner.run(ReadCallback.java:233) ~[apache-cassandra-3.10.jar:3.10] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144] at org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator[=18=](NamedThreadFactory.java:79) [apache-cassandra-3.10.jar:3.10] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_144] DEBUG [GossipStage:1] 2018-04-08 14:50:08,490 FailureDetector.java:457 - Ignoring interval time of 2000213620 for /10.196.22.208 DEBUG [ReadRepairStage:74899] 2018-04-08 14:50:09,778 DataResolver.java:169 - Timeout while read-repairing after receiving all 1 data and digest responses ERROR [ReadRepairStage:74899] 2018-04-08 14:50:09,779 CassandraDaemon.java:229 - Exception in thread Thread[ReadRepairStage:74899,5,main] org.apache.cassandra.exceptions.ReadTimeoutException: Operation timed out - received only 0 responses. at org.apache.cassandra.service.DataResolver$RepairMergeListener.close(DataResolver.java:171) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.db.partitions.UnfilteredPartitionIterators.close(UnfilteredPartitionIterators.java:182) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.db.transform.BaseIterator.close(BaseIterator.java:82) ~[apache-cassandra-3.10.jar:3.10] at org.apache.cassandra.service.DataResolver.compareResponses(DataResolver.java:89) ~[apache-cassandra-3.10.jar:3.10]`
当您使用 nodetool upgradesstables
时,它会从现有但使用您指定的新选项写入新的 SSTable。这是 IO-intensive 可能会影响集群性能的过程,因此您需要相应地进行规划。您还需要有足够的磁盘 space 来执行此操作。此命令还应 运行 作为 运行s Cassandra 的同一用户。
这真的取决于你的需求——如果不紧急,你可以简单地等到正常的压缩发生,然后数据就会re-compressed。