查看日志文件:
root@controller:/var/log/ceilometer# cat ceilometer-api.log
2017-05-31 13:57:31.620 23249 TRACE ceilometer.api.hooks ConnectionFailure: could not connect to controller:27017: [Errno 111] ECONNREFUSED
2017-05-31 13:57:31.620 23249 TRACE ceilometer.api.hooks
2017-05-31 13:57:31.749 23249 INFO ceilometer.storage.mongo.utils [-] Connecting to mongodb on [('controller', 27017)]
2017-05-31 13:57:31.750 23249 WARNING ceilometer.storage.mongo.utils [-] Unable to connect to the database server: could not connect to controller:27017: [Errno 111] ECONNREFUSED.
2017-05-31 13:57:41.751 23249 INFO ceilometer.storage.mongo.utils [-] Connecting to mongodb on [('controller', 27017)]
2017-05-31 13:57:41.751 23249 WARNING ceilometer.storage.mongo.utils [-] Unable to connect to the database server: could not connect to controller:27017: [Errno 111] ECONNREFUSED.
2017-05-31 13:57:51.752 23249 INFO ceilometer.storage.mongo.utils [-] Connecting to mongodb on [('controller', 27017)]
2017-05-31 13:57:51.752 23249 WARNING ceilometer.storage.mongo.utils [-] Unable to connect to the database server: could not connect to controller:27017: [Errno 111] ECONNREFUSED.
2017-05-31 13:58:01.762 23249 INFO ceilometer.storage.mongo.utils [-] Connecting to mongodb on [('controller', 27017)]
2017-05-31 13:58:01.762 23249 WARNING ceilometer.storage.mongo.utils [-] Unable to connect to the database server: could not connect to controller:27017: [Errno 111] ECONNREFUSED.
根据日志文件判断为 Mongodb的错误
root@controller:/var/log/mongodb# cat mongodb.log
***** SERVER RESTARTED *****
Wed May 31 11:25:53.786 [initandlisten] MongoDB starting : pid=1779 port=27017 dbpath=/var/lib/mongodb 64-bit host=controller
Wed May 31 11:25:53.786 [initandlisten] db version v2.4.9
Wed May 31 11:25:53.786 [initandlisten] git version: nogitversion
Wed May 31 11:25:53.786 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Wed May 31 11:25:53.786 [initandlisten] allocator: tcmalloc
Wed May 31 11:25:53.786 [initandlisten] options: { bind_ip: "192.168.1.170", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", nojournal: "true", noprealloc: "true", smallfiles: "true" }
**************
**Unclean shutdown detected.**
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Wed May 31 11:25:53.797 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Wed May 31 11:25:53.797 dbexit:
Wed May 31 11:25:53.797 [initandlisten] shutdown: going to close listening sockets...
Wed May 31 11:25:53.797 [initandlisten] shutdown: going to flush diaglog...
Wed May 31 11:25:53.797 [initandlisten] shutdown: going to close sockets...
Wed May 31 11:25:53.797 [initandlisten] shutdown: waiting for fs preallocator...
Wed May 31 11:25:53.797 [initandlisten] shutdown: closing all files...
Wed May 31 11:25:53.797 [initandlisten] closeAllFiles() finished
Wed May 31 11:25:53.797 dbexit: really exiting now
可以看出错误为Unclean shutdown detected. 然后根据此百度查找方法,解决方案 记得要修改数据库文件为 mongdb用户和组