r - 错误:未找到合适的服务器(`serverSelectionTryOnce` 设置):[socket timeout calls ismaster on ...]
问题描述
我想知道为什么 shinyapps.io 不再可以从 Atlas 连接到 mongoDB。我使用 mongoAtlas 和 shinyapps.io 完成了无数项目。
截至今天,我发布的任何新应用程序都不允许我连接到我的 mongoDB。
在我的日志中,我收到一个错误:没有找到合适的服务器(serverSelectionTryOnce
设置):[socket timeout calls ismaster on 'cluster0-shard-00-00-02dsl.mongodb.net:27017']
该代码在 Rstudio Cloud、我的本地电脑和我朋友的本地电脑上完美运行。但是shinyapps.io 的日子不好过。
用户界面
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")
)
)
))
服务器.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 存在一些问题。而是第二个。现在一切正常。
推荐阅读
- .net-core - .NET Core 本地化全球化
- ios - 从 POSTMAN 和 Swift 尝试时从 API 获得不同的响应
- javascript - 更改时,划掉表格
- c# - ASP.net.MVC 5 创建一个显示 sql 查询的页面
- javascript - 按类名更改页面重新加载时的 img src
- python-3.x - 计算 silhouette_score 时出现 MemorError
- uwp - 如何在 UWP 中使用 VisualState 触发器显示不同的消息
- swift - UIApplicationOpenURLOptionsKey:任何返回字符串:任何
- c# - 一个有大约 40 个常量的类应该声明为静态的还是非静态的?
- sql - 如何计算每个订单项