{"id":713,"date":"2019-03-14T17:24:00","date_gmt":"2019-03-14T09:24:00","guid":{"rendered":"https:\/\/wyxxt.org.cn\/?p=713"},"modified":"2023-12-04T16:49:43","modified_gmt":"2023-12-04T08:49:43","slug":"mongodb%e4%b8%a4%e4%b8%aa%e6%8a%a5%e9%94%99%e5%a4%84%e7%90%86%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/wyxxt.org.cn\/?p=713","title":{"rendered":"MONGODB\u4e24\u4e2a\u62a5\u9519\u5904\u7406\u65b9\u6cd5"},"content":{"rendered":"<h2>\u62a5\u9519\uff1a<\/h2>\n<pre><code class=\"language-shell line-numbers\">rico@ubuntu:~$ mongo\nMongoDB shell version: 3.2.17\nconnecting to: test\n2017-11-16T23:48:59.362+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused\n2017-11-16T23:48:59.362+0800 E QUERY    [thread1] Error: couldn\u2019t connect to server 127.0.0.1:27017, connection attempt failed :\nconnect@src\/mongo\/shell\/mongo.js:229:14\n@(connect):1:6\n\nexception: connect failed\n<\/code><\/pre>\n<h2>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/h2>\n<pre><code class=\"language-shell line-numbers\">sudo rm \/var\/lib\/mongodb\/mongod.lock\nsudo mongod --repair --dbpath \/var\/lib\/mongodb\nsudo mongod --fork --logpath \/var\/lib\/mongodb\/mongodb.log --dbpath \/var\/lib\/mongodb \nsudo service mongodb start\n<\/code><\/pre>\n<h2>\u62a5\u9519\uff1a<\/h2>\n<pre><code class=\"language-shell line-numbers\">rico@ubuntu:\/var\/lib\/mongodb$ sudo service mongodb start\nFailed to start mongodb.service: Unit mongodb.service is masked.\n<\/code><\/pre>\n<h2>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/h2>\n<pre><code class=\"language-shell line-numbers\">rico@ubuntu:\/var\/lib\/mongodb$ sudo chown -R mongodb:mongodb \/var\/lib\/mongodb\nrico@ubuntu:\/var\/lib\/mongodb$ sudo systemctl start mongod\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u62a5\u9519\uff1a rico@ubuntu:~$ mongo MongoDB shell version: 3.2.17  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[15],"tags":[393],"class_list":["post-713","post","type-post","status-publish","format-standard","hentry","category-15","tag-393"],"_links":{"self":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts\/713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=713"}],"version-history":[{"count":2,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts\/713\/revisions"}],"predecessor-version":[{"id":715,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=\/wp\/v2\/posts\/713\/revisions\/715"}],"wp:attachment":[{"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wyxxt.org.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}