<?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. C# 关键字--virtual(转)

    C# 关键字--virtual 一.   virtual 关键字用于修饰方法.属性.索引器或事件声明,并使它们可以在派生类中被重写.虚拟成员的实现可由派生类中的重写成员更改,而非虚拟成员是无法由派生类 ...

  2. Delphi json解析相关

    身为一个资深的Delphi 开发者, 最近在做一个小工具的时候,开始捡起来pascal语言. 主要是开发一个内部用的小工具, 主要功能: 1.解析json格式 2.格式化json文件 3.校验json ...

  3. oracle用户与表空间操作

    oracle系统用户sys,system , sysman, scott 使用system用户登录[username/password][@server][as sysdba|sysoper]eg: ...

  4. eclipse修改默认workspace

    1.进入 Window > Preferences > General > Startup and Shutdown 选中 Prompt for workspace on start ...

  5. MySql-5.7.17-20解压缩版安装配置

    MySql-5.7.XXX解压缩版安装配置   1.mysql-5.7.20是解压版免安装的,版本下载地址:http://dev.mysql.com/downloads/mysql/ 如下图 2.解压 ...

  6. 23_迭代器、模拟For循环

    一.可迭代对象 和 迭代器 1.可迭代对象和迭代器 可迭代对象:可以直接作用于for循环的对象统称为可迭代对象,Iterable. 迭代器:可以被next()函数调用并不断返回下一个值的对象称为迭代器 ...

  7. Sonar项目主要指标以及代码坏味道详解

    更多原创测试技术文章同步更新到微信公众号 :三国测,敬请扫码关注个人的微信号,感谢! 原文链接:http://www.cnblogs.com/zishi/p/6766994.html 众所周知Sona ...

  8. 洛谷 [P1426] 通往奥格瑞玛的道路

    题目中的表述很明显是一道二分答案+最短路的题目,二分收取的费用x判断能否到达奥格瑞玛.检验函数用SPFA跑最短路,注意,费用高于x的点不能使用. #include <iostream> # ...

  9. BZOJ 1176: [Balkan2007]Mokia [CDQ分治]

    题意: 有一个n * n的棋盘,每个格子内有一个数,初始的时候全部为0.现在要求维护两种操作: 1)Add:将格子(x, y)内的数加上A. 2)Query:询问矩阵(x0, y0, x1, y1)内 ...

  10. python实现时间o(1)的最小栈

    这是毕业校招二面时遇到的手写编程题,当时刚刚开始学习python,整个栈写下来也是费了不少时间.毕竟语言只是工具,只要想清楚实现,使用任何语言都能快速的写出来. 何为最小栈?栈最基础的操作是压栈(pu ...