No suitable servers found (`serverselectiontryonce` set): [Failed connecting to '115.28.161.44:27017': Connection timed out] php mongodb 异常
我 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 异常的更多相关文章
- 【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欺骗. ...
- Error -27796: Failed to connect to server "ip地址": [10060] Connection timed out
如果出现Error -27796: Failed to connect to server "ip地址": [10060] Connection timed out 这样的错误,如 ...
- JedisConnectionException: Failed connecting to host localhost:6379
报错原因:没有启动服务,打开服务即可 redis.clients.jedis.exceptions.JedisConnectionException: Exception at redis.clien ...
- 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 ...
- 使用phpmailer插件发邮件失败提示:SMTP -> ERROR: Failed to connect to server: Connection timed out (110) smtp connect() failed;
一个邮件发送问题,整整弄了我一周时间,起因是这样的,之前弄的一个网站,需要在邮箱里面认证之后才可以注册成功.网站上线了差不多一年之后,客户突然跟我说,网站不能注册了,然后我就查看了一下代码. 发现报这 ...
- 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 ...
- 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 ...
- [原]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 ...
- 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 ...
随机推荐
- 集合(2)—Collection之List的使用方法
声明集合变量 List list = new ArrayList(); 或者 : public LIst list: public 构造函数(){ this.list = new ArrayList( ...
- android fastjson 解析
JSONObject jsonObject = JSON.parseObject(wsResponse);String recommends = jsonObject.getString(" ...
- Oracle 11g不同情形下的登录分析
对于Oracle刚開始学习的人.甚至有些经验的Oracle DBA来说,Oracle的账户登录问题往往非常棘手.即便成功登录oracle也是知其然而不知其所以然. 作者经过系统学习和重复实践,本着打破 ...
- Unity3D光照前置知识——Rendering Paths(渲染路径)及LightMode(光照模式)译解
简述 Unity supports different Rendering Paths. You should choose which one you use depending on your g ...
- SpringMVC拦截器详解
拦截器是每个Web框架必备的功能,也是个老生常谈的主题了. 本文将分析SpringMVC的拦截器功能是如何设计的,让读者了解该功能设计的原理. 重要接口及类介绍 1. HandlerExecution ...
- composer 使用
#安装 composer curl -sS https://getcomposer.org/installer | php或直接下载 composer.phar( https://getcompose ...
- CSS实现屏幕显示与打印结果不一样的方法
文章作者:Tony Qu原创 一种方法是为屏幕显示和打印分别准备一个css文件,如下所示: 用于屏幕显示的css: <link rel="stylesheet" href=& ...
- 正则匹配报文中的XML(HTML)标签,替换重新输出
调用返回报文标签中的存在中划线“-”,不符合规范,需要统一进行转换,但不能替换标签内的内容,利用正则匹配重新输出 /** * 正则匹配报文中的xml标签,将其中的"-"转换为&qu ...
- android应用私有存储文件的写入与读取-openFileInput 和 openFileOutput
一:第一种方式就是像Java平台下的实现方式一样通过构造器直接创建,如果需要向打开的文件末尾写入数据,可以通过使用构造器FileOutputStream(File file, boolean appe ...
- 【Linux高级驱动】网卡驱动分析
两个重要的结构体简单介绍 *sk_buff 如果把网络传输看成是运送货物的话,那么sk_buff就是这个“货物”了,所有经手这个货物的人都要干点什么事儿,要么加个包装,要么印个戳儿等等.收货的时候就要 ...