我正在尝试将数据从较小的Cassandra环迁移到更大的环。
我编写了一个脚本,用于从密钥空间收集SSTable,然后将SCP发送到一个实例,该实例使用sstableloader实用程序将它们流式传输到更大的环。
尝试将SSTables从较小的环导入较大的环时,我遇到了错误。 从异常的外观看,SSTables在某种程度上是腐败的或不兼容的。 有没有人对这个bug有任何见解?
以下是详细信息:
我在原始群集的每个节点上运行以下导出脚本:
#!/bin/bash
NODETOOL=$1
CASSDATA=$2
NODE=$3
KEYSPACE=$4
DESTINATION=$5
ORIG=$(pwd)
KEY="
-----BEGIN RSA PRIVATE KEY-----
A PRIVATE KEY GOES HERE
-----END RSA PRIVATE KEY-----"
echo "Flushing node.... \n"
$NODETOOL flush
echo "Compacting.... \n"
$NODETOOL compact
echo "Taring data and indexes.... \n"
cd $CASSDATA
find $KEYSPACE -type f \( -name \*\Data.db -o -name \*\Index.db \) -print0 | xargs -0 tar -czvf $ORIG/$KEYSPACE-$NODE.tar.gz
cd $ORIG
echo "SCP'ing files to destination."
echo "$KEY" > key.key
chmod 600 key.key
scp -i key.key $KEYSPACE-$NODE.tar.gz root@$DESTINATION:~/import
rm key.key
正如您所看到的,我刷新节点memtables,运行压缩然后查找所有数据和索引文件并将它们用于传输,然后将它们发送到运行sstableloader脚本的节点。
#!/bin/bash
SSTOOL=$1
KEYSPACE=$2
NODE=$3
ORIG=$(pwd)
tar -xzf $KEYSPACE-$NODE.tar.gz -C exportdir/$NODE
echo "Importing..."
cd exportdir/$NODE
$SSTOOL -v -d<IPADDRESS> $KEYSPACE/ColFam1
$SSTOOL -v -d<IPADDRESS> $KEYSPACE/ColFam2
cd $ORIG
echo "DONE"
当我在节点上运行脚本Cassandra时,请联系环并正确识别较大环中的所有目标实例。
Streaming revelant part of Msq/ColFam1-DATA.db to [<IP>,<IP>,<IP>]
然后立即失败并出现以下错误:
ERROR 15:49:54,672 Error in ThreadPoolExecutor
java.lang.RuntimeException: java.io.EOFException
at com.google.common.base.Throwables.propagate(Throwables.java:160)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.io.EOFException
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:416)
at org.apache.cassandra.streaming.FileStreamTask.write(FileStreamTask.java:217)
at org.apache.cassandra.streaming.FileStreamTask.stream(FileStreamTask.java:164)
at org.apache.cassandra.streaming.FileStreamTask.runMayThrow(FileStreamTask.java:91)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
... 3 more
Exception in thread "Streaming to <IP>:1" java.lang.RuntimeException: java.io.EOFException
at com.google.common.base.Throwables.propagate(Throwables.java:160)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.io.EOFException
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:416)
at org.apache.cassandra.streaming.FileStreamTask.write(FileStreamTask.java:217)
at org.apache.cassandra.streaming.FileStreamTask.stream(FileStreamTask.java:164)
at org.apache.cassandra.streaming.FileStreamTask.runMayThrow(FileStreamTask.java:91)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
... 3 more
对于较大环中的每个节点重复此消息。
就像这一样:
ERROR 15:49:54,789 Error in ThreadPoolExecutor
java.lang.IllegalArgumentException: unable to seek to position 6774 in /root/import/exportdir/2/KEYSPACE/ColFam1/KEYSPACE-ColFam1-ic-3-Data.db (6523 bytes) in read-only mode
at org.apache.cassandra.io.util.RandomAccessReader.seek(RandomAccessReader.java:306)
at org.apache.cassandra.streaming.FileStreamTask.stream(FileStreamTask.java:155)
at org.apache.cassandra.streaming.FileStreamTask.runMayThrow(FileStreamTask.java:91)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Exception in thread "Streaming to /10.182.178.228:1" java.lang.IllegalArgumentException: unable to seek to position 6774 in /root/import/exportdir/2/KEYSPACE/ColFam1/KEYSPACE-ColFam1-ic-3-Data.db (6523 bytes) in read-only mode
at org.apache.cassandra.io.util.RandomAccessReader.seek(RandomAccessReader.java:306)
at org.apache.cassandra.streaming.FileStreamTask.stream(FileStreamTask.java:155)
at org.apache.cassandra.streaming.FileStreamTask.runMayThrow(FileStreamTask.java:91)
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
每个环的日志文件是:
INFO [Thread-24] 2013-09-08 15:49:54,793 StreamInSession.java (line 136) Streaming of file KEYSPACE/ColFam1/KEYSPACE-COLFAM1-Data.db sections=20 progress=0/5673 - 0% for org.apache.cassandra.streaming.StreamInSession@386e5d failed: requesting a retry.
从这些日志行看起来,节点正确地相互闲聊,但我在文件解析时遇到错误。
某些路径/键空间/ col系列已在堆栈跟踪中进行了模糊处理。如果你能看到我的方法中的错误,请回答!
感谢。