部分伪代码 @Override public void insert() { WriteApi writeApi = influxDBClient.makeWriteApi(); for (int i = 0; i < 10000; i++) { Demo demo = new Demo(); demo.setTime(Instant.now());
writeApi.writeMeasurement("s100", "d", WritePrecision.NS, demo);
}
} 如果每插入一条休眠 1s ,那么可以全部插入数据不丢失 @Override public void insert() { WriteApi writeApi = influxDBClient.makeWriteApi(); for (int i = 0; i < 10000; i++) { Demo demo = new Demo(); demo.setTime(Instant.now());
writeApi.writeMeasurement("s100", "d", WritePrecision.NS, demo);
try {
Thread.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
} influxdb 安装在虚拟机中 4C16G ,不清楚是自己哪里出了问题
1
futaotao5866 OP 问题已经定位解决,时间问题
|