在我的mongodb服务器上定期崩溃。它在DigitalOcean的4GB ubuntu 16.04.4小滴上运行。我增加了内存并且监控没有显示出高利用率,所以我怀疑这是我对如何配置mongo的某种误解。
我正在使用全文搜索,并且已经建立了索引,但我感觉它不太正确。
这是最新的mongo(社区版全新安装,3.4)。 Mongo在启动时警告我,我真的应该使用XFS而不是ext4,但这是唯一的警告。我怀疑这是否是一个问题。
有什么想法吗?
相关的日志条目是:
2017-06-05T21:35:13.545+0000 I COMMAND [conn5] command eagle.devices command: find { find: "devices", filter: { $text: { $search: "*55" } }, projection: { score: { $meta: "textScore" }, _id: 1, name: 1, descriptions: 1 }, limit: 10 } planSummary: IXSCAN { _fts: "text", _ftsx: 1 } keysExamined:6834 docsExamined:6834 cursorExhausted:1 numYields:161 nreturned:10 reslen:11410 locks:{ Global: { acquireCount: { r: 326 } }, Database: { acquireCount: { r: 163 } }, Collection: { acquireCount: { r: 163 } } } protocol:op_query 3163ms
2017-06-05T21:35:17.011+0000 F - [conn5] out of memory.
回溯:
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"55A9B8BBD000","o":"1576BE1","s":"_ZN5mongo15printStackTraceERSo"},{"b":"55A9B8BBD000","o":"15760F4","s":"_ZN5mongo29reportOutOfMemoryErrorAndExitEv"},{"b":"55A9B8BBD000","o":"14E2401","s":"_ZN5mongo11mongoMallocEm"},{"b":"55A9B8BBD000","o":"8A8BB2","s":"_ZNK5mongo7BSONObj4copyEv"},{"b":"55A9B8BBD000","o":"8A8C69","s":"_ZNK5mongo7BSONObj8getOwnedEv"},{"b":"55A9B8BBD000","o":"BD4C54","s":"_ZN5mongo16WorkingSetMember20makeObjOwnedIfNeededEv"},{"b":"55A9B8BBD000","o":"BCD278","s":"_ZN5mongo11TextOrStage7addTermEmPm"},{"b":"55A9B8BBD000","o":"BCD46F","s":"_ZN5mongo11TextOrStage16readFromChildrenEPm"},{"b":"55A9B8BBD000","o":"B9F343","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55A9B8BBD000","o":"BCA81F","s":"_ZN5mongo14TextMatchStage6doWorkEPm"},{"b":"55A9B8BBD000","o":"B9F343","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55A9B8BBD000","o":"B9F343","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55A9B8BBD000","o":"BA1F67","s":"_ZN5mongo15ProjectionStage6doWorkEPm"},{"b":"55A9B8BBD000","o":"B9F343","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55A9B8BBD000","o":"BB018E","s":"_ZN5mongo9SkipStage6doWorkEPm"},{"b":"55A9B8BBD000","o":"B9F343","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55A9B8BBD000","o":"B933B6","s":"_ZN5mongo10LimitStage6doWorkEPm"},{"b":"55A9B8BBD000","o":"B9F343","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55A9B8BBD000","o":"EA505A","s":"_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE"},{"b":"55A9B8BBD000","o":"EA597B","s":"_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE"},{"b":"55A9B8BBD000","o":"A8B1B4","s":"_ZN5mongo7FindCmd3runEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS8_RNS_14BSONObjBuilderE"},{"b":"55A9B8BBD000","o":"A61DA7","s":"_ZN5mongo7Command3runEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS3_21ReplyBuilderInterfaceE"},{"b":"55A9B8BBD000","o":"A63139","s":"_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE"},{"b":"55A9B8BBD000","o":"1080D5D","s":"_ZN5mongo11runCommandsEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS2_21ReplyBuilderInterfaceE"},{"b":"55A9B8BBD000","o":"C7F552"},{"b":"55A9B8BBD000","o":"C814C6","s":"_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE"},{"b":"55A9B8BBD000","o":"88042D","s":"_ZN5mongo23ServiceEntryPointMongod12_sessionLoopERKSt10shared_ptrINS_9transport7SessionEE"},{"b":"55A9B8BBD000","o":"880D6D"},{"b":"55A9B8BBD000","o":"14DCC52"},{"b":"7FE3A24BF000","o":"76BA"},{"b":"7FE3A20F6000","o":"10682D","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.4.4", "gitVersion" : "888390515874a9debd1b6c5d36559ca86b44babd", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.4.0-78-generic", "version" : "#99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017", "machine" : "x86_64" }, "somap" : [ { "b" : "55A9B8BBD000", "elfType" : 3, "buildId" : "5754B63E6FC9683BABEC9CDF7BF6764E6939C8A2" }, { "b" : "7FFD3BDF8000", "elfType" : 3, "buildId" : "4C93E2706C4247EB8ED67A60A6D83F3D740DFD8E" }, { "b" : "7FE3A344B000", "path" : "/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "7F514146540382F59AD705BA8C913A75204C6858" }, { "b" : "7FE3A3007000", "path" : "/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "E6D4D2E4A048992CD5501E5985094E6CEC6C5D4F" }, { "b" : "7FE3A2DFF000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "0DBB8C21FC5D977098CA718BA2BFD6C4C21172E9" }, { "b" : "7FE3A2BFB000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "C0C5B7F18348654040534B050B110D32A19EA38D" }, { "b" : "7FE3A28F2000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "05451CB4D66C321691F64F253880B7CE5B8812A6" }, { "b" : "7FE3A26DC000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "68220AE2C65D65C1B6AAA12FA6765A6EC2F5F434" }, { "b" : "7FE3A24BF000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "84538E3C6CFCD5D4E3C0D2B6C3373F802915A498" }, { "b" : "7FE3A20F6000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "CBFA941A8EB7A11E4F90E81B66FCD5A820995D7C" }, { "b" : "7FE3A36B4000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "A7D5A820B802049276B1FC26C8E845A3E194EB6B" } ] }}
mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x55a9ba133be1]
mongod(_ZN5mongo29reportOutOfMemoryErrorAndExitEv+0x84) [0x55a9ba1330f4]
mongod(_ZN5mongo11mongoMallocEm+0x21) [0x55a9ba09f401]
mongod(_ZNK5mongo7BSONObj4copyEv+0x22) [0x55a9b9465bb2]
mongod(_ZNK5mongo7BSONObj8getOwnedEv+0x59) [0x55a9b9465c69]
mongod(_ZN5mongo16WorkingSetMember20makeObjOwnedIfNeededEv+0x54) [0x55a9b9791c54]
mongod(_ZN5mongo11TextOrStage7addTermEmPm+0x688) [0x55a9b978a278]
mongod(_ZN5mongo11TextOrStage16readFromChildrenEPm+0x6F) [0x55a9b978a46f]
mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55a9b975c343]
mongod(_ZN5mongo14TextMatchStage6doWorkEPm+0x6F) [0x55a9b978781f]
mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55a9b975c343]
mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55a9b975c343]
mongod(_ZN5mongo15ProjectionStage6doWorkEPm+0x47) [0x55a9b975ef67]
mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55a9b975c343]
mongod(_ZN5mongo9SkipStage6doWorkEPm+0x3E) [0x55a9b976d18e]
mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55a9b975c343]
mongod(_ZN5mongo10LimitStage6doWorkEPm+0x76) [0x55a9b97503b6]
mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55a9b975c343]
mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0x19A) [0x55a9b9a6205a]
mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x4B) [0x55a9b9a6297b]
mongod(_ZN5mongo7FindCmd3runEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS8_RNS_14BSONObjBuilderE+0x1054) [0x55a9b96481b4]
mongod(_ZN5mongo7Command3runEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS3_21ReplyBuilderInterfaceE+0x527) [0x55a9b961eda7]
mongod(_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE+0x9D9) [0x55a9b9620139]
mongod(_ZN5mongo11runCommandsEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS2_21ReplyBuilderInterfaceE+0x26D) [0x55a9b9c3dd5d]
mongod(+0xC7F552) [0x55a9b983c552]
mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x6D6) [0x55a9b983e4c6]
mongod(_ZN5mongo23ServiceEntryPointMongod12_sessionLoopERKSt10shared_ptrINS_9transport7SessionEE+0x1ED) [0x55a9b943d42d]
mongod(+0x880D6D) [0x55a9b943dd6d]
mongod(+0x14DCC52) [0x55a9ba099c52]
libpthread.so.0(+0x76BA) [0x7fe3a24c66ba]
libc.so.6(clone+0x6D) [0x7fe3a21fc82d]
----- END BACKTRACE -----
而且,如果您还在阅读,请输出以下表格" service mongod status":
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-06-05 23:53:35 UTC; 12s ago
Docs: https://docs.mongodb.org/manual
Process: 4959 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 4959 (code=exited, status=14)
Jun 05 23:53:28 sp-mongo-0 systemd[1]: Started High-performance, schema-free document-oriented database.
Jun 05 23:53:35 sp-mongo-0 mongod[4959]: src/third_party/gperftools-2.5/src/central_freelist.cc:333] tcmalloc: allocation failed 12288
Jun 05 23:53:35 sp-mongo-0 mongod[4959]: src/third_party/gperftools-2.5/src/central_freelist.cc:333] tcmalloc: allocation failed 8192
Jun 05 23:53:35 sp-mongo-0 mongod[4959]: src/third_party/gperftools-2.5/src/central_freelist.cc:333] tcmalloc: allocation failed 20480
Jun 05 23:53:35 sp-mongo-0 mongod[4959]: src/third_party/gperftools-2.5/src/central_freelist.cc:333] tcmalloc: allocation failed 20480
Jun 05 23:53:35 sp-mongo-0 systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Jun 05 23:53:35 sp-mongo-0 systemd[1]: mongod.service: Unit entered failed state.
Jun 05 23:53:35 sp-mongo-0 systemd[1]: mongod.service: Failed with result 'exit-code'.
答案 0 :(得分:0)
使用带有文字索引$text: { $search: "*55" }
的通配符进行搜索可能是not supported。
答案 1 :(得分:0)
原来这就是错误告诉我的。我没有给予mongo足够的记忆。我最终只是扩展了虚拟机,问题就消失了。
我还发现了一些没有被编入索引的字段,这会给内存带来压力并修复这些字段,但我不认为我的部署可能会因错过的索引而失败。
我也停止使用mongo的全文搜索,主要是因为它不是全文搜索;它实际上是一个单词搜索,我想找到一个单词开头的内容。所以我最终将弹性搜索添加到我的系统中。