influxdb - java
来源:趣味经验馆 2.53W
<link rel="stylesheet" href="https://js.how234.com/third-party/SyntaxHighlighter/shCoreDefault.css" type="text/css" /><script type="text/javascript" src="https://js.how234.com/third-party/SyntaxHighlighter/shCore.js"></script><script type="text/javascript"> SyntaxHighlighter.all(); </script>
influxdb java是什么,让我们一起了解一下?
influxdb是一个开源分布式时序、事件和指标数据库。使用 Go 语言编写,无需外部依赖,其设计目标是实现分布式和水平伸缩扩展,在java中有大数据量存储的广泛应用。
那么问题来了,如何储存应用?
存储策略如下:
1、长期数据。
String commandLong = String.format("CREATE RETENTION POLICY "%s" ON "%s" DURATION %s REPLICATION %s DEFAULT", keyPolicy, keyDataBase, "1300w", 1); //25年 一年有52周,52*25 =1300w this.query(commandLong,keyDataBase);
2、 短期数据。
String command = String.format("CREATE RETENTION POLICY "%s" ON "%s" DURATION %s REPLICATION %s DEFAULT", rtPolicy, rtDataBase, "30d", 1); //30天 this.query(command,rtDataBase);
因此分为两种策略,分别设置为长期数据库和短期数据库的默认存储策略。