I've been beating my head against this for a while and almost filled up my log partition the other day, so I thought I'd seek some help with it. I'm a sysadmin, not a DBA, so please forgive me if I'm missing something that might be obvious to a database-y type person. My problem is this: Mongod does not start when I replace my old, 2.4-style config file with the YAML file I made to replace it. It looks like this from the command line:
# service mongod restart
Stopping mongod: [ OK ]
Starting mongod: [FAILED]
The log just shows the shutdown, as it fails to start.
My old config file, the one that works, looks like this:
-----
# mongod.conf
#where to log
logpath=/var/log/mongo/mongod. log
logappend=true
# fork and run in background
fork=true
#port=27017
dbpath=/var/lib/mongo
# location of pidfile
pidfilepath=/var/run/mongodb/ mongod.pid
# Listen to local interface only. Comment out to listen on all interfaces.
#bind_ip=127.0.0.1
# Disables write-ahead journaling
# nojournal=true
# Enables periodic logging of CPU utilization and I/O wait
#cpu=true
# Turn on/off security. Off is currently the default
#noauth=true
auth=true
# Verbose logging output.
#verbose=true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck=true
# Enable db quota management
#quota=true
# Set oplogging level where n is
# 0=off (default)
# 1=W
# 2=R
# 3=both# 7=W+some reads
#diaglog=0
# Ignore query hints
#nohints=true
# Enable the HTTP interface (Defaults to port 28017).
#httpinterface=true
# Turns off server-side scripting. This will result in greatly limited
# functionality
#noscripting=true
# Turns off table scans. Any query that would do a table scan fails.
#notablescan=true
# Disable data file preallocation.
#noprealloc=true
# Specify .ns file size for new databases.
# nssize=<size>
# Replication Options
# in replicated mongo databases, specify the replica set name here
#replSet=setname
# maximum size in megabytes for replication operation log
#oplogSize=1024
# path to a key file storing authentication info for connections
# between replica set members
#keyFile=/path/to/keyfile
-----
My new config file that doesn't work looks like this, aside from the IPs being changed for confidentiality:
-----
# new style YAML mongod.conf, -Kit, 09-04-14
# storage
storage:
dbPath: "/var/lib/mongo"
# logging
systemLog:
destination: file
path: "/var/log/mongo/mongod.log"
quiet: true
logAppend: true
processManagement:
fork: true
pidFilePath: "/var/run/mongodb/mongod.pid"
net:
bindIp: 127.0.0.1, 10.171.22.22, 50.22.221.22
port: 27017
security:
authorization: enabled
-----
Can anyone spare a clue for me? I am puzzled as to why and how this fails.
Easiest way to tell is start it from the command line:
/path/to/mongod --config /path/to/mongodb.conf
It will likely give an error to the console if it can't parse
something in the config file.
/path/to/mongod --config /path/to/mongodb.conf
It will likely give an error to the console if it can't parse
something in the config file.
Thanks for that, but it gives me nothing.
-----
# service mongod stop
Stopping mongod: [ OK ]
# /usr/bin/mongod --config /etc/mongod.conf.yaml
about to fork child process, waiting until server is ready for connections.
forked process: 24369
child process started successfully, parent exiting
# ps ax | grep mongo
8974 ? S 0:00 su -s /bin/bash mongodb-mms-agent -c /usr/bin/mongodb-mms- monitoring-agent -conf /etc/mongodb-mms/monitoring- agent.config
8983 ? Ssl 31:06 /usr/bin/mongodb-mms- monitoring-agent -conf /etc/mongodb-mms/monitoring- agent.config
24460 pts/0 S+ 0:00 grep mongo
# ps ax | grep 24369
24525 pts/0 S+ 0:00 grep 24369
What's in the log file?
Nothing.
That's tail - the relevant part would be *before* mongod shuts down.
Oh, my bad! I thought that was the old mongod shutting down in the logs; thanks for the clue!
The problem seems to be here:
2014-11-14T18:37:12.958+0000 [initandlisten] options: { config: "/etc/mongod.conf.yaml", net: { bindIp: "127.0.0.1, 10.171.22.22, 50.22.22.22", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongo/mongod.log", quiet: true } }
2014-11-14T18:37:12.965+0000 [initandlisten] journal dir=/var/lib/mongo/journal
2014-11-14T18:37:12.965+0000 [initandlisten] recover : no journal files present, no recovery needed
2014-11-14T18:37:13.127+0000 [initandlisten] getaddrinfo(" 10.171.22.22") failed: Name or service not known
2014-11-14T18:37:13.131+0000 [initandlisten] getaddrinfo(" 50.22.22.22") failed: Name or service not known
2014-11-14T18:37:13.131+0000 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-11-14T18:37:13.131+0000 [initandlisten] ERROR: addr already in use
2014-11-14T18:37:13.133+0000 [initandlisten] now exiting
Commenting out the "bindIp:" line in the config seems to have fixed it.
Stopping mongod: [ OK ]
# /usr/bin/mongod --config /etc/mongod.conf.yaml
about to fork child process, waiting until server is ready for connections.
forked process: 24369
child process started successfully, parent exiting
# ps ax | grep mongo
8974 ? S 0:00 su -s /bin/bash mongodb-mms-agent -c /usr/bin/mongodb-mms-
8983 ? Ssl 31:06 /usr/bin/mongodb-mms-
24460 pts/0 S+ 0:00 grep mongo
# ps ax | grep 24369
24525 pts/0 S+ 0:00 grep 24369
What's in the log file?
Nothing.
----
# /usr/bin/mongod --config /etc/mongod.conf.yaml
about to fork child process, waiting until server is ready for connections.forked process: 32024
child process started successfully, parent exiting# tail /var/log/mongo/mongod.log
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: going to close sockets...
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: lock for final commit...
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: final commit...
2014-11-12T19:09:00.176+0000 [initandlisten] shutdown: closing all files...
2014-11-12T19:09:00.178+0000 [initandlisten] closeAllFiles() finished
2014-11-12T19:09:00.178+0000 [initandlisten] journalCleanup...
2014-11-12T19:09:00.178+0000 [initandlisten] removeJournalFiles
2014-11-12T19:09:00.180+0000 [initandlisten] shutdown: removing fs lock...
2014-11-12T19:09:00.180+0000 [initandlisten] dbexit: really exiting now
-----
about to fork child process, waiting until server is ready for connections.forked process: 32024
child process started successfully, parent exiting# tail /var/log/mongo/mongod.log
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: going to close sockets...
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: lock for final commit...
2014-11-12T19:09:00.171+0000 [initandlisten] shutdown: final commit...
2014-11-12T19:09:00.176+0000 [initandlisten] shutdown: closing all files...
2014-11-12T19:09:00.178+0000 [initandlisten] closeAllFiles() finished
2014-11-12T19:09:00.178+0000 [initandlisten] journalCleanup...
2014-11-12T19:09:00.178+0000 [initandlisten] removeJournalFiles
2014-11-12T19:09:00.180+0000 [initandlisten] shutdown: removing fs lock...
2014-11-12T19:09:00.180+0000 [initandlisten] dbexit: really exiting now
-----
That's tail - the relevant part would be *before* mongod shuts down.
Oh, my bad! I thought that was the old mongod shutting down in the logs; thanks for the clue!
The problem seems to be here:
2014-11-14T18:37:12.958+0000 [initandlisten] options: { config: "/etc/mongod.conf.yaml", net: { bindIp: "127.0.0.1, 10.171.22.22, 50.22.22.22", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongo/mongod.log", quiet: true } }
2014-11-14T18:37:12.965+0000 [initandlisten] journal dir=/var/lib/mongo/journal
2014-11-14T18:37:12.965+0000 [initandlisten] recover : no journal files present, no recovery needed
2014-11-14T18:37:13.127+0000 [initandlisten] getaddrinfo(" 10.171.22.22") failed: Name or service not known
2014-11-14T18:37:13.131+0000 [initandlisten] getaddrinfo(" 50.22.22.22") failed: Name or service not known
2014-11-14T18:37:13.131+0000 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-11-14T18:37:13.131+0000 [initandlisten] ERROR: addr already in use
2014-11-14T18:37:13.133+0000 [initandlisten] now exiting
Commenting out the "bindIp:" line in the config seems to have fixed it.
댓글 없음:
댓글 쓰기