最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Mac中MongoDB报错:initandlisten Failed to start up WiredTiger under any compatibility version This may be due to an unsupported upgrade or downgrade

Mac crifan 1606浏览 0评论
折腾:
【未解决】Mac中运行自动处理工具报错:pymongo.errors.ServerSelectionTimeoutError localhost 27017 Errno 61 Connection refused
期间,去尝试找找MongoDB的log,看看是否有发现:
tail /usr/local/var/log/mongodb/mongo.log
输出:
~  tail /usr/local/var/log/mongodb/mongo.log
{"t":{"$date":"2021-01-22T11:54:13.035+08:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4894,"port":27017,"dbPath":"/usr/local/var/mongodb","architecture":"64-bit","host”:"xxx"}}
{"t":{"$date":"2021-01-22T11:54:13.035+08:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.3","gitVersion":"913d6b62acfbb344dde1b116f4161360acd8fd13","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-01-22T11:54:13.035+08:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"18.7.0"}}}
{"t":{"$date":"2021-01-22T11:54:13.035+08:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/usr/local/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/usr/local/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/usr/local/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2021-01-22T11:54:13.038+08:00"},"s":"I",  "c":"STORAGE",  "id":22270,   "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/usr/local/var/mongodb","storageEngine":"wiredTiger"}}
{"t":{"$date":"2021-01-22T11:54:13.039+08:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=3584M,session_max=33000,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,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
{"t":{"$date":"2021-01-22T11:54:13.518+08:00"},"s":"W",  "c":"STORAGE",  "id":22347,   "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2021-01-22T11:54:13.518+08:00"},"s":"F",  "c":"STORAGE",  "id":28595,   "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"45: Operation not supported"}}
{"t":{"$date":"2021-01-22T11:54:13.518+08:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":1123}}
{"t":{"$date":"2021-01-22T11:54:13.518+08:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
好像版本不兼容?
看到了:
"s":"W",  "c":"STORAGE",  "id":22347,   "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
ctx initandlisten msg Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade
macos – MongoDB-Community not starting on Mac and giving errors – Stack Overflow
mongodb – Upgrading older mongo database after unintentional mongo version upgrade – Stack Overflow
Upgrade a Standalone to 3.6 — MongoDB Manual
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
docker – MongoDB keeps crashing due to WiredTiger related error – Stack Overflow
mongodb – Upgrade Mongo DB Error – “Unsupported WiredTiger file version” – Stack Overflow
Problem running mongodb container with docker-compose – Stack Overflow
Failed to start WiredTiger after system upgrade – Ops and Admin – MongoDB Developer Community Forums
此处还不清楚,之前旧版本mongodb-community的版本是多少
需要去搞清楚
去看看log:
/usr/local/var/log/mongodb/mongo.log
发现之前最早的log是:
2019-11-05T10:26:24.784+0800 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-11-05T10:26:24.818+0800 I  CONTROL  [initandlisten] MongoDB starting : pid=48455 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=xxx
2019-11-05T10:26:24.818+0800 I  CONTROL  [initandlisten] db version v4.2.1
2019-11-05T10:26:24.818+0800 I  CONTROL  [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
2019-11-05T10:26:24.818+0800 I  CONTROL  [initandlisten] allocator: system
2019-11-05T10:26:24.819+0800 I  CONTROL  [initandlisten] modules: none
2019-11-05T10:26:24.819+0800 I  CONTROL  [initandlisten] build environment:
2019-11-05T10:26:24.819+0800 I  CONTROL  [initandlisten]     distarch: x86_64
2019-11-05T10:26:24.819+0800 I  CONTROL  [initandlisten]     target_arch: x86_64
2019-11-05T10:26:24.819+0800 I  CONTROL  [initandlisten] options: { config: "/usr/local/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/usr/local/var/mongodb" }, systemLog: { destination: "file", logAppend: true, path: "/usr/local/var/log/mongodb/mongo.log" } }
2019-11-05T10:26:24.820+0800 I  STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3584M,cache_overflow=(file_max=0M),session_max=33000,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,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2019-11-05T10:26:25.430+0800 I  STORAGE  [initandlisten] WiredTiger message [1572920785:430424][48455:0x1140ed5c0], txn-recover: Set global recovery timestamp: (0,0)
2019-11-05T10:26:25.472+0800 I  RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-11-05T10:26:25.503+0800 I  STORAGE  [initandlisten] Timestamp monitor starting
其中写了是:
  • 旧的:4.2.1
  • 新的:4.4.3
去找找如何设置命令setFeatureCompatibilityVersion
  ~  mongo
MongoDB shell version v4.4.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
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:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
此处mongodb服务没启动,所以mongo的shell无法使用,无法去shell中用命令
卸载新的:
 ~  brew uninstall mongodb-community
Uninstalling /usr/local/Cellar/mongodb-community/4.4.3... (11 files, 156.8MB)
重新安装旧版本:
brew install mongodb-community@4.2.1
加上代理:
export HTTP_PROXY=http://127.0.0.1:58591; export HTTPS_PROXY=http://127.0.0.1:58591; export ALL_PROXY=socks5://127.0.0.1:51837
我去:
 ~  brew install mongodb-community@4.2.1
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).
==> Updated Formulae
Updated 73 formulae.
==> New Casks
kieler                                           spotter
==> Updated Casks
Updated 43 casks.


==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "mongodb-community@4.2.1".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
竟然没有4.2.1的mongodb-community了
去找找之前啥时候安装的4.2.1的mongodb-community
【记录】mac搭建开发环境:安装最新版MongoDB
之前是:
brew install mongodb-community@4.2
去试试
~  brew install mongodb-community@4.2
Updating Homebrew...
==> Installing mongodb-community@4.2 from mongodb/brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.9.tgz
######################################################################## 100.0%
==> Caveats
mongodb-community@4.2 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.


If you need to have mongodb-community@4.2 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mongodb-community@4.2/bin:$PATH"' >> ~/.zshrc


To have launchd start mongodb/brew/mongodb-community@4.2 now and restart at login:
  brew services start mongodb/brew/mongodb-community@4.2
Or, if you don't want/need a background service you can just run:
  mongod --config /usr/local/etc/mongod.conf
==> Summary
🍺  /usr/local/Cellar/mongodb-community@4.2/4.2.9: 21 files, 306.4MB, built in 9 seconds
可以正常安装
看看当前版本
~  brew info mongodb-community
mongodb/brew/mongodb-community: stable 4.4.3
High-performance, schema-free, document-oriented database
https://www.mongodb.com/
Not installed
From: https://github.com/mongodb/homebrew-brew/blob/HEAD/Formula/mongodb-community.rb
==> Dependencies
Recommended: mongodb-database-tools ✔
==> Options
--without-mongodb-database-tools
    Build without mongodb-database-tools support
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
  brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
  mongod --config /usr/local/etc/mongod.conf
注意到:
竟然还是4.4.3
不过看到了写了:Not installed
试试show
 ~  brew show mongodb-community
Error: Unknown command: show
试试加上版本号
~  brew info mongodb-community@4.2
mongodb/brew/mongodb-community@4.2: stable 4.2.9 [keg-only]
High-performance, schema-free, document-oriented database
https://www.mongodb.com/
/usr/local/Cellar/mongodb-community@4.2/4.2.9 (21 files, 306.4MB)
  Built from source on 2021-01-22 at 13:36:56
From: https://github.com/mongodb/homebrew-brew/blob/HEAD/Formula/mongodb-community@4.2.rb
==> Caveats
mongodb-community@4.2 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.


If you need to have mongodb-community@4.2 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mongodb-community@4.2/bin:$PATH"' >> ~/.zshrc


To have launchd start mongodb/brew/mongodb-community@4.2 now and restart at login:
  brew services start mongodb/brew/mongodb-community@4.2
Or, if you don't want/need a background service you can just run:
  mongod --config /usr/local/etc/mongod.conf
那去启动试试
~  brew services start mongodb-community@4.2
==> Successfully started `mongodb-community@4.2` (label: homebrew.mxcl.mongodb-community@4.2)
成功启动了。
-》那或许说明,之前启动失败。是没加版本号??
不管了,总之能用就好。
后续去看看status:
~  brew services
Name                  Status  User  Plist
mongodb-community@4.2 started xxx /Users/xxx/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist
是正常的已运行。

转载请注明:在路上 » 【已解决】Mac中MongoDB报错:initandlisten Failed to start up WiredTiger under any compatibility version This may be due to an unsupported upgrade or downgrade

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
93 queries in 0.187 seconds, using 23.39MB memory