Error "io.questdb.cairo.CairoException: [2] could not open read-write [file=<dir>/_tab_index.d]"

131 Views Asked by At

Currently, I am testing QuestDB in a Apache Camel / Spring Boot scenario for our project. I set up a custom Camel component and a configuration bean holding the connection properties. As far as I can see, my custom Camel component properly connects to the server where a test instance of QuestDB is running. But when sending data over the Camel route, I get error messages:

io.questdb.cairo.CairoException: [2] could not open read-write [file=<dir>/_tab_index.d]

The exception is thrown when creating the CairoEngine like (taken from QuestDB API documentation:

try (CairoEngine engine = new CairoEngine(this.configuration)) {
        ... other code ...
} catch (Exception e) {
        e.printStackTrace();
        ...
}

where this.configuration is of type CairoConfiguration and contains the "data_dir" and is instantiated like this:

configuration = new DefaultCairoConfiguration(<quest db directory (String)>);  

Currently, I am passing the fully qualified path my database directory: /srv/questdb/db. I confirmed that the file _tab_index.d is available at this location.

What am I going wrong? Maybe I should mention, that I set the access rights to the questdb directory to 777, the owner was set to chown root:questdb ...

1

There are 1 best solutions below

1
On

Indeed, the embedded API is not suitable for what I want to do. I need to one of the other APIs. I tested my scenario withe the InfluxDB line protocol (see Line protocol documentation) and the data gets written to the server without problems.

The doInsert method in my custom component look like this (just for testing) which is called when building a route with the custom QuestDB "to" end point:

public class QuestDbProducer extends DefaultProducer {

    ... other code ...

    private void doInsert(Exchange exchange, String tableName) throws InvalidPayloadException {

         try (Sender sender = Sender.builder().address("lxyrpc01.gsi.de:9009").build()) {
            sender.table("inventors")
                .symbol("born", "Austrian Empire")
                .longColumn("id", 0)
                .stringColumn("name", "Nicola Tesla")
                .atNow();
            sender.table("inventors")
                .symbol("born", "USA")
                .longColumn("id", 1)
                .stringColumn("name", "Thomas Alva Edison")
                .atNow();
        } 
    }