Error: No suitable servers found (`serverSelectionTryOnce` set): [socket timeout calling ismaster on ...]
Error: No suitable servers found (`serverSelectionTryOnce` set): [socket timeout calling ismaster on ...]
我想知道为什么 shinyapps.io 无法再连接到来自 Atlas 的 mongoDB。我使用 mongoAtlas 和 shinyapps.io 完成了无数项目。
截至今天,我发布的任何新应用都不允许我连接到我的 mongoDB。
在我的日志中出现错误:
找不到合适的服务器(serverSelectionTryOnce
设置):['cluster0-shard-00-00-02dsl.mongodb.net:27017' 上调用 ismaster 的套接字超时]
代码在Rstudio Cloud、我的本地电脑和我朋友的本地电脑上完美运行。但是 shinyapps.io 过得很艰难。
UI.R
library(mongolite)
shinyUI(fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
tableOutput("table")
)
)
))
Server.R
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
url = "mongodb://jwrong:<mypass>@cluster0-shard-00-00-02dsl.mongodb.net:27017,cluster0-shard-00-01-02dsl.mongodb.net:27017,cluster0-shard-00-02-02dsl.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=false"
df.orats = mongo(collection = "df.orats", db = "test", url = url, verbose = T)
d = df.orats$find()
output$table <- renderTable({
d
})
})
您现在可以试试了。 MongoDB 或 shinyapps.io 可能存在一些问题。而是第二个。现在一切正常。
我想知道为什么 shinyapps.io 无法再连接到来自 Atlas 的 mongoDB。我使用 mongoAtlas 和 shinyapps.io 完成了无数项目。
截至今天,我发布的任何新应用都不允许我连接到我的 mongoDB。
在我的日志中出现错误:
找不到合适的服务器(serverSelectionTryOnce
设置):['cluster0-shard-00-00-02dsl.mongodb.net:27017' 上调用 ismaster 的套接字超时]
代码在Rstudio Cloud、我的本地电脑和我朋友的本地电脑上完美运行。但是 shinyapps.io 过得很艰难。
UI.R
library(mongolite)
shinyUI(fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
tableOutput("table")
)
)
))
Server.R
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
url = "mongodb://jwrong:<mypass>@cluster0-shard-00-00-02dsl.mongodb.net:27017,cluster0-shard-00-01-02dsl.mongodb.net:27017,cluster0-shard-00-02-02dsl.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=false"
df.orats = mongo(collection = "df.orats", db = "test", url = url, verbose = T)
d = df.orats$find()
output$table <- renderTable({
d
})
})
您现在可以试试了。 MongoDB 或 shinyapps.io 可能存在一些问题。而是第二个。现在一切正常。