啦啦啦

这种情况

root@localhost:/# mongo
MongoDB shell version: 3.2.
connecting to: test
--31T07::34.548- W NETWORK [thread1] Failed to connect to 127.0.0.1:, in(checking socket for error after poll), reason: errno: Connection refused
--31T07::34.549- E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js::
@(connect):: exception: connect failed

由于直接kill掉的进程,不知道为什么服务再启动时options:{}为空。虽启动时指定-dbpath 参数

mongod -dbpath "/var/lib/mongodb/"

但是这样必须保证服务窗口不能关闭。

使用配置文件方式启动

mongod -f /etc/mongod.conf

这样也必须保证服务窗口不能关闭。

采用守护进程方式启动:Daemon

–fork参数可以将mongodb的服务放在后台运行

root@localhost:/# mongod -fork -f /etc/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process:
child process started successfully, parent exiting

mongod.log

--31T07::28.242- I CONTROL  [main] ***** SERVER RESTARTED *****
--31T07::28.249- I CONTROL [initandlisten] MongoDB starting : pid= port= dbpath=/var/lib/mongodb -bit host=localhost
--31T07::28.250- I CONTROL [initandlisten] db version v3.2.13
--31T07::28.250- I CONTROL [initandlisten] git version: 23899209cad60aaafe114f6aea6cb83025ff51bc
--31T07::28.251- I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g Mar
--31T07::28.251- I CONTROL [initandlisten] allocator: tcmalloc
--31T07::28.251- I CONTROL [initandlisten] modules: none
--31T07::28.251- I CONTROL [initandlisten] build environment:
--31T07::28.252- I CONTROL [initandlisten] distmod: ubuntu1604
--31T07::28.252- I CONTROL [initandlisten] distarch: x86_64
--31T07::28.252- I CONTROL [initandlisten] target_arch: x86_64
--31T07::28.252- I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { port: }, processManagement: { fork: true }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
--31T07::28.276- I - [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
--31T07::28.276- I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=,eviction=(threads_min=,threads_max=),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=),checkpoint=(wait=,log_size=2GB),statistics_log=(wait=),
--31T07::28.461- I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
--31T07::28.462- I CONTROL [initandlisten]
--31T07::28.462- I CONTROL [initandlisten]
--31T07::28.462- I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
--31T07::28.462- I CONTROL [initandlisten] ** We suggest setting it to 'never'
--31T07::28.462- I CONTROL [initandlisten]
--31T07::28.463- I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
--31T07::28.463- I CONTROL [initandlisten] ** We suggest setting it to 'never'
--31T07::28.463- I CONTROL [initandlisten]
--31T07::28.466- I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
--31T07::28.466- I NETWORK [initandlisten] waiting for connections on port
--31T07::28.467- I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
--31T07::01.201- I NETWORK [initandlisten] connection accepted from 127.0.0.1: # ( connection now open)

啦啦啦

啦啦啦

mongodb 初学 意外 连接服务器异常(Connection refused)的更多相关文章

  1. java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186646784)(ERR=12505)(ERR

    dbc 链接orcal出错 java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186646784)( ...

  2. Mac和Linux远程连接服务器异常修复(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

    感谢大佬:https://blog.csdn.net/wd2014610/article/details/79945424 一.今天在使用SSH,连接远程服务器的时候,刚开始是没问题的. 后来阿里云主 ...

  3. SQLException: Io 异常: Connection refused ERR=12514 ERR=1153异常处理过程

    solr更新索引连接数据库地址时发生的错误,数据库拒绝连接,经过调查是因为solr的data-config.xml 文件中配置数据库连接的地方,不应该配置数据库实例名而应该是数据库server_nam ...

  4. 1- Mac和Linux远程连接服务器异常修复(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

    p.p1 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1) } span.s1 { font-variant-ligatures: no-c ...

  5. mongodb 初学 索引

    连接服务器异常(Connection refused) 啦啦啦 mongodb 搭建主从服务器 啦啦啦 Mongodb启动命令mongod参数说明 啦啦啦 MongoDB 分片 啦啦啦 啦啦啦 啦啦啦 ...

  6. 远程连接mongodb出现 no route to host 和 Connection refused

    部署好mongodb服务器后,在客户端安装好php的mongodb扩展,用程序连接mongodb服务器出错:no route to host.搜索了差不多一天的时候都没有相关的解决方法.最后在mong ...

  7. Debian部署RMI异常:java.rmi.ConnectException: Connection refused to host: 127.0.1.1;

    现象:在windows上部署RMI很顺利,但移到debian上部署后,客户端报异常: java.rmi.ConnectException: Connection refused to host: 12 ...

  8. 调用远程主机上的 RMI 服务时抛出 java.rmi.ConnectException: Connection refused to host: 127.0.0.1 异常原因及解决方案

    最近使用 jmx 遇到一个问题,client/server 同在一台机器上,jmx client能够成功连接 server,如果把 server 移植到另一台机器上192.168.134.128,抛出 ...

  9. 出现 java.net.ConnectException: Connection refused 异常的原因及解决方法

    1 异常描述 在启动 Tomcat 服务器的时候,控制台一直输出异常信息,然后停止服务器,报出如下异常: 2 异常原因 通过观察上图中被标记出来的异常信息,咱们可以知道 java.net.Connec ...

随机推荐

  1. 在vue或者react中使用express框架

    在react 或者 vue项目中使用express框架 1.创建vue或者 react 项目 2.在项目中创建server文件夹,创建server.js //require()方法引入express模 ...

  2. (4)4 larger-than-life lessons from soap operas

    https://www.ted.com/talks/kate_adams_4_larger_than_life_lessons_from_soap_operas/transcript 00:12In ...

  3. CString成员函数详解[转]

    1.构造函数(常用) CString( const unsigned char* psz );      例:char s[]="abcdef";              cha ...

  4. idea在相应的包下右键创建servlet,找不到servlet选项

    开始pom.xml文件里面我是只引进了个servlet包,但是右键依旧没有servlet选项 <dependency> <groupId>javax.servlet</g ...

  5. BitMap的简单实现

    面试结束的这些日子好几次接触到BitMap这个东西.到底是啥呢,究其原因就是虽然它的使用条件较为苛刻,但是它对应的时间复杂度和空间复杂度真的是惊人的好. 首先是根据其思想先写了一个比较差的实现代码: ...

  6. 移植UC15 3G模块

    https://blog.csdn.net/jack_a8/article/details/43114083 https://wenku.baidu.com/view/7ea5c9cd52d380eb ...

  7. php 验证码 图像存在错误 无法显示 解决方法

    <?php $height = 300; $width = 300; $im = imagecreatetruecolor($width, $height); $white = imagecol ...

  8. js 循环向上滚动

    aaaaaaaaaaaaaaaaa最开头 aaaaaaaaaaa 1 aaaaaaaaaaa 2 aaaaaaaaaaa 3 aaaaaaaaaaa 4 aaaaaaaaaaa 5 aaaaaaaaa ...

  9. 深入浅出javascript(八)this、call和apply

    _________此篇日志属于重要记录,长期更新__________ this,call,apply这三个是进阶JS的重要一步,需要详细的记录. ➢ this 一.作为对象的方法调用. 当函数作为对象 ...

  10. 解决mac安装homebrew后报错-bash: brew: command not found

    解决mac安装homebrew后报错-bash: brew: command not found     参照官网上很简单的一句安装命令, /usr/bin/ruby -e "$(curl ...