我 php mongodb 拓展使用的是  MongoDB driver 今天查询数据的时候 偶尔会提示,

No suitable servers found (`serverselectiontryonce` set): [Failed connecting to '115.28.161.44:27017': Connection timed out],

提示的答题意思是 超时

贴出我的解决方法:

        $id = I('post.id');
$this->getassign_common_data();
$info = D('BigdataMailCustomer')->where(['id' => $id])->find();
$object_id = $info['object_id'];
$coll = $info['coll'];
$options_base = ['connectTimeoutMS' => 50000, 'socketTimeoutMS' => 50000];
$manager = new \MongoDB\Driver\Manager(C('mongodb_auth_url'), $options_base);
$id = new \MongoDB\BSON\ObjectId($object_id);
$filter = ['_id' => $id];
$options = [];
$query = new \MongoDB\Driver\Query($filter, $options);
$rows = $manager->executeQuery(C('default_db') . '.' . $coll, $query);
$doc = [];
foreach ($rows as $document) {
$doc = $document;
}
$this->assign('d', $doc);
$this->display('view');

添加配置选项 连接超时 选项

No suitable servers found (`serverselectiontryonce` set): [Failed connecting to '115.28.161.44:27017': Connection timed out] php mongodb 异常的更多相关文章

  1. 【LR11】Error -27796: Failed to connect to server"server:port": [10060] Connection timed out错误解决办法

      场景描述:被测系统是发布在远程服务器上的,假设IP是10.10.10.10,端口是8066,那么访问地址是http://10.10.10.10:8066/,在control机器上我设置了IP欺骗. ...

  2. Error -27796: Failed to connect to server "ip地址": [10060] Connection timed out

    如果出现Error -27796: Failed to connect to server "ip地址": [10060] Connection timed out 这样的错误,如 ...

  3. JedisConnectionException: Failed connecting to host localhost:6379

    报错原因:没有启动服务,打开服务即可 redis.clients.jedis.exceptions.JedisConnectionException: Exception at redis.clien ...

  4. 1.MongoDB报错 Failed to connect 127.0.0.1:27017 Mongo运行错误

    1.Mongo运行错误:Failed to connect 127.0.0.1:27017 Mongo运行错误:Failed to connect 127.0.0.1:27017,reason:err ...

  5. 使用phpmailer插件发邮件失败提示:SMTP -> ERROR: Failed to connect to server: Connection timed out (110) smtp connect() failed;

    一个邮件发送问题,整整弄了我一周时间,起因是这样的,之前弄的一个网站,需要在邮箱里面认证之后才可以注册成功.网站上线了差不多一年之后,客户突然跟我说,网站不能注册了,然后我就查看了一下代码. 发现报这 ...

  6. mac 配置 ssh 到git (Could not resolve hostname github.com, Failed to connect to github.com port 443 Operation timed out)

    1.进入终端命令行 (1)输入:cd .ssh/ 进入到.ssh后,输入ls,会输出“known_hosts”,如果没有创建过rsa的话 (2)输入:man ssh-add (3)输入:ssh-key ...

  7. eclipse启动tomcat正常,但是debug启动报错FATAL ERROR in native method:JDWP No transports initialized,jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) ERROR: transport error 202: connect failed:Connection timed out

    FATAL ERROR in native method:JDWP No transports initialized,jvmtiError=AGENT_ERROR_TRANSPORT_INIT(19 ...

  8. [原]Failed connect to mirrors.cloud.aliyuncs.com:80; Connection refused

    web site : https://opsx.alibaba.com/mirror 运行后出现下面的Error: base//x86_64/other_db FAILED http://mirror ...

  9. loadrunner:Action.c(4): Error -27796: Failed to connect to server "192.168.66.3:8080": [10060] Connection timed out

    Action.c(4): Error -27796: Failed to connect to server "192.168.66.3:8080": [10060] Connec ...

随机推荐

  1. android:碎片的使用方式

    介绍了这么多抽象的东西,也是时候应该学习一下碎片的具体用法了.你已经知道,碎 片通常都是在平板开发中才会使用的,因此我们首先要做的就是新建一个平板电脑的模拟 器.由于 4.0 系统的平板模拟器好像存在 ...

  2. 七周七语言之Ruby

    1.安装 Ubuntu 14.04 sudo apt-get install ruby version 1.9.1 2.命令行运行: irb 3.文挡查看:man RDoc 4.猜数字 2.2.7程序 ...

  3. openHEVC 编译 for VS2017+Win10 x64

    编译暂未成功,有空再次更新 前期准备: yasm下载:http://yasm.tortall.net/Download.html http://www.tortall.net/projects/yas ...

  4. grid - 网格轨道最小和最大尺寸

    可以通过minmax()函数来创建网格轨道的最小或最大尺寸. minmax()函数接受两个参数: 第一个参数定义网格轨道的最小值 第二个参数定义网格轨道的最大值 可以接受任何长度值,也接受auto值. ...

  5. zabbix 创建主机、主机群组、监控第一台服务器

    前面介绍了zabbix服务器和zabbix agent的安装配置,今天使用zabbix监控第一台服务器. 1. 安装zabbix agent 在被监控的服务器上安装zabbix agent . 参考& ...

  6. Oracle 12c RMAN备份文档

    创建备份目录,查看剩余空间 [cistest@cistest ~]$ df -h df: '/home/oratest/.gvfs': Permission denied Filesystem Siz ...

  7. JS中 HTMLEncode和HTMLDecode

    <!--js伪编码解码--><script language="javascript" type="text/javascript">f ...

  8. Zabbix-2.X/3.X监控工具监控Redis以及zabbix Redis监控模板下载

    为了监控Redis3的运行状况,去zabbix官网查找资料,根据提示,找到了这个项目:https://github.com/blacked/zbx_redis_template 但是文档和内容已经不匹 ...

  9. java中的synchronized同步代码块和同步方法的区别

    下面这两段代码有什么区别? //下列两个方法有什么区别 public synchronized void method1(){} public void method2(){ synchronized ...

  10. jsoup 是一款Java 的HTML解析器,可直接解析某个URL地址

    jsoup 是一款Java 的HTML解析器,可直接解析某个URL地址.HTML文本内容.它提供了一套非常省力的API,可通过DOM,CSS以及类似于jQuery的操作方法来取出和操作数据.