OS:CentOS 6 Mongod服务器:4.4 节点10.x
我已经使用RPM安装了最新的Mongo服务器4.4,使用service mongod start
并使用ps | grep mongo
启动服务,以了解Mongo正在运行。
但是,当我运行netstat -aunlp
时,我没有看到任何运行Mongo的27017端口?
这是我的mongod.conf
:
#mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
# Using either line didn't work, comment out both lines didn't work.
#bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
这是使用Mongo的NodeJS代码。在console.log上既没有成功也没有错误。
var mongoose = require('mongoose');
// Connect to database - both lines didn't work
mongoose.connect('mongodb://localhost/somedb');
//mongoose.connect('mongodb://127.0.0.1/somedb', function(err){console.log({"err": err}); });
mongoose.connection.once('connected', function() {
console.log('Successfully connected to MongoDB.')
}).on('error', function(e){
console.log({"ERR": e});
});
可以请大家帮忙吗?
非常感谢您预先提供的所有帮助。
答案 0 :(得分:1)
-u限制为UDP套接字。 MongoDB使用TCP套接字。