刚刚学习安装了MongoDB,版本4.4.0 ;然后成功启动后访问
http://localhost:27017/ 显示
It looks like you are trying to access MongoDB over HTTP on the native driver port.
控制台的日志怎么感觉不太对啊? 我看别人的日志不是这样的,我这个怎么是json格式的字符串?
{"t":{"$date":"2020-08-20T19:58:00.210+08:00"},"s":"W", "c":"CONTROL", "id":20698, "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
{"t":{"$date":"2020-08-20T19:58:00.212+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-08-20T20:31:27.953+08:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"consoleTerminate","msg":"Shutting down","attr":{"exitCode":12}}
真的是版本问题,4.4.0日志格式都变了,下个了mongodb-4.0.19 试了一下,果然是,这是4.0.19的日志。。 太坑了
补充:
看了4.4.0 的版本说明,新出了个结构化日志
详解见官网说明
Structured Logging
Starting in MongoDB 4.4, mongod / mongos instances now output all log messages in structured JSON format. This includes log output sent to the file, syslog, and stdout (standard out) log destinations, as well as the output of the getLog command.
Previously, log entries were output as plaintext.
If you have existing log parsing utilities, or use a log ingestion service, you may need to reconfigure these tools for the new structured logging format with MongoDB 4.4.
See Log Messages for a detailed examination of the new structured logging format, including examples of log parsing using the new log structure.