mongodb 初学 意外 连接服务器异常(Connection refused)
2024-08-24 08:14:35
啦啦啦
这种情况
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)
啦啦啦
啦啦啦
最新文章
- 介绍几个好用的vs插件
- Net设计模式实例系列文章总结
- 自定义ViewGroup初步探究
- RSA加密(C语言)
- dede数据库类使用方法 $dsql
- 【C-001】printf理解
- MVC api json 格式
- Redis 高可用性解决方案(Sentinel)
- sikuli+java实例
- 自定义Toast的显示效果
- MongoDB学习笔记-游标
- 【转】itunes connect 如何修改主要语言
- T-SQL应用,视图、存储过程、触发器、游标、临时表等
- Eclipse安装反编译插件JD(Java Decompiler)
- Dispatcher &; Redirect
- myeclispe启动后报错 Subclipse talks to Subversion via a Java API that requires access to native libraries.
- Git学习 -- 管理修改
- 2764: [JLOI2011]基因补全
- Jerry的通过CDS view + Smart Template 开发Fiori应用的blog合集
- 001-为什么Java能这么流行