Failed to created database error message while creating a database first time
bentcoder opened this issue · 4 comments
Hi,
I think there is some kind of bug when it comes to creating a database first time. The method below creates a database if doesn't exist and returns it. However, it exits with Failed to created database my_influx_db
error message. Funny enough after that my following requests work fine because the database actually exists! What would be the problem?
Thanks
Influx version: 1.5.3
public function getDatabase(string $name): \InfluxDB\Database
{
$client = new InfluxDB\Client('influxdb', 8086, 'influxdb', 'influxdb');
$database = $client->selectDB($name);
if (!$database->exists()) {
try {
$database->create(new RetentionPolicy($name, 'autogen', 1, true));
} catch (\InfluxDB\Database\Exception $e) {
exit($e->getMessage());
}
}
return $database;
}
Hello
<?php
require './vendor/autoload.php';
$client = new \InfluxDB\Client("localhost", 8086);
// select the database
$database = $client->selectDB('influx_test_db');
// create the database with a retention policy
$result = $database->create(new \InfluxDB\Database\RetentionPolicy('test', '5d', 1, true));
This is the code I am using.
InfluxDB version: "version": "1.5.2", "branch": "1.5", "commit": "02d7d4f043b34ecb4e9b2dbec298c6f9450c2a32"
SDK version: 1.14.7
And it just works. Can you provide more details about your setup?
Thanks
InfluxDB v1.5.3 (git: 1.5 89e084a80fb1e0bf5e7d38038e3367f821fdf3d7)
Also it is a docker container from influxdb:1.5.3
.
@gianarb I deleted my second post because it conflicts with the original one. First time database generation sometimes throws Failed to created database my_influx_db
exception although it creates the database.
Were you able to get some logs from InfluxDB about that failure?
Thanks