【发布时间】:2017-10-30 19:01:47
【问题描述】:
我正在使用 Aerospike 3.12.1.1 和 Java 4 客户端。
Aerospike 命名空间配置为在内存中。我的意图是使用 20 个并行线程将 1 亿个整数写入内存单 bin 命名空间,其中每个线程写入 500 万个。
在编写了大约 7500 万条记录后,我在客户端遇到了以下异常。下面给出了冷的 sn-p。请帮忙。
Exception in thread "pool-1-thread-15" com.aerospike.client.AerospikeException$InvalidNode: Error Code -3: Invalid node
at com.aerospike.client.cluster.Cluster.getRandomNode(Cluster.java:717)
at com.aerospike.client.command.Command.getSequenceNode(Command.java:1050)
at com.aerospike.client.command.Command.getNode(Command.java:1020)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:61)
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:360)
at Write.run(Write.java:50)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
import com.aerospike.client.AerospikeClient;
import com.aerospike.client.Host;
import com.aerospike.client.policy.ClientPolicy;
import com.aerospike.client.Bin;
import com.aerospike.client.Key;
import com.aerospike.client.Record;
import java.io.*;
public class Write implements Runnable{
int start;
int count;
int end;
private long unixTime;
private long timeTaken;
private long totalTimeTaken;
private long totalRequests;
private long minLatency;
private long maxLatency;
private double avgLatency;
private FileOutputStream out;
public Write(int s, int c){
this.start = s;
this.count = c;
this.end = this.count;
this.totalTimeTaken = 0;
this.totalRequests = 0;
this.minLatency = 1000000;
this.maxLatency = 0;
//try{
// this.out = new FileOutputStream("output.txt");
//}catch(Exception e){
//}
}
public void run(){
Host[] hosts = new Host[] {
new Host("127.0.0.1", 3000),
};
AerospikeClient client = new AerospikeClient(new ClientPolicy(), hosts);
for(int k=this.start; k<=(this.end); k++){
Key key = new Key("mem", null, k);
Bin bin1 = new Bin("m", k+count);
Bin bin2 = new Bin("n", k+count);
Bin bin3 = new Bin("b", k+count);
//Bin bin = Bin.asNull("b");
unixTime = System.nanoTime();
client.put(null, key, bin1, bin2, bin3);
timeTaken = System.nanoTime() - unixTime;
totalTimeTaken += timeTaken;
if(timeTaken < minLatency){
minLatency = timeTaken;
}
if(timeTaken > maxLatency){
maxLatency = timeTaken;
}
totalRequests ++;
}
avgLatency = totalTimeTaken / totalRequests;
System.out.println("TotalReqs:" + totalRequests + " TotalTime:" + totalTimeTaken + " MinLatency:" + ((float)minLatency/1000000.0) + " MaxLatency:" + ((float)maxLatency/1000000.0) + " AvgLatency:" + ((float)avgLatency/1000000.0));
}
}
【问题讨论】:
-
日志服务器端说什么?
-
@Meher 感谢您的回复。我在服务器日志中没有看到任何警告或错误。
标签: aerospike