简体   繁体   English

在R中终止(友好地)MonetDB进程

[英]Terminating (graciously) MonetDB process in R

I'm using MonetDB on a variety of platform (eg OS X and Linux Centos) with a shiny application. 我在具有出色应用程序的各种平台(例如OS X和Linux Centos)上使用MonetDB。

It is difficult to disconnect the db all the times, so currently my approach is to terminate the shiny app without disconnecting the db. 很难一直断开数据库连接,因此目前我的方法是在不断开数据库连接的情况下终止闪亮的应用程序。

This means that the shiny app before accessing the data tries to stop any "old" process with: 这意味着闪亮的应用程序在访问数据之前会尝试通过以下方式停止任何“旧”进程:

monetdb.server.stop(pid)

From the source of the command I understand that it basically kills the process associated to the pid provided (which means among other things that the user running the app must have access to the kill function). 从命令的源头我了解到,它基本上可以终止与所提供的pid相关联的进程(这意味着运行该应用程序的用户必须有权使用kill功能)。

This works OK some of the times, but sometimes when I try to start MonetDB again, I get 在某些情况下,这可以正常工作,但是有时当我尝试再次启动MonetDB时,我得到了

!FATAL: GDKlockHome: Database lock '.gdk_lock' denied

Warning in socketConnection(host = host, port = port, blocking = TRUE, open = "r+b",  :
  localhost:50000 cannot be opened
Error in socketConnection(host = host, port = port, blocking = TRUE, open = "r+b",  : 
  cannot open the connection

Is there a way to avoid this error (without forcibly disconnecting the database all the time I use it in shiny)? 有没有办法避免此错误(在强行使用时,无需强行断开数据库连接)?

It can indeed take a couple of seconds for MonetDB to shut down. 实际上,关闭MonetDB可能需要花费几秒钟的时间。 If a new process is started on the same dbfarm directory in the meantime, you will get the !FATAL: GDKlockHome: Database lock '.gdk_lock' denied error. 如果在同一时间在同一dbfarm目录上启动新进程,则会收到!FATAL: GDKlockHome: Database lock '.gdk_lock' denied错误。 I'm considering adding a wait parameter to monetdb.server.stop . 我正在考虑将wait参数添加到monetdb.server.stop

So in the meantime, waiting a bit before the server is started again is a good idea. 因此,与此同时,在再次启动服务器之前稍等片刻是一个好主意。 Otherwise, consider using monetdbd to manage your MonetDB servers. 否则,请考虑使用monetdbd来管理您的MonetDB服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM