RNeoj:RStudio无法连接到neo4j数据库错误503显示

时间:2016-05-12 07:02:44

标签: r neo4j rstudio r-neo4j

如何让RStudio连接到Neo4j数据库?

问题:

尝试时会显示以下错误 使用 startGraph

通过RStudio连接到neo4j数据库

错误:      服务器错误:( 503 )服务不可用

#load library
library(RNeo4j)

#connect to graphdb
graph = startGraph("http://localhost:7474/db/data/")

(禁用dbm authentication [dbms.security.auth_enabled = false]) (也尝试启用身份验证(通过将db用户名和密码传递给startGraph),但是指示了相同的错误)

graph = startGraph("http://localhost:7474/db/data", 
         username="xxxx", password="xxxx")

初始设置检查:

确认Neo4j的成功安装和操作。

1.Database is started and running successfully via neo4j (3.0.1) console

2.Confirmed able to connect successfully via Chrome Browser

3.Confirmed able to create graph and conduct queries via Chrome Browser interface.

环境信息

    proxy is configured on system
    RNeo4j version 1.6.4
    RStudio V. 0.99.892
    R version 3.2.4 (2016-03-10)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 7 x64 (build 7601) Service Pack 1

其他详细信息

我对代理和RStudio创建和运行Shiny Apps或在系统上安装任何R软件包没有任何问题。

我执行了一个netstat来检查localhost端口上的连接,只有连接的应用程序是Neo4j和Web浏览器,而不是RStudio。 (一次打开这么多连接是否正常?)

d:\Windows\System32\drivers\etc>netstat -a -o -n  |grep :7474
  TCP    127.0.0.1:7474         0.0.0.0:0              LISTENING       15528
  TCP    127.0.0.1:7474         127.0.0.1:50884        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50885        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50886        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50888        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50889        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50898        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50899        TIME_WAIT       0
  TCP    127.0.0.1:7474         127.0.0.1:50913        ESTABLISHED     15528
  TCP    127.0.0.1:7474         127.0.0.1:50914        ESTABLISHED     15528
  TCP    127.0.0.1:7474         127.0.0.1:50915        ESTABLISHED     15528
  TCP    127.0.0.1:7474         127.0.0.1:50916        ESTABLISHED     15528
  TCP    127.0.0.1:7474         127.0.0.1:50917        ESTABLISHED     15528
  TCP    127.0.0.1:7474         127.0.0.1:50918        ESTABLISHED     15528
  TCP    127.0.0.1:50887        127.0.0.1:7474         TIME_WAIT       0
  TCP    127.0.0.1:50900        127.0.0.1:7474         TIME_WAIT       0
  TCP    127.0.0.1:50901        127.0.0.1:7474         TIME_WAIT       0
  TCP    127.0.0.1:50902        127.0.0.1:7474         TIME_WAIT       0
  TCP    127.0.0.1:50913        127.0.0.1:7474         ESTABLISHED     12356
  TCP    127.0.0.1:50914        127.0.0.1:7474         ESTABLISHED     12356
  TCP    127.0.0.1:50915        127.0.0.1:7474         ESTABLISHED     12356
  TCP    127.0.0.1:50916        127.0.0.1:7474         ESTABLISHED     12356
  TCP    127.0.0.1:50917        127.0.0.1:7474         ESTABLISHED     12356
  TCP    127.0.0.1:50918        127.0.0.1:7474         ESTABLISHED     12356

1 个答案:

答案 0 :(得分:0)

我能够绕过localhost的代理成功执行startGraph。

步骤

1.我首先使用[noproxy]选项在Windows命令提示符下使用curl解决问题,以便成功完成(验证这是正常的):

curl -v --noproxy localhost, http://localhost:7474/db/data/

2.然后在RStudio控制台,我设置我的httr配置(因为它是相同的底层curl接口),通过执​​行以下操作来使用[noproxy]选项:

rstudio_console>set_config(config(noproxy = "localhost"))  #set noproxy option

rstudio_console>set_config(config(verbose()))      #set verbose to view http messages

3.然后执行没有选项的startGraph:

rstudio_console>> graph = startGraph("http://localhost:7474/db/data")

4.Voila成功:

rstudio_console> graph 

< Graph > 

$version
[1] "3.0.1"