[英]Cannot set up connection to local database in MonetDB.R
The title summarizes my problem, I think. 我认为标题概括了我的问题。 I'd appreciate any pointers anybody might have on what else I could try.
我会很感激任何人对我还能尝试的其他事项的指导。 I've pasted the console output with comments in bold below.
我在控制台输出中粘贴了下面以粗体显示的注释。 Theinstalled version of MonetDB.R is the latest from R-forge (0.8.5).
MonetDB.R的安装版本是R-forge(0.8.5)的最新版本。
fabians@wap27:~$ R
[...]
> library(MonetDB.R)
Loading required package: DBI
Loading required package: digest
Attaching package: ‘MonetDB.R’
The following objects are masked from ‘package:stats’:
sd, var
The following objects are masked from ‘package:base’:
sample, tabulate
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] MonetDB.R_0.8.5 digest_0.6.3 DBI_0.2-7
>
> # as @ https://github.com/ajdamico/usgsd/tree/master/MonetDB:
> batfile <- monetdb.server.setup(
+ database.directory = "~/monetdb",
+ monetdb.program.path = "/usr",
+ dbname = "test",
+ dbport = 50000L)
/home/fabians/monetdb did not exist. now it does
seems to have worked... 似乎奏效了...
>
> batfile <- "/home/fabians/monetdb/test.sh"
> system(paste("cat ", batfile))
#!/bin/sh
/usr/bin/mserver5 --set prefix=/usr --set exec_prefix=/usr --dbpath /home/fabians/monetdb/test --set mapi_port=50000 --daemon yes > /dev/null &
echo $! > /home/fabians/monetdb/mserver5.started.from.R.pid
Can anybody tell me whether that shell script looks like it's supposed to? 谁能告诉我该shell脚本是否看起来像应该的样子?
> system(paste("ls ~/monetdb"))
test test.sh
OK, so an (empty) 'test'-directory was created along with the .sh 确定,因此创建了一个(空)“ test”目录以及.sh
> monetpid <- monetdb.server.start(batfile)
Read 1 item
> system(paste("ls ~/monetdb/test"))
00e3bc31-ca59-43e6-ace8-a96aac37bddd bat box
Now after starting the monetdb server the test directory contains the data base info, I guess? 现在,启动monetdb服务器后,测试目录包含数据库信息,我猜呢?
> dbname <- "test"
> dbport <- 50000L
> monet.url <- paste0("monetdb://localhost/", dbname)
> db <- dbConnect( MonetDB.R(), monet.url,
+ port=as.integer(dbport), timeout=as.integer(86400))
Error in .monetAuthenticate(socket, dbname, user, password) :
Authentication error: !monetdbd: no such database 'test', please create it first
What could be the reason that the test-directory is not found? 找不到测试目录的原因可能是什么?
Slightly different command, as in the help for monetdb.server.start
and also at https://github.com/ajdamico/usgsd/tree/master/MonetDB
: 稍有不同的命令,如
monetdb.server.start
的帮助以及https://github.com/ajdamico/usgsd/tree/master/MonetDB
的帮助:
> monet.url <- paste0("monetdb://localhost:", dbport, "/", dbname)
> db <- dbConnect( MonetDB.R(), monet.url, wait = TRUE )
R: mapi.c:72: mapiConnect: Assertion `Rf_isInteger(port)' failed.
Aborted
This bug is supposed to have been fixed, see here ... 该错误应该已经修复,请参见此处 ...
The reason for the error is that you have monetdbd still running on port 50000, which is why the mserver5 process spawned by monetdb.server.start cannot bind to it. 出现该错误的原因是,您的monetdbd仍在端口50000上运行,这就是为什么monetdb.server.start生成的mserver5进程无法与其绑定的原因。 So either choose a different port in monetdb.server.setup (eg 50001) or kill monetdbd before calling monetdb.server.start.
因此,要么在monetdb.server.setup中选择其他端口(例如50001),要么在调用monetdb.server.start之前终止monetdbd。 Perhaps we could add a check to monetdb.server.setup to make sure no process is listening on the specified port...
也许我们可以向monetdb.server.setup添加检查,以确保没有进程在指定端口上进行侦听...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.