首页 > 解决方案 > 为什么我的 MongDB 无法访问数据?

问题描述

我有一个在 ECR/Kubernetes 上运行的 MongoDB 实例。据我所知,数据库路径是默认路径:

root@mongodb-ddn44:/data/db# ps -aux | grep -i mongod
mongodb      1  0.1  0.2 1112480 78564 ?       Ssl  13:51   0:13 mongod --bind_ip_all
root       171  0.0  0.0  11284   976 pts/1    S+   16:03   0:00 grep --color=auto -i mongod

此外,当我检查/data/db/目录时,它似乎有内容:

root@mongodb-ddn44:/data/db# du -sh /data/db/
1.5G    /data/db/

但是,我没有看到任何包含任何内容的数据库:

root@mongodb-ddn44:/data/db# mongo
MongoDB shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("65eb0346-bac0-4a80-ae49-88b8c0adf223") }
MongoDB server version: 4.0.10
Server has startup warnings:
2021-07-16T13:51:22.594+0000 I CONTROL  [initandlisten]
2021-07-16T13:51:22.594+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2021-07-16T13:51:22.594+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2021-07-16T13:51:22.595+0000 I CONTROL  [initandlisten]
---
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()
---

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB

而且,在这一点上,我被困住了。

标签: mongodb

解决方案


推荐阅读