我 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. ios 类别(category)

    定义 类别(category)是Objective-C语言的新特性,为现有的类添加新方法的方式.局限性:1.无法添加新的实例变量.2.与类本身的方法名称冲突.当名称冲突时,类别具有更高的优先级.作用: ...

  2. 菜鸟nginx源代码剖析数据结构篇(八) 缓冲区链表ngx_chain_t

    菜鸟nginx源代码剖析数据结构篇(八) 缓冲区链表 ngx_chain_t Author:Echo Chen(陈斌) Email:chenb19870707@gmail.com Blog:Blog. ...

  3. PPPOE

    本质上,它是一个允许在以太网广播域中的两个以太网接口间创建点对点隧道的协议. PPPoE(英语:Point-to-Point Protocol Over Ethernet),以太网上的点对点协议,是将 ...

  4. Geek地生活,文艺地思考

    本文纯属整理自己零碎杂乱的思绪,和题目无关.           不知觉间,大学已经两年过去了,忙忙碌碌了两年,大一那年參加了学生会编 辑部和艺术团舞蹈队,课余时间的生活总是被舞蹈队排练.參演和编辑部 ...

  5. error LNK1104:无法打开文件"lua51.lib"

    今天学习C++与Lua通信,遇到了问题:fatal error LNK1104: 无法打开文件“lua51.lib” 开发环境: VS2012 cocos版本:cocos2d-x-3.0 已经按书&l ...

  6. Redis更新的正确方法

    原文(缓存更新的套路):看到好些人在写更新缓存数据代码时,先删除缓存,然后再更新数据库,而后续的操作会把数据再装载的缓存中.然而,这个是逻辑是错误的.试想,两个并发操作,一个是更新操作,另一个是查询操 ...

  7. mock以及特殊场景下对mock数据的处理

    一.为什么要mock 工作中遇到以下问题,我们可以使用mock解决: 无法控制第三方系统某接口的返回,返回的数据不满足要求 某依赖系统还未开发完成,就需要对被测系统进行测试 有些系统不支持重复请求,或 ...

  8. 单反毁三代,kindle富一生

    盖kindle 面更香 人皆知有用之用,而莫知无用之用   一个存留记忆的地方:http://i-remember.fr/en   文章来源:刘俊涛的博客 欢迎关注,有问题一起学习欢迎留言.评论

  9. Guava之计时器Stopwatch

    import java.util.concurrent.TimeUnit; import org.junit.Test; import com.google.common.base.Stopwatch ...

  10. ios中输入框的父类--文本框,DataPick,pickerview

    父控制器 #import <UIKit/UIKit.h> #import "ScrollViewExt.h" @interface BaseKeyBoardCtrl : ...