首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在google cloud Rstudio pro服务器上运行plumber R

无法在google cloud Rstudio pro服务器上运行plumber R
EN

Stack Overflow用户
提问于 2019-05-31 20:40:41
回答 1查看 134关注 0票数 1

我正在使用谷歌云平台上的rstudio pro上的plumber。下面的代码在我的本地机器上运行良好,即我可以在提供的链接上查看swagger UI,但不能在google云平台上运行。

代码语言:javascript
复制
# plumber.R

#' Echo the parameter that was sent in
#' @param msg The message to echo back.
#' @get /echo
function(msg="")
{
  list(msg = paste0("The message is: '", msg, "'"))
}

#' Plot out data from the iris dataset
#' @param spec If provided, filter the data to only this species (e.g. 'setosa')
#' @get /plot
#' @png
function(spec)
{
  myData <- iris
  title <- "All Species"

  # Filter if the species was specified
  if (!missing(spec)) 
    {
    title <- paste0("Only the '", spec, "' Species")
    myData <- subset(iris, Species == spec)
    }

  plot(myData$Sepal.Length, myData$Petal.Length,
       main=title, xlab="Sepal Length", ylab="Petal Length")
}

我运行管道工脚本并得到以下输出

代码语言:javascript
复制
> pr$run(port = 8000 )
Starting server to listen on port 8000
Running the swagger UI at http://127.0.0.1:8000/__swagger__/

当我使用上面的链接时,我得到了下面的错误,尽管它在我的本地应用程序上运行良好

代码语言:javascript
复制
 HTTP Error 404. The requested resource is not found.

管道工文档,建议检查是否有防火墙,因为我们在远程服务器上运行,但在谷歌云上我找不到任何防火墙规则阻止这一点。

请建议我该怎么做。

EN

回答 1

Stack Overflow用户

发布于 2019-06-07 21:38:28

http://127.0.0.1是您的本地主机。当您在云中运行时,您必须使用RStudio专业版实例的云机器的ip,并确保它对您公开和可用。此外,管道工只接受http请求,因此您的云机器必须接受http请求。

您是否在使用市场上的vm?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56395317

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档