{"id":264701,"date":"2023-03-16T09:08:37","date_gmt":"2023-03-16T01:08:37","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=264701"},"modified":"2023-02-20T20:11:11","modified_gmt":"2023-02-20T12:11:11","slug":"rhjkmsjkxn","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/rhjkmsjkxn.html","title":{"rendered":"\u5982\u4f55\u76d1\u63a7MongoDB\u6570\u636e\u5e93\u6027\u80fd"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6700\u8fd1\u9879\u76ee\u5728\u4f7f\u7528MongoDB\u4f5c\u4e3a\u56fe\u7247\u548c\u6587\u6863\u7684\u5b58\u50a8\u6570\u636e\u5e93\uff0c\u4e3a\u5565\u4e0d\u76f4\u63a5\u5b58MySQL\u91cc\uff0c\u8fd8\u8981\u642d\u4e2aMongoDB\u96c6\u7fa4\uff0c\u9ebb\u4e0d\u9ebb\u70e6\uff1f\u8ba9\u6211\u4eec\u4e00\u8d77\uff0c\u4e00\u63a2\u7a76\u7adf\uff0c\u7ee7\u7eed\u5b66\u4e60MongoDB\u6570\u636e\u5e93\u6027\u80fd\u76d1\u63a7\uff0c\u5b9e\u73b0\u5feb\u901f\u5165\u95e8\uff0c\u4e30\u5bcc\u4e2a\u4eba\u7b80\u5386\uff0c\u63d0\u9ad8\u9762\u8bd5level\uff0c\u7ed9\u81ea\u5df1\u589e\u52a0\u4e00\u70b9\u8c08\u8d44\uff0c\u79d2\u53d8\u9762\u8bd5\u5c0f\u8fbe\u4eba\uff0cBAT\u4e0d\u662f\u68a6\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u4e00\u3001MongoDB\u542f\u52a8\u6162<\/strong><\/div>\n
1\u3001\u542f\u52a8\u65e5\u5e38\u5361\u4f4f<\/strong><\/span><\/div>\n

\u6839\u672c\u4e0d\u7528\u4e3a\u4e86\u622a\u5c4f\u800c\u5feb\u901f\u64cd\u4f5c\uff0cMongoDB\u542f\u52a8\u771f\u7684\u8d85\u7ea7\u6162\u3002<\/p>\n

\"\"<\/p>\n

\"\"<\/p>\n

2\u3001\u542f\u52a8MongoDB\u914d\u7f6e\u670d\u52a1\u5668\uff0c\u95f4\u6b47\u6027\u5931\u8d25<\/strong><\/span><\/div>\n

\"\"<\/p>\n

\"\"<\/p>\n

3\u3001\u67e5\u770bMongoDB\u65e5\u5fd7\uff0c\u5206\u6790\u201cMongoDB\u542f\u52a8\u6162\u201d\u7684\u539f\u56e0<\/strong><\/span><\/div>\n

\"\"<\/p>\n

4\u3001\u8017\u65f6\u201c\u4e00\u5c0f\u65f6\u201d\uff0cMongoDB\u542f\u52a8\u6210\u529f\uff01<\/strong><\/span><\/div>\n

\"\"<\/p>\n

\u4e8c\u3001\u539f\u56e0\u5206\u6790<\/strong><\/div>\n

\u5728MongoDB\u5173\u95ed\u4e4b\u524d\uff0c\u6709\u8f83\u5927\u7684\u7d22\u5f15\u5efa\u7acb\u7684\u64cd\u4f5c\u6ca1\u6709\u5b8c\u6210\uff0cMongoDB\u5c31\u76f4\u63a5shutdown\u4e86\uff0c\u7b49MongoDB\u518d\u6b21\u542f\u52a8\u7684\u65f6\u5019\uff0cMongoDB\u9ed8\u8ba4\u4f1a\u5c06\u8fd9\u4e2aindex\u91cd\u5efa\u597d\uff0c\u91cd\u5efa\u671f\u95f4\u5904\u4e8estartup\u72b6\u6001\u3002<\/p>\n

\u7531\u4e8e\u4e0d\u6e05\u695a\u91cd\u5efa\u7d22\u5f15\u9700\u8981\u591a\u4e45\uff0c\u56e0\u6b64\u53ef\u4ee5\u901a\u8fc7\u91cd\u542fmongod\u65f6\u52a0\u4e0a\u2013noIndexBuildRetry\u53c2\u6570\u6765\u8df3\u8fc7\u7d22\u5f15\u91cd\u5efa\u3002\u7b49\u542f\u52a8\u5b8c\u6210\u540e\uff0c\u518d\u521b\u5efa\u8fd9\u4e2a\u7d22\u5f15\u3002<\/p>\n

\u4e0b\u9762\u4ece\u51e0\u65b9\u9762\uff0c\u76d1\u63a7\u4e00\u4e0bMongoDB\u7684\u6027\u80fd\u95ee\u9898\u3002<\/p>\n

\u4e09\u3001MongoDB\u5185\u5b58\u4f7f\u7528<\/strong><\/div>\n

\"\"<\/p>\n

  • \u5e38\u9a7b\u5185\u5b58\uff1a\u5e38\u9a7b\u5185\u5b58\u662fMongoDB\u5728RAM\u4e2d\u663e\u5f0f\u62e5\u6709\u7684\u5185\u5b58\u3002\u5982\u679c\u67e5\u8be2\u4e00\u4e2a\u96c6\u5408\u6570\u636e\uff0cMongoDB\u4f1a\u5c06\u5176\u653e\u5165\u5e38\u9a7b\u5185\u5b58\u4e2d\uff0cMongoDB\u4f1a\u83b7\u5f97\u5176\u5730\u5740\uff0c\u8fd9\u4e2a\u5730\u5740\u4e0d\u662fRAM\u4e2d\u6570\u636e\u7684\u771f\u5b9e\u5730\u5740\uff0c\u800c\u662f\u4e00\u4e2a\u865a\u62df\u5730\u5740\u3002MongoDB\u53ef\u4ee5\u5c06\u5b83\u4f20\u9012\u7ed9\u5185\u6838\uff0c\u5185\u6838\u4f1a\u67e5\u627e\u51fa\u6570\u636e\u7684\u771f\u5b9e\u4f4d\u7f6e\u3002\u5982\u679c\u5185\u6838\u9700\u8981\u4ece\u5185\u5b58\u4e2d\u6e05\u7406\u7f13\u5b58\uff0cMongoDB\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u8be5\u5730\u5740\u5bf9\u5176\u8fdb\u884c\u8bbf\u95ee\u3002MongoDB\u4f1a\u5411\u5185\u6838\u8bf7\u6c42\u5185\u5b58\uff0c\u7136\u540e\u5185\u6838\u4f1a\u67e5\u770b\u6570\u636e\u7f13\u5b58\uff0c\u5982\u679c\u53d1\u73b0\u6570\u636e\u4e0d\u5b58\u5728\uff0c\u5c31\u4f1a\u4ea7\u751f\u7f3a\u9875\u9519\u8bef\u5e76\u5c06\u6570\u636e\u590d\u5236\u5230\u5185\u5b58\u4e2d\uff0c\u6700\u540e\u518d\u8fd4\u7ed9MongoDB\u3002<\/li>\n
  • \u865a\u62df\u5185\u5b58\uff1a\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u4e00\u79cd\u62bd\u8c61\uff0c\u5b83\u5bf9\u8f6f\u4ef6\u8fdb\u7a0b\u9690\u85cf\u4e86\u7269\u7406\u5b58\u50a8\u7684\u7ec6\u8282\u3002\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u53ef\u4ee5\u770b\u5230\u4e00\u4e2a\u8fde\u7eed\u7684\u5185\u5b58\u5730\u5740\u7a7a\u95f4\u3002\u5728Ops Manager\u4e2d\uff0cMongoDB\u7684\u865a\u62df\u5185\u5b58\u662f\u6620\u5c04\u5185\u5b58\u7684\u4e24\u500d\u3002<\/li>\n
  • \u6620\u5c04\u5185\u5b58\uff1a\u5305\u542bMongoDB\u66fe\u7ecf\u8bbf\u95ee\u8fc7\u7684\u6240\u6709\u6570\u636e\u3002<\/li>\n
    \u56db\u3001MongoDB\u78c1\u76d8\u7a7a\u95f4<\/strong><\/div>\n

    \u5f53\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u65f6\uff0c\u53ef\u4ee5\u8fdb\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n

  • \u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u5206\u7247\uff1b<\/li>\n
  • \u5220\u9664\u672a\u4f7f\u7528\u7684\u7d22\u5f15\uff1b<\/li>\n
  • \u53ef\u4ee5\u6267\u884c\u538b\u7f29\u64cd\u4f5c\uff1b<\/li>\n
  • \u5173\u95ed\u526f\u672c\u96c6\u6210\u5458\uff0c\u5c06\u5176\u6570\u636e\u590d\u5236\u5230\u66f4\u5927\u7684\u78c1\u76d8\u4e2d\u6302\u8f7d;<\/li>\n
  • \u7528\u8f83\u5927\u9a71\u52a8\u5668\u7684\u6210\u5458\u66ff\u6362\u526f\u672c\u96c6\u4e2d\u7684\u6210\u5458\uff1b<\/li>\n
    \u4e94\u3001\u5e38\u7528\u547d\u4ee4<\/strong><\/div>\n
    1\u3001MongoDB\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f<\/strong><\/span><\/div>\n
    db.hostInfo()<\/pre>\n

    \"\"<\/p>\n

    2\u3001MongoDB\u83b7\u53d6\u7cfb\u7edf\u5185\u5b58\u60c5\u51b5<\/strong><\/span><\/div>\n
    db.serverStatus().mem<\/pre>\n

    \"\"<\/p>\n

    3\u3001MongoDB\u83b7\u53d6\u8fde\u63a5\u6570\u4fe1\u606f<\/strong><\/span><\/div>\n
    db.serverStatus().connections<\/pre>\n

    \"\"<\/p>\n

    4\u3001MongoDB\u83b7\u53d6\u5168\u5c40\u9501\u4fe1\u606f<\/strong><\/span><\/div>\n
    db.serverStatus().globalLock<\/pre>\n

    \"\"<\/p>\n

    5\u3001MongoDB\u83b7\u53d6\u64cd\u4f5c\u7edf\u8ba1\u8ba1\u6570\u5668<\/strong><\/span><\/div>\n
    db.serverStatus().opcounters<\/pre>\n

    \"\"<\/p>\n

    6\u3001MongoDB\u83b7\u53d6\u6570\u636e\u5e93\u72b6\u6001\u4fe1\u606f<\/strong><\/span><\/div>\n
    db.stats()<\/pre>\n

    \"\"<\/p>\n

    \u4ee5\u4e0a\u662fMongoDB\u7684\u91cd\u8981\u6307\u6807\uff0c\u901a\u8fc7\u8fd9\u4e9b\u6307\u6807\u6211\u4eec\u53ef\u4ee5\u4e86\u89e3\u5230MongoDB\u7684\u8fd0\u884c\u72b6\u6001\uff0c\u8bc4\u4f30\u6570\u636e\u5e93\u7684\u5065\u5eb7\u7a0b\u5ea6\uff0c\u5e76\u5feb\u901f\u786e\u5b9a\u5b9e\u9645\u9879\u76ee\u4e2d\u9047\u5230\u7684\u6027\u80fd\u74f6\u9888\u3002<\/p>\n

    \u6bd4\u5982\u9879\u76ee\u4e2d\u9047\u5230\u7684Timeout\u5f02\u5e38\uff1a<\/p>\n

    \r\ncom.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message\r\n  at com.mongodb.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:475)\r\n  at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:226)\r\n  at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:105)\r\n  at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:438)\r\n  at com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:112)\r\n  at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:168)\r\n  at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:289)\r\n  at com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:176)\r\n  at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:216)\r\n  at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:207)\r\n  at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:113)\r\n  at com.mongodb.operation.FindOperation$1.call(FindOperation.java:488)\r\n  at com.mongodb.operation.FindOperation$1.call(FindOperation.java:1)\r\n  at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:241)\r\n  at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:214)\r\n  at com.mongodb.operation.FindOperation.execute(FindOperation.java:483)\r\n  at com.mongodb.operation.FindOperation.execute(FindOperation.java:1)\r\n  at com.mongodb.Mongo.execute(Mongo.java:818)\r\n<\/pre>\n
    \u516d\u3001MongoDB\u6301\u4e45\u6027<\/strong><\/div>\n
    1\u3001\u590d\u5236\u5ef6\u8fdf<\/strong><\/span><\/div>\n

    \u590d\u5236\u5ef6\u8fdf\u662f\u6307\u4ece\u8282\u70b9\u65e0\u6cd5\u8ddf\u4e0a\u4e3b\u8282\u70b9\u7684\u901f\u5ea6\u3002<\/p>\n

    \u4ece\u8282\u70b9\u4e00\u4e2a\u64cd\u4f5c\u7684\u65f6\u95f4\u51cf\u53bb\u4e3b\u8282\u70b9\u6b64\u64cd\u4f5c\u7684\u65f6\u95f4\uff0c\u5c31\u662f\u590d\u5236\u5ef6\u8fdf\u3002\u5ef6\u8fdf\u5e94\u8be5\u5c3d\u53ef\u80fd\u7684\u63a5\u8fd10\uff0c\u5e76\u4e14\u901a\u5e38\u662f\u6beb\u79d2\u7ea7\u7684\u3002<\/p>\n

    2\u3001\u5907\u4efd<\/strong><\/span><\/div>\n

    \u5907\u4efd\u64cd\u4f5c\u901a\u5e38\u4f1a\u5c06\u6240\u6709\u6570\u636e\u8bfb\u5165\u5185\u5b58\uff0c\u56e0\u6b64\uff0c\u5907\u4efd\u64cd\u4f5c\u901a\u5e38\u5e94\u8be5\u5728\u526f\u672c\u96c6\u4ece\u8282\u70b9\u800c\u4e0d\u662f\u4e3b\u8282\u70b9\u8fdb\u884c\uff0c\u5982\u679c\u662f\u5355\u673aMongoDB\uff0c\u5219\u5e94\u8be5\u5728\u7a7a\u95f4\u65f6\u95f4\u8fdb\u884c\u5907\u4efd\uff0c\u6bd4\u5982\u6df1\u591c\u51cc\u6668\u3002<\/p>\n

    3\u3001\u6301\u4e45\u6027<\/strong><\/span><\/div>\n

    \u6301\u4e45\u6027\u662f\u6570\u636e\u5e93\u5fc5\u5907\u7684\u4e00\u79cd\u7279\u6027\uff0c\u60f3\u8c61\u4e00\u4e0b\uff0c\u5982\u679c\u6570\u636e\u5e93\u4e0d\u5177\u5907\u6301\u4e45\u6027\uff0c\u5982\u679c\u6570\u636e\u5e93\u91cd\u542f\uff0c\u6570\u636e\u5168\u90e8\u4e22\u5931\uff0c\u592a\u53ef\u6015\u4e86\uff0c\u4e0d\u6562\u60f3\u3002<\/p>\n

    \u4e3a\u4e86\u5728\u670d\u52a1\u5668\u53d1\u751f\u6545\u969c\u65f6\u63d0\u4f9b\u6301\u4e45\u6027\uff0cMongoDB\u4f7f\u7528\u9884\u5199\u5f0f\u65e5\u5fd7\u673a\u5236\uff0c\u82f1\u6587\u7b80\u79f0 WAL\u3002WAL\u662f\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\u4e00\u79cd\u5e38\u89c1\u7684\u6301\u4e45\u6027\u6280\u672f\u3002\u5728\u6570\u636e\u5b58\u5165\u6570\u636e\u5e93\u4e4b\u524d\uff0c\u5c06\u8fd9\u4e9b\u66f4\u6539\u64cd\u4f5c\u5199\u5230\u78c1\u76d8\u4e0a\u3002<\/p>\n

    \u4eceMongoDB4.0\u5f00\u59cb\uff0c\u6267\u884c\u5199\u64cd\u4f5c\u65f6\uff0cMongoDB\u4f1a\u4f7f\u7528\u4e0eoplog\u76f8\u540c\u7684\u683c\u5f0f\u521b\u5efa\u65e5\u5fd7\u3002oplog\u8bed\u53e5\u5177\u6709\u5e42\u7b49\u6027\uff0c\u4e0d\u7ba1\u6267\u884c\u591a\u5c11\u6b21\uff0c\u7ed3\u679c\u90fd\u662f\u4e00\u6837\u7684\u3002<\/p>\n

    MongoDB\u8fd8\u7ef4\u62a4\u4e86\u65e5\u5fd7\u548c\u6570\u636e\u5e93\u6570\u636e\u6587\u4ef6\u7684\u5185\u5b58\u89c6\u56fe\u3002\u9ed8\u8ba4\u60c5\u51b5\uff0c\u6bcf50\u6beb\u79d2\u4f1a\u5c06\u65e5\u5fd7\u6761\u76ee\u5237\u65b0\u5230\u78c1\u76d8\u4e0a\uff0c\u6bcf60\u79d2\u4f1a\u5c06\u6570\u636e\u5e93\u6587\u4ef6\u5237\u65b0\u5230\u78c1\u76d8\u4e0a\u3002\u5237\u65b0\u6570\u636e\u7684\u65f6\u95f460\u79d2\u95f4\u9694\u88ab\u79f0\u4e3a\u68c0\u67e5\u70b9\u3002\u65e5\u5fd7\u7528\u4e8e\u5c06\u4e0a\u4e00\u4e2a\u68c0\u67e5\u70b9\u4e4b\u540e\u7684\u6570\u636e\u63d0\u4f9b\u6301\u4e45\u6027\u3002MongoDB\u7684\u6301\u4e45\u6027\u5c31\u662f\u5728\u53d1\u751f\u6545\u969c\u65f6\uff0c\u91cd\u542f\u4e4b\u540e\uff0c\u5c06\u65e5\u5fd7\u4e2d\u7684\u8bed\u53e5\u91cd\u65b0\u6267\u884c\u4e00\u904d\uff0c\u4ee5\u4fdd\u8bc1\u5728\u5173\u95ed\u524d\u4e22\u5931\u7684\u6570\u636e\u91cd\u65b0\u5237\u65b0\u5230MongoDB\u4e2d\u3002<\/p>\n

    MongoDB\u4f1a\u5728data\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2ajournal\u7684\u5b50\u76ee\u5f55\uff0cWiredTiger\u65e5\u5fd7\u6587\u4ef6\u7684\u540d\u79f0\u4e3aWiredTigerLog.\u3002sequence\u662f\u4e00\u4e2a\u4ece0 000 000 001\u5f00\u59cb\u7684\u6570\u5b57\u3002<\/p>\n

    \"\"<\/p>\n

    MongoDB\u4f1a\u5bf9\u5199\u5165\u7684\u65e5\u5fd7\u8fdb\u884c\u538b\u7f29\uff0c\u65e5\u5fd7\u6587\u4ef6\u9650\u5236\u7684\u6700\u5927\u5927\u5c0f\u4e3a100MB\u3002\u5982\u679c\u5927\u4e8e100MB\uff0cMongoDB\u5c31\u4f1a\u81ea\u52a8\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u7531\u4e8e\u65e5\u5fd7\u6587\u4ef6\u53ea\u9700\u5728\u4e0a\u6b21\u68c0\u67e5\u70b9\u4e4b\u540e\u6062\u590d\u6570\u636e\uff0c\u56e0\u6b64\u5728\u65b0\u7684\u68c0\u67e5\u70b9\u5199\u5165\u5b8c\u6210\u65f6\uff0c\u65e7\u7684\u65e5\u5fd7\u6587\u4ef6\u5c31\u4f1a\u88ab\u5220\u9664\u3002<\/sequence><\/p>\n","protected":false},"excerpt":{"rendered":"

    \u6839\u672c\u4e0d\u7528\u4e3a\u4e86\u622a\u5c4f\u800c\u5feb\u901f\u64cd\u4f5c\uff0cMongoDB\u542f\u52a8\u771f\u7684\u8d85\u7ea7\u6162\u3002 \u5728MongoDB\u5173\u95ed\u4e4b\u524d\uff0c\u6709\u8f83\u5927\u7684\u7d22\u5f15\u5efa\u7acb\u7684\u64cd\u4f5c\u6ca1 […]<\/p>\n","protected":false},"author":1920,"featured_media":95922,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-264701","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/264701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1920"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=264701"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/264701\/revisions"}],"predecessor-version":[{"id":264723,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/264701\/revisions\/264723"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/95922"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=264701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=264701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=264701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}