docker 如何修复将Solr作为数据源添加到Grafana时的Bad Gateway错误?

inn6fuwd  于 2023-06-05  发布在  Docker
关注(0)|答案(1)|浏览(130)

我正在使用docker compose来启动nutch,solr和grafana的容器,但我无法将solr作为数据源添加到grafana中,我在solr中索引了数据,并希望将其添加到grafana中。当我在URL字段中添加http://localhost:8983/并试图保存和测试时,我一直收到Bad Gateway错误,我不知道如何解决这个问题。
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
我想将Solr与Grafana作为数据源连接起来,并在Grafana上将其可视化。

z3yyvxxp

z3yyvxxp1#

使用容器名称,而不是localhost,因为每个容器都有自己的localhost -http://solr:8983

相关问题