@@ -29,7 +29,7 @@ String dbName = "aTimeSeries";
29
29
influxDB. query(new Query (" CREATE DATABASE " + dbName));
30
30
influxDB. setDatabase(dbName);
31
31
String rpName = " aRetentionPolicy" ;
32
- influxDB. createRetentionPolicy( rpName, dbName, " 30d " , " 30m " , 2 , true );
32
+ influxDB. query( new Query ( " CREATE RETENTION POLICY " + rpName + " ON " + dbName + " DURATION 30h REPLICATION 2 SHARD DURATION 30m DEFAULT " ) );
33
33
influxDB. setRetentionPolicy(rpName);
34
34
35
35
influxDB. enableBatch(BatchOptions . DEFAULTS );
@@ -49,7 +49,7 @@ influxDB.write(Point.measurement("disk")
49
49
50
50
Query query = new Query (" SELECT idle FROM cpu" , dbName);
51
51
influxDB. query(query);
52
- influxDB. dropRetentionPolicy( rpName, dbName);
52
+ influxDB. query( new Query ( " DROP RETENTION POLICY " + rpName + " ON " + dbName) );
53
53
influxDB. query(new Query (" DROP DATABASE " + dbName));
54
54
influxDB. close();
55
55
```
@@ -88,7 +88,7 @@ InfluxDB influxDB = InfluxDBFactory.connect("http://172.17.0.2:8086", "root", "r
88
88
String dbName = " aTimeSeries" ;
89
89
influxDB. query(new Query (" CREATE DATABASE " + dbName));
90
90
String rpName = " aRetentionPolicy" ;
91
- influxDB. createRetentionPolicy( rpName, dbName, " 30d " , " 30m " , 2 , true );
91
+ influxDB. query( new Query ( " CREATE RETENTION POLICY " + rpName + " ON " + dbName + " DURATION 30h REPLICATION 2 SHARD DURATION 30m DEFAULT " ) );
92
92
93
93
// Flush every 2000 Points, at least every 100ms
94
94
influxDB. enableBatch(BatchOptions . DEFAULTS. actions(2000 ). flushDuration(100 ));
@@ -109,7 +109,7 @@ influxDB.write(dbName, rpName, point1);
109
109
influxDB. write(dbName, rpName, point2);
110
110
Query query = new Query (" SELECT idle FROM cpu" , dbName);
111
111
influxDB. query(query);
112
- influxDB. dropRetentionPolicy( rpName, dbName);
112
+ influxDB. query( new Query ( " DROP RETENTION POLICY " + rpName + " ON " + dbName) );
113
113
influxDB. query(new Query (" DROP DATABASE " + dbName));
114
114
influxDB. close();
115
115
```
@@ -123,7 +123,7 @@ InfluxDB influxDB = InfluxDBFactory.connect("http://172.17.0.2:8086", "root", "r
123
123
String dbName = " aTimeSeries" ;
124
124
influxDB. query(new Query (" CREATE DATABASE " + dbName));
125
125
String rpName = " aRetentionPolicy" ;
126
- influxDB. createRetentionPolicy( rpName, dbName, " 30d " , " 30m " , 2 , true );
126
+ influxDB. query( new Query ( " CREATE RETENTION POLICY " + rpName + " ON " + dbName + " DURATION 30h REPLICATION 2 DEFAULT " ) );
127
127
128
128
BatchPoints batchPoints = BatchPoints
129
129
.database(dbName)
@@ -147,7 +147,7 @@ batchPoints.point(point2);
147
147
influxDB. write(batchPoints);
148
148
Query query = new Query (" SELECT idle FROM cpu" , dbName);
149
149
influxDB. query(query);
150
- influxDB. dropRetentionPolicy( rpName, dbName);
150
+ influxDB. query( new Query ( " DROP RETENTION POLICY " + rpName + " ON " + dbName) );
151
151
influxDB. query(new Query (" DROP DATABASE " + dbName));
152
152
```
153
153
0 commit comments