使用和运行Brew服务时出现问题,开始于mongodb-community@4.2 [英] Problem using and running brew services start mongodb-community@4.2

查看:50
本文介绍了使用和运行Brew服务时出现问题,开始于mongodb-community@4.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有MacOs Catalina版本10.15.5,并且按照其站点

I have MacOs Catalina version 10.15.5 and I installed mongoDB following the steps indicated at their site https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ using Homebrew. When I check my mongoDB if its correctly installed I use which mongo command and I get /usr/local/bin/mongo response. When I use mongo --version and mongod --version I get:

MongoDB shell version v4.2.7
git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
allocator: system
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

db version v4.2.7
git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
allocator: system
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

我认为这意味着它已经正确安装并且应该可以正常工作.

respectevely which I think it means its correctly installed and should work.

但是当我打开终端并运行命令 brew services start mongodb-community@4.2 时,我得到的网站指示:

But when I open terminal and run the command brew services start mongodb-community@4.2 as indicated on the site I get:

Error: undefined method `resolve_alias' for Formula:Class
/usr/local/bin/brew-services.rb:154:in `service'
/usr/local/bin/brew-services.rb:203:in `check'
/usr/local/bin/brew-services.rb:193:in `run!'
/usr/local/bin/brew-services.rb:397:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/Homebrew/Library/Homebrew/utils.rb:81:in `require?'
/usr/local/Homebrew/Library/Homebrew/brew.rb:112:in `<main>'

注意:我的啤酒已成功更新和升级!

我在互联网上搜索了任何解决方案,但找不到任何可以解决该问题的方法...如果有人遇到过类似的问题,请逐步说明,并详细说明您如何解决它?!?!

I searched on the internet any solution but I cant find anything that solves the problem... If anyone had faced similar problem please explain step by step and with details how you had solved it?!?!

如果我直接运行命令 mongod ,我会得到:

If I directly run command mongod I get:

2020-06-04T01:19:41.351+0200 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-06-04T01:19:41.355+0200 W  ASIO     [main] No TransportLayer configured during NetworkInterface startup
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] MongoDB starting : pid=24712 port=27017 dbpath=/data/db 64-bit host=Air-de-Ruslan.home
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] db version v4.2.7
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] allocator: system
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] modules: none
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] build environment:
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten]     distarch: x86_64
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten]     target_arch: x86_64
2020-06-04T01:19:41.355+0200 I  CONTROL  [initandlisten] options: {}
2020-06-04T01:19:41.355+0200 E  NETWORK  [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
2020-06-04T01:19:41.355+0200 F  -        [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 684
2020-06-04T01:19:41.355+0200 F  -        [initandlisten] 

***aborting after fassert() failure

如果直接运行命令 mongo ,我会得到:

and if I run directly command mongo I get:

MongoDB shell version v4.2.7
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-06-04T01:21:20.317+0200 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:341:17
@(connect):2:6
2020-06-04T01:21:20.320+0200 F  -        [main] exception: connect failed
2020-06-04T01:21:20.320+0200 E  -        [main] exiting with code 1

推荐答案

已解决

我必须使用命令

rm/usr/local/bin/brew-services.rb 它可能会请求权限,因此添加 sudo rm/usr/local/bin/brew-services.rb.

rm /usr/local/bin/brew-services.rb it could ask for permissions so add sudo rm /usr/local/bin/brew-services.rb.

之后,我尝试运行 brew服务,启动mongodb-community@4.2 ,我得到了

After that I tried running brew services start mongodb-community@4.2 and I got

成功启动了mongodb-community(标签:homebrew.mxcl.mongodb-commu 但是当我从另一个终端放 mongo 来启动外壳时,我得到了套接字异常错误,所以我还检查了mongod.log文件,发现它是套接字问题,所以我尝试了

Successfully started mongodb-community (label: homebrew.mxcl.mongodb-commu but when I put mongo from different terminal to start the shell I got Socket exception errorso I checked also the mongod.log file and I saw it was a socket issue so I tried

ls -ls/tmp/mongodb-27017.sock 我得到了

0 srwx ------ 1 root root 0 June 04 14:51/tmp/mongodb-27017.sock 这意味着所有者为root,而mongodb无法访问它,所以我做了

0 srwx------ 1 root root 0 June 04 14:51 /tmp/mongodb-27017.sock that means the owner is root and mongodb cant access it so I did

sudo rm -rf/tmp/mongodb-27017.sock

删除文件,然后使用

brew服务启动mongodb-community@4.2 ,创建新的.sock文件,其所有者直接是mongodb或实际用户 whoami ,当我再次检查时

brew services start mongodb-community@4.2 that created new .sock file whose owner is directly mongodb or the actual user whoami and when I checked again

ls -lsah/tmp/mongodb-27017.sock

我证明自己是所有者,然后我可以打开新终端并运行 mongo 并启用连接并使用Shell!

I proved I am the owner and then I could open new terminal and run mongo and get in with enabled connection and use the shell!

这篇关于使用和运行Brew服务时出现问题,开始于mongodb-community@4.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆