質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
MongoDB

MongoDBはオープンソースのドキュメント指向データベースの1つです。高性能で、多くのリトルエンディアンシステムを利用することができます。

Q&A

解決済

1回答

1068閲覧

mongodbが開かなくなってしまった.

mote

総合スコア128

MongoDB

MongoDBはオープンソースのドキュメント指向データベースの1つです。高性能で、多くのリトルエンディアンシステムを利用することができます。

0グッド

0クリップ

投稿2019/06/10 04:26

編集2019/06/10 04:42

ターミナルで,$mongo と記入すると,次の様なメッセージが,,,

motegiyuuta:~ motegiyuta$ mongo MongoDB shell version v4.0.1 connecting to: mongodb://127.0.0.1:27017 2019-06-10T13:17:51.738+0900 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:257:13 @(connect):1:6 exception: connect failed

mysqlをいじくってからこのように,mongodbまで使えなくなってしまったような気がします.
PC内でプロセスが被っているのでしょうか?

mysqlを使ってもsocketエラーが発生します.

motegiyuuta:~ motegiyuta$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)

mongodb エラー

motegiyuuta:~ motegiyuta$ mongod -dbpath /usr/local/var/mongodb 2019-06-10T13:39:21.323+0900 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none' 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] MongoDB starting : pid=31425 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=motegiyuuta.local 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] db version v4.0.1 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] git version: 54f1582fc6eb01de4d4c42f26fc133e623f065fb 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] allocator: system 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] modules: none 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] build environment: 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] distarch: x86_64 2019-06-10T13:39:21.444+0900 I CONTROL [initandlisten] target_arch: x86_64 2019-06-10T13:39:21.445+0900 I CONTROL [initandlisten] options: { storage: { dbPath: "/usr/local/var/mongodb" } } 2019-06-10T13:39:21.453+0900 I STORAGE [initandlisten] Detected data files in /usr/local/var/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'. 2019-06-10T13:39:21.454+0900 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1536M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress), 2019-06-10T13:39:22.581+0900 I STORAGE [initandlisten] WiredTiger message [1560141562:581092][31425:0x1166055c0], txn-recover: Main recovery loop: starting at 28/10880 2019-06-10T13:39:22.728+0900 I STORAGE [initandlisten] WiredTiger message [1560141562:728247][31425:0x1166055c0], txn-recover: Recovering log 28 through 29 2019-06-10T13:39:22.823+0900 I STORAGE [initandlisten] WiredTiger message [1560141562:823366][31425:0x1166055c0], txn-recover: Recovering log 29 through 29 2019-06-10T13:39:22.894+0900 I STORAGE [initandlisten] WiredTiger message [1560141562:894475][31425:0x1166055c0], txn-recover: Set global recovery timestamp: 0 2019-06-10T13:39:23.087+0900 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0) 2019-06-10T13:39:23.212+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.212+0900 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 2019-06-10T13:39:23.374+0900 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/usr/local/var/mongodb/diagnostic.data' 2019-06-10T13:39:23.382+0900 I NETWORK [initandlisten] waiting for connections on port 27017

ここで止まってしまいます

mysql socketエラー
この辺片っ端から調べてみても,治りませんでした.

別にmysqlが使えなくても,MongoDBだけ使えればよいのですが,
この二つのエラーは関係していると思っていました.

どなたかこのようなsocketエラーの解決方法をご存知の方がいれば
非常に助かります.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

mote

2019/06/10 04:33

かしこまりました
guest

回答1

0

ベストアンサー

まさかとは思いますが、コマンドの順番は大丈夫ですか?

mongod -dbpath /usr/local/var/mongodb

を実行してサーバ(mongod)を立ち上げておいて、その後に

mongo

の順で、普通はつながるはずなのですが。

投稿2019/06/10 14:26

kabao

総合スコア648

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

mote

2019/06/10 14:55

少し時間を置いたら$mongoのエラーが変わりました. これは治っているのでしょうか? motegiyuuta:~ motegiyuta$ mongo MongoDB shell version v4.0.1 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 4.0.1 Server has startup warnings: 2019-06-10T13:39:23.212+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.212+0900 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning. 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] 2019-06-10T13:39:23.213+0900 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 --- Enable MongoDB's free cloud-based monitoring service, which will then receive and display metrics about your deployment (disk utilization, CPU, operation statistics, etc). The monitoring data will be available on a MongoDB website with a unique URL accessible to you and anyone you share the URL with. MongoDB may use this information to make product improvements and to suggest MongoDB products and deployment options to you. To enable free monitoring, run the following command: db.enableFreeMonitoring() To permanently disable this reminder, run the following command: db.disableFreeMonitoring() --- >
kabao

2019/06/10 15:00

最後に>が出てるので、つながってますね。 念のためshow dbsとか打って、DB一覧が出てくれば問題ないと思います。
mote

2019/06/10 23:55

ありがとうございます 一覧出てきました. 常にこの長文が出てしまうのはしょうがないことでしょうか?
kabao

2019/06/11 00:02

それぞれログに書いてある通りです。 ・認証を有効化して ・--bind_ipを設定して ・rlimitsを設定して ・db.disableFreeMonitoring()コマンドを実行 すれば、消えます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問