Mac启动MongoDB,浏览器输入http://localhost:27017/显示无法连接到服务器

燃烧的小牛
  • 3
新手上路,请多包涵

终端运行显示成功安装了mongodb数据库,可是在浏览器启动好像连接不上。
安装成功如下:
momo@192 ~ % mongod --version
db version v5.0.3
Build Info: {

"version": "5.0.3",
"gitVersion": "657fea5a61a74d7a79df7aff8e4bcf0bc742b748",
"modules": [
    "enterprise"
],
"allocator": "system",
"environment": {
    "distarch": "x86_64",
    "target_arch": "x86_64"
}

}
终端启动如下:
momo@192 ~ % mongod
{"t":{"$date":"2021-10-10T16:34:44.216+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-10-10T16:34:44.217+08:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2021-10-10T16:34:44.221+08:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-10-10T16:34:44.222+08:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2021-10-10T16:34:44.223+08:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-10-10T16:34:44.227+08:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"thread1","msg":"No TransportLayer configured during NetworkInterface startup"}

回复
阅读 380
1 个回答

No TransportLayer configured during NetworkInterface startup

没有配置好,如果你手动使用mongod来启动,需要配置加--config,以显式指定你的mongodb配置,甚至还需要手动创建db目录(不确定)。详见https://docs.mongodb.com/manu...

ps:
建议使用brew来管理/启动 mongodb,这种方式会自动创建以下内容,所以我自己也是用这种方式,比较简单,不需要什么操作,直接使用默认的配置。

  • the configuration file ( /usr/local/etc/mongod.conf )
  • the log directory path ( /usr/local/var/log/mongodb )
  • the data directory path ( /usr/local/var/mongodb )

安装

brew install mongodb-community@5.0

启动服务

brew services start mongodb-community@5.0
你知道吗?

宣传栏