grafanafiwarefiware-orioncratedb

What can be the reason why I can't connect to CateDB with grafana and locally with Dbeaver?


Cheers I am currently trying to reproduce the tutorial to develop an application / solution with Fiware seen in: Desarrolla tu primer aplicación en Fiware and I am having difficulty connecting Grafana with the Crate database (recommended by Fiware).

My docker-compose file configuration is:

version: "3.5"

services:

  orion:
    image: fiware/orion
    hostname: orion
    container_name: fiware-orion
    networks:
      - fiware_network
    depends_on:
      - mongo-db
    ports:
      - "1026:1026"
    command: -dbhost mongo-db -logLevel DEBUG -noCache

  mongo-db:
    image: mongo:3.6
    hostname: mongo-db
    container_name: db-mongo
    networks:
      - fiware_network
    ports:
      - "27017:27017" 
    command: --bind_ip_all --smallfiles
    volumes:
      - mongo-db:/data

  grafana:
    image: grafana/grafana:8.2.6
    container_name: fiware-grafana
    networks:
      - fiware_network
    ports:
      - "3000:3000"
    depends_on:
      - crate

  quantumleap:
    image: fiware/quantum-leap
    container_name: fiware-quantumleap
    networks:
      - fiware_network
    ports:
      - "8668:8668"
    depends_on:
      - mongo-db
      - orion
      - crate
    environment:
      - CRATE_HOST=crate

  crate:
    image: crate:1.0.5
    networks:
      - fiware_network
    ports:
      # Admin UI
      - "4200:4200"
      # Transport protocol
      - "4300:4300"
    command: -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
    volumes:
      - cratedata:/data

volumes:
  mongo-db:
  cratedata:

networks:                                
  fiware_network:                               
    driver: bridge    

After starting the containers, I have a positive response from OCB (Orion), from Quantumleap and even after creating the subscription between Orion and quantumleap, in the Crate database, the data is stored and updated correctly.

Unfortunately I am not able to get the visualization of the data in grafana.

I thought that the reason was the fact that crateDB was removed as a grafana plugin versions ago, but after researching how to connect crateDB with grafana, through a postgres data source (I read on: Visualizing time series data with Grafana and CrateDB), I'm still having difficulty getting the connection, getting in grafana "Query error dbquery error: EOF"

grafana settings img

The difference with respect to the guide is the listening port, since with input port 5432 I get a response indicating that it is not possible to connect to the server. I'm using port 4300.

After configuring, and trying to query from grafana, I get the mentioned EOF error

EOF error in grafana img

I tried to connect from a database IDE (Dbeaver) and I get exactly the same problem.

EOF error in Dbeaver img

Is there something I am missing? What should I change in my docker configuration, or ports, or anything else to fix this?

I think it is worth mentioning that I am studying this because I am being asked in a project to visualize context switches in real time with Fiware and grafana.

Thanks in advance


Solution

  • The PostgreSQL port 5432 must be exposed as well by the CrateDB docker image.

    Additionally, I highly recommend to use a recent (or just the latest) CrateDB version, current stable is 5.0.0, your used version 1.0.5 is very old and not maintained anymore.

    Full example entry:

      crate:
        image: crate:latest
        networks:
          - fiware_network
        ports:
          # Admin UI
          - "4200:4200"
          # Transport protocol
          - "4300:4300"
          # PostgreSQL protocol
          - "5432:5432"
        command: -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
        volumes:
          - cratedata:/data