微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Dockerized Neo4J 失败并显示“不支持的 uri 方案:http”

如何解决Dockerized Neo4J 失败并显示“不支持的 uri 方案:http”

我在对 Neo4J 数据库进行 dockerizing 时遇到了一些麻烦。


概要

我编写了一个 docker-compose 来启动一个使用 {neo4r} 和 {visNetwork} 的 shiny app。在本地,我使用专用 GUI 手动设置 Neo4J 数据库。然后,我可以使用我的应用程序轻松访问它,该应用程序通过 http 端口 7474 ping 并连接到 Neo4J。此时一切正常。

当我尝试对整个安装进行 dockerize 时,事情变得更难了。我的目标是能够将我的应用程序部署到无法访问 Neo4J GUI 的服务器上。

我开始编写 docker-compose.yml 文件(附后)以 1/ 设置 Neo4J DB 和 2/ 启动闪亮的应用程序。我获得了对闪亮应用程序的有效访问权限,但是一旦我 ping Neo4J DB(从应用程序或从我的浏览器),neo4j_sib 容器就会关闭,其状态变为“正在重新启动”。日志确实没有信息量,只有一个错误:“不支持的 URI 方案:http”。

{neo4r} 包仍在成熟中,但由于它在本地工作,我确实希望它在 dockerized 环境中工作。此外,R 闪亮部分运行很酷,所以我 99.99% 确定问题来自 Neo4J 容器定义的错误

如果您需要更多详细信息(或者我是否犯了明显错误),请随时告诉我。


注释和编辑

  • 我必须使用 http,因为 {neo4r} 需要它(而且我在本地这样做没有问题)。

附件

**(base) me@my-pc:~/path/to/shiny4cartosib$** docker-compose ps
             Name                            Command               State                 Ports               
-------------------------------------------------------------------------------------------------------------
neo4j_sib                         /sbin/tini -g -- /docker-e ...   Up      0.0.0.0:7473->7473/tcp,0.0.0.0:7474->7474/tcp,0.0.0.0:7687->7687/tcp            
shiny4cartosib_shiny4cartosib_1   /bin/sh -c R -e "options(' ...   Up      0.0.0.0:3838->3838/tcp   

/* Here I ping the Neo4J DB */

**(base) me@my-pc:~/path/to/shiny4cartosib$** docker-compose ps
             Name                            Command                 State              Ports         
------------------------------------------------------------------------------------------------------
neo4j_sib                         /sbin/tini -g -- /docker-e ...   Restarting                         
shiny4cartosib_shiny4cartosib_1   /bin/sh -c R -e "options(' ...   Up           0.0.0.0:3838->3838/tcp
**(base) me@my-pc:~/path/to/shiny4cartosib$** docker-compose logs
<truncated>
neo4j_sib         | Unsupported URI scheme: http

docker-compose.yml :

services:
  neo4j:
    image: neo4j:3.5.26
    restart: unless-stopped
    hostname: neo4j
    container_name: neo4j_sib
    ports:
      - 7474:7474 # HTTP -- only required by {neo4r}
      - 7473:7473 # HTTPS
      - 7687:7687 # bolt
    volumes:
      # import data
      - ./data-raw/import:/var/lib/neo4j/import
      # - ./logs:/logs
    environment: 
      # Install APOC library
      # - NEO4JLABS_PLUGINS='[\"apoc\"]'
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_apoc_export_file_enabled=true
      - NEO4J_apoc_uuid_enabled=true
      - NEO4J_dbms_security_procedure_unrestricted=apoc.*,algo.*
      - NEO4J_dbms_default__listen__address=0.0.0.0
      # Raise memory limits
      - NEO4J_dbms_memory_pagecache_size=1G
      - NEO4J_dbms.memory.heap.initial_size=1G
      - NEO4J_dbms_memory_heap_max__size=1G
      # Authentication setup
      - NEO4J_AUTH=neo4j/test
      # Debug method
      - NEO4J_dbms_logs_debug_level=DEBUG
    command: bash -c "
        cypher-shell -u neo4j -p test -a http://localhost:7474 "CREATE DATABASE SIF IF NOT EXISTS"
        cypher-shell -u neo4j -p test -a http://localhost:7474 "START DATABASE SIF"
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/export-node-application-csv.cypher
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/export-node-sif-csv.cypher   
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/referentiel-cd.cypher
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/export-node-donnees-csv.cypher
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/export-node-s-im-csv.cypher
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/export-node-organisme-csv.cypher
        cypher-shell -u neo4j -p test -a http://localhost:7474 -f ./cypher/export-relations-csv.cypher
      "
  shiny4cartosib:
    build: .
    image: shiny4cartosib:local
    ports:
      - "3838:3838"
    depends_on:
      - "neo4j"

# volumes:
#   import:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。