<?php
function getMongoClient($seeds = "", $options = array(), $retry = 3) {
try {
return new MongoClient($seeds, $options);
} catch(Exception $e) {
/* Log the exception so we can look into why mongod failed later */
logException($e);
}
if ($retry > 0) {
return getMongoClient($seeds, $options, --$retry);
}
throw new Exception("I've tried several times getting MongoClient.. Is mongod really running?");
} try {
$mc = getMongoClient("localhost", array());
} catch(Exception $e) {
/* Can't connect to MongoDB! */
logException($e);
die("Can't do anything :(");
}

解决方法;失败重试

mongodb: Remote server has closed the connection的更多相关文章

  1. Request Connection: Remote Server @ 192.229.145.200:80

    录制Loadrunner脚本时,提示: Request Connection: Remote Server @ 192.229.145.200:80   NOT INTERCEPTED!(REASON ...

  2. 解决loadrunner录制时 Request Connection: Remote Server @ 0.0.0.0:80 (Service=?) NOT PROXIED! (REASON: Unable to connect to remote server: rc = -1 , le = 0)问题

    环境为win7+ie8+loadrunner11,录制脚本回放查看Recoding log 出现如下错误:[Net An. Error    ( 7f8:1340)] Request Connecti ...

  3. AMQP server localhost:5672 closed the connection. Check login credentials: Socket closed

    2016-04-13 09:23:38.755 18850 INFO oslo.messaging._drivers.impl_rabbit [req-fafc8542-9403-4b5a-89d2- ...

  4. lr11录制时报“Request Connection: Remote Server @ 0.0.0.0:1080 (Service=?) NOT PROXIED! )”解决方法

    在录制脚本的时候出现如下现象: 解决方法: LoadRunner录制脚本时出现:Unable to connect to remote server),有事件没有脚本的问题   1.首先要查看IE浏览 ...

  5. org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or br

    WARN <init>, HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF R ...

  6. Golang : Forwarding a local port to a remote server example

    原文:https://socketloop.com/tutorials/golang-forwarding-a-local-port-to-a-remote-server-example 端口转发, ...

  7. 【API管理 APIM】APIM集成内部VNet后,自我访问出现(Unable to connect to the remote server)问题,而Remote Server正是APIM它自己

    问题描述 在使用APIM配置内部VNET后,如API-1正常配置访问后端服务器的一个接口,而API-2则是通过调用APIM中的API-1来作为backendUrl,会出现500错误. 经过测试,目前这 ...

  8. selenium Remote Server 实现原理

    selenium作为一个出色的web automation框架,被越来越多的企业采用究其原因,框架设计的比较remarkable, 作为一个开源的框架,能够开辟出一套协议,以至于针对app测试的app ...

  9. CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

    今天,在用icinga服务器端测试客户端脚本时,报如下错误: [root@mysql-server1 etc]# /usr/local/icinga/libexec/check_nrpe -H 192 ...

随机推荐

  1. svn一整套使用,从下载到整个服务器搭建完成的详细说明

    SVN服务器的本地搭建和使用 Subversion是优秀的版本控制工具,其具体的的优点和详细介绍,这里就不再多说. 首先来下载和搭建SVN服务器. 现在Subversion已经迁移到apache网站上 ...

  2. vs2012编译在win7 32位电脑和win xp电脑上运行的win32程序遇到的问题记录

    一.win7 32位电脑: vs2012编译的64位程序是没有问题的.但编译的32位程序在别的电脑(虚拟机模拟)出错: 感觉很无语,vs这么牛逼的东西,在设计时候都不考虑这些吗? 在自己电脑C:\Wi ...

  3. Win7系统下彻底删除无用服务的方法

    win7系统下中有非常多的服务项,用户来满足不同行业用户间的所有需求,系统服务也是执行指定系统功能的程序,许多情况下我们想要运行软件或执行外接设备都无法离开系统服务,但并非所有系统服务都是我们用到的, ...

  4. vsftpd安装和使用 Linux系统和window系统

    vsftpd 安装(Linux)一.安装系统环境 centos 6.9 64位二.vsftpd版本 vsftpd-2.2.2-24.el6.x86_64三.安装步骤1.安装 执行 yum -y ins ...

  5. BZOJ 4025: 二分图 [线段树CDQ分治 并查集]

    4025: 二分图 题意:加入边,删除边,查询当前图是否为二分图 本来想练lct,然后发现了线段树分治的做法,感觉好厉害. lct做法的核心就是维护删除时间的最大生成树 首先口胡一个分块做法,和hno ...

  6. Orleans之EventSourcing

    Orleans之EventSourcing 这是Orleans系列文章中的一篇.首篇文章在此 引入: 如果没有意外,我再这篇文章中用ES代替EventSourcing,如果碰到"事件回溯&q ...

  7. 初探solr搜索

    solr是一个基于lucene的搜索引擎,lucene是一个全文检索引擎的架构.solr在此之上进行了封装完善,变成了一个很流行实用的搜索引擎,可以应对绝大部分的搜索需求.使用搜索引擎有以下几点好处: ...

  8. TensorFlow实战之实现自编码器过程

    关于本文说明,已同步本人另外一个博客地址位于http://blog.csdn.net/qq_37608890,详见http://blog.csdn.net/qq_37608890/article/de ...

  9. python学习:字典排序

    按字典值排序   按照字典value排序,类似sort -k 命令   import operator x= {1:2,3:4,4:3,2:1,0:0} sorted_x = sorted(x.ite ...

  10. 归并排序Merge Sort

    //C语言实现 void mergeSort(int array[],int first, int last) { if (first < last)//拆分数列中元素只剩下两个的时候,不再拆分 ...