- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
当 Mongo 数据库(版本 3.0.5)从主数据库服务器复制到从服务器时,我收到套接字错误 110(连接超时),更准确地说是在提交该数据库的复制时(从服务器的日志如下)。我想可能是因为数据库很大,发送操作来提交它需要太多时间。
如何为 mongo 服务器指定不同的套接字超时?如果不可能,有没有其他方法可以修复复制?
我发现这样一个选项仅适用于 mongo 客户端(连接字符串选项 socketTimeoutMS),但它对 Mongo 服务器没有帮助。
2016-04-26T13:36:34.693+0100 I INDEX [rsSync] done building bottom layer, going to commit
2016-04-26T13:36:34.693+0100 I INDEX [rsSync] build index done. scanned 30980334 total records. 4072 secs
2016-04-26T13:36:34.772+0100 I REPL [rsSync] initial sync cloning db: {skipped db name}
2016-04-26T13:36:34.823+0100 I NETWORK [rsSync] Socket say send() errno:110 Connection timed out {skipped ip}:27017
2016-04-26T13:36:34.828+0100 E REPL [rsSync] 9001 socket exception [SEND_ERROR] server [{skipped ip}:27017]
2016-04-26T13:36:34.828+0100 E REPL [rsSync] initial sync attempt failed, 9 attempts remaining
更新。我被要求在评论中输出 rs.status():
{ "set" : "<skippedsetname>",
"date" : ISODate("2016-05-04T15:35:06.717Z"),
"myState" : 5,
"syncingTo" : "<skipped domain name of other server>:27017",
"members" : [
{
"_id" : 0,
"name" : "<skipped domain name of this server>:27017",
"health" : 1,
"state" : 5,
"stateStr" : "STARTUP2",
"uptime" : 29,
"optime" : Timestamp(0, 0),
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"syncingTo" : "<skipped domain name of other server>:27017",
"configVersion" : 9,
"self" : true
},
{
"_id" : 2,
"name" : "10.0.1.7:27017",
"health" : 1,
"state" : 7,
"stateStr" : "ARBITER",
"uptime" : 26,
"lastHeartbeat" : ISODate("2016-05-04T15:35:05.859Z"),
"lastHeartbeatRecv" : ISODate("2016-05-04T15:35:06.347Z"),
"pingMs" : 3,
"configVersion" : 9
},
{
"_id" : 3,
"name" : "<skipped domain name of other server>:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 26,
"optime" : Timestamp(1462376105, 196),
"optimeDate" : ISODate("2016-05-04T15:35:05Z"),
"lastHeartbeat" : ISODate("2016-05-04T15:35:05.859Z"),
"lastHeartbeatRecv" : ISODate("2016-05-04T15:35:06.086Z"),
"pingMs" : 4,
"electionTime" : Timestamp(1461688501, 1),
"electionDate" : ISODate("2016-04-26T16:35:01Z"),
"configVersion" : 9
}
],
"ok" : 1 }
更新。我应该但没有提到使用的托管是 Azure。 Answer and explanation通过查询“azure mongodb connection timeout”完美搜索。我的错。
最佳答案
您对错误原因的假设是错误的。
Connection timed out
:在尝试建立 TCP 连接的过程中,在给定的时间限制内,对方没有响应。 换句话说,这是建立套接字的问题,而不是复制数据库需要多长时间的问题。
调整 TCP 超时是一项系统设置,而不是您为每个应用程序执行的操作。 linux 上的设置在系统范围内 /etc/sysctl.conf你可以play around使用 net.ipv4.tcp_syn_retries
-- 然而 你几乎从不改变建立套接字的超时时间(对于任何程序,包括 mongo),我改变了几次是为了更快地得到错误而缩短它,而不是增加它——增加它不太可能是任何实际应用中的正确解决方案。
问题可能是配置问题 - 例如您的设置中有一些错误的 IP 地址,或者是网络问题,例如防火墙、路由表或网络交换机有问题,有时会在 60-120 秒内无法工作一次。
关于mongodb - 如何为 MongoDB 服务器从属副本指定套接字超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36870822/
我正在 Jenkins 中配置从 Linux 节点。这里的多个标签的正确语法(分隔符和转义)是什么? 最佳答案 您应该使用 whitespaces 分隔标签。如果标签包含空格,您应该引用它(单引号和双
我已经设置了 master(192.168.1.10) 和 slave(192.168.1.11) postgresql。登录slave postgresql报错: postgres@sonia-Sy
我支持由小型企业托管的应用程序,基于 Web 的 ROR 应用程序在后端使用 pgsql 数据库。 Postgres 设置为复制到异地备用服务器,据我所知它工作正常,当我查询远程服务器时它显示它正在恢
这个方法是我写的(和其他帖子差不多) public void update(string fileName, string sheetName) { string connString = c
我已经为 MySQL 服务器设置了复制。我可以使用复制用户/密码从从机连接到主服务器。我已经运行了从属 SQL 线程,但是从属 I/O线程未运行,使用“显示从属状态”检查时从属 I/O 状态为空。可能
在使用Jenkins Docker插件时,可能由于错误而导致无法启动群集。我没有注意,目前有数千个脱机节点无法启动。 底线-是否可以批量删除Jenkin中的节点(从属),清理所有脱机节点甚至删除所有节
我正在尝试在一个旧项目中引入持续集成,我们遇到了非常具体的情况 - 可以将 CI 服务器只放在我们在 CentOS 上运行的测试服务器上。服务器有很多未使用的 RAM 和 CPU 功能。 但是,我们需
我最近更改了我的 jenkins 机器使用的其中一个从属设备的 DNS cname 记录。进行更改后,我更新了节点中的信息,使其指向新名称。从那时起,jenkins slave 无法启动并出现以下错误
我需要创建在 Amazon EC2 上的 Windows VM 下运行的 Jenkins 代理云。 我对此的看法是简单的场景: 我有几个预配置的 AMI,每个虚拟机都有与我的项目之一匹配的特定环境。我
使用 Jenkins EC2 插件,我无法让我的 Jenkins 主服务器通过 SSH 连接到我的 Jenkins 从服务器。从站启动并正确配置,但是: INFO: Connecting to 10.
奇怪的问题,我在工作区中有两个项目: 项目A 项目B 在 projectA 的 pom.xml 中我添加了: groupid projectB version 当我构建应用程序并部署到 tomca
在我的 Jenkinsfile 中出现错误后,从属代理 pod 似乎总是很快就会死亡并消失。有没有办法在我身处其中时执行它并使其保持事件状态?我使用 Helm 在 Kubernetes 上运行 Jen
我是一名优秀的程序员,十分优秀!