![](/img/trans.png)
[英]com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table user"
[英]what should I do for “com.datastax.driver.core.exceptions.ReadTimeoutException”?
我在具有3個節點的Cassandra(2.1.11)集群中放置了將近190 million records
,並且復制因子為1
,然后我編寫了客戶端應用程序以使用datastax的Java Driver
對所有記錄進行計數,代碼段如下:
Statement stmt = new SimpleStatement("select * from test" );
System.out.println("starting to read records ");
stmt.setFetchSize(10000);
ResultSet rs = session.execute(stmt);
//System.out.println("rs.size " + rs.all().size());
long cntRecords = 0;
for(Row row : rs){
cntRecords++;
if(cntRecords % 10000000 == 0){
System.out.println("the " + cntRecords/10000000 + " X 10 millions of records");
}
}
在上面的變量cntRecords
超過3000萬之后,我總是得到異常:
Exception in thread "main" com.datastax.driver.core.exceptions.ReadTimeoutException:
Cassandra timeout during read query at consistency ONE (1 responses were required but only
0 replica responded)
我在google中得到了幾個結果,並更改了關於堆和GC的設置,以下是我的相對設置:
-XX:InitialHeapSize=17179869184
-XX:MaxHeapSize=17179869184
-XX:MaxNewSize=12884901888
-XX:MaxTenuringThreshold=1
-XX:NewSize=12884901888
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseCompressedOops
-XX:+UseConcMarkSweepGC
-XX:+UseCondCardMark
-XX:+UseGCLogFileRotation
-XX:+UseParNewGC
-XX:+UseTLAB
-XX:+UseThreadPriorities
-XX:+CMSClassUnloadingEnabled
並且我使用GCViewer分析了gc日志文件,吞吐量分別為99.95%,98.15%和95.75%。
更新開始:我使用jstat
監視三個節點之一,發現當S1
的值更改為100.00
我將迅速得到上述錯誤:
/usr/java/jdk1.7.0_80/bin/jstat -gcutil 8862 1000
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 100.00 28.57 36.29 74.66 55 14.612 2 0.164 14.776
並且一旦S1
更改為100.00
, S1
將不再減少,我不知道這是與錯誤有關的嗎? 還是應該為此設置cassandra.yaml
或cassandra-env.sh
什么屬性?
完成該任務以計算所有記錄該怎么辦? 提前致謝!
附加:以下是其他選項:
-XX:+CMSEdenChunksRecordAlways
-XX:CMSInitiatingOccupancyFraction=75
-XX:+CMSParallelInitialMarkEnabled
-XX:+CMSParallelRemarkEnabled
-XX:CMSWaitDuration=10000
-XX:CompileCommandFile=bin/../conf/hotspot_compiler
-XX:GCLogFileSize=94371840
-XX:+HeapDumpOnOutOfMemoryError
-XX:NumberOfGCLogFiles=90
-XX:OldPLABSize=16
-XX:PrintFLSStatistics=1
-XX:+PrintGC
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintHeapAtGC
-XX:+PrintPromotionFailure
-XX:+PrintTenuringDistribution
-XX:StringTableSize=1000003
-XX:SurvivorRatio=8
-XX:ThreadPriorityPolicy=42
-XX:ThreadStackSize=256
檢查為什么您需要知道行數。 您的應用程序真的需要知道這一點嗎? 如果它可以“近似”良好的近似值存活,則創建一個計數器,並在加載數據時對其進行遞增。
http://docs.datastax.com/en/cql/3.1/cql/cql_using/use_counter_t.html
您可以嘗試的事情:
*
。 這可能會降低GC壓力和網絡消耗。 最好選擇一個字節少且屬於主鍵的列: select column1 from test
cassandra.yaml
並增加range_request_timeout_in_ms
和read_request_timeout_in_ms
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.