2014-01-15 123 views
1

我想將CSV批量上傳到cassandra 2.0.3中。 現在我已成功將CSV轉換爲sstables。批量將CSV導入到Cassandra 2.0.3中

但是,當我運行sstableloader時,出現如下錯誤消息。這個錯誤影響我的bulkload,因爲我沒有在cassandra 2.0.3中找到導入的數據。

VirtualBox:~/apache-cassandra-2.0.3$ ./bin/sstableloader -d localhost airlines/flight/ 
ERROR 16:08:04,832 Unable to initialize MemoryMeter (jamm not specified as javaagent). This means Cassandra will be unable to measure object sizes accurately and may consequently OOM. 
Established connection to initial hosts 
Opening sstables and calculating sections to stream 
Streaming relevant part of airlines/flight/airlines-flight-jb-1-Data.db to [/127.0.0.1, /127.0.0.2] 
progress: [/127.0.0.2 1/1 (100%)] [/127.0.0.1 1/1 (100%)] [total: 100% - 0MB/s (avg: 0MB/s)] 
+0

我有這個錯誤顯示,但正確的數據流。你加載了多少行(aprrox)? (看起來像你在做幾行,因爲速度爲0MB/s) –

回答

1

我將我的sstableloader作業包裝在bash腳本中,並且最初有完全相同的錯誤。 我做了一些挖掘,發現設置JAVA_TOOL_OPTIONS環境變量解決了我的問題。

這裏是我的腳本:

#!/bin/bash 

# ------------------------ 
# paths to the cassandra source tree, cassandra jar and java 
CASSANDRA_HOME="/usr/share/cassandra" 
JAVA_AGENT="-javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar" 
export JAVA_TOOL_OPTIONS=$JAVA_AGENT 
# ------------------------ 

# ------------------------ 
# Initialize Parameters 
SSTLOADER=`which sstableloader` 
SSDATADIR=/usr/share/cassandra/scripts/sstable_load/data/<schema_name>/<column family> 

CASSNODE="192.168.2.1" 

# ------------------------ 
log_dir=/usr/share/cassandra/scripts/sstable_load/logs 
dt=`date +'%Y%m%d_%H%M%S'` 
logdest=$log_dir/sstabloader_"$dt".log 
# ------------------------ 

exec 1>$logdest 
echo "Job Started: " `date` 
echo "Job Logged To: " $logdest 
echo 

# ------------------------ 
# Run the SSTableLoader Command 
$SSTLOADER -v -d $CASSNODE -u <user> -pw <password> $SSDATADIR 


echo 
echo "Job Completed: " `date` 

exit 0 

在<>替換腳本條目與你相應的信息。

希望這對你有用。

請投票。