influxdbclient support library for the r2d2 connection pool.
Add to Cargo.toml
:
influx_db_client = "0.3.6"
r2d2 = "0.8"
r2d2-influx_db_client = "0.1.0"
```rust use std::time::Duration;
use r2d2influxdb_client::{Authentication, InfluxDbConnectionManager};
fn main() { let conmgr = InfluxDbConnectionManager::new("localhost", 8086, "tutorial"); let pool = r2d2::Pool::builder() .connectiontimeout(Duration::fromsecs(1)) .testoncheckout(true) .maxsize(15) .build(connectionmanager) .expect("Pool");
// Use pool...
} ```