AzeemAhmed
AzeemAhmed

Reputation: 1

How can I fix the Bad Gateway error when adding Solr as a data source to Grafana?

I am using docker compose to start containers of nutch, solr and grafana but I am unable to add solr as data source in grafana, I have indexed data in solr and want to add this in grafana. When I am adding http://localhost:8983/ in URL field and trying to save and test I keep getting Bad Gateway error and I can’t figure out how to resolve this.

docker-compose.yml

version: '3.3'
services:
  solr:
    image: "solr:latest"
    ports:
     - "8983:8983"
    entrypoint:
      - sh
      - -c
      - |
        mkdir -p server/solr/configsets/nutch/
        docker-entrypoint.sh solr-precreate nutch
    volumes:
      - ./solr/data:/opt/solr/server/solr/configsets/nutch
      - ./nutch/schema.xml:/opt/solr/server/solr/configsets/nutch/conf/schema.xml
    networks:
      - solr-net
  
  nutch:
    image: "apache/nutch:latest"
    links:
      - solr
    environment: 
      - JAVA_HOME=/usr/lib/jvm/java-11-openjdk
    working_dir: /root/nutch_source
    entrypoint: 
      - sh
      - -c
      - |
        crawl -i -D solr.server.url=http://localhost:8983/solr/nutch -s urls crawl 10
    volumes:
        - ./nutch/exchanges.xml:/root/nutch_source/runtime/local/conf/exchanges.xml
        - ./nutch/index-writers.xml:/root/nutch_source/runtime/local/conf/index-writers.xml
        - ./nutch/nutch-site.xml:/root/nutch_source/runtime/local/conf/nutch-site.xml
        - ./nutch/regex-urlfilter.txt:/root/nutch_source/runtime/local/conf/regex-urlfilter.txt
        - ./nutch/seed.txt:/root/nutch_source/urls/seed.txt
    networks:
      - solr-net
  
  grafana:
    image: grafana/grafana:latest
    ports:
      - '3000:3000'
    command: 'plugins install pue-solr-datasource 1.0.3'
    #volumes:
    #  - ./grafana:/var/lib/grafana/plugins
    depends_on:
      - solr
    networks:
      - solr-net

networks:
  solr-net:

Solr Indexed Data

Grafana Error

I want to link Solr with Grafana as data source and visualize it on Grafana.

Upvotes: 0

Views: 138

Answers (1)

Jan Garaj
Jan Garaj

Reputation: 28716

Use container name, not a localhost, because each container has own localhost - http://solr:8983

Upvotes: 0

Related Questions