Mac下MongoDB的安装-创新互联
好久没发博文啦~今天来一发~废话少说~GoOn。
在墨玉等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、网站建设 网站设计制作按需网站制作,公司网站建设,企业网站建设,高端网站设计,成都全网营销推广,外贸网站建设,墨玉网站建设费用合理。一:HomeBrew简介与安装
简介:就是mac上的软件包管理工具,方便安装与卸载。
安装:打开终端,输入如下命令,期间会输入一次回车+两次开机密码。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
二:MongoDB安装
1:打开终端,输入下述指令
brew update |
2 :继续输入下面指令,期间会出现约两次进度条(忘记截图)
brew install mongodb |
3:输入指令,启动Mongodb
mongod |
出现如下报错:约是说没有/data/db目录的。
2016-08-02T18:19:16.825+0800 I CONTROL [initandlisten] MongoDB starting : pid=37113 port=27017 dbpath=/data/db 64-bit host=C02Q6N1GFVH5-3.local 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] db version v3.2.8 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2h 3 May 2016 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] allocator: system 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] modules: none 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] build environment: 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] distarch: x86_64 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] target_arch: x86_64 2016-08-02T18:19:16.826+0800 I CONTROL [initandlisten] options: {} 2016-08-02T18:19:16.828+0800 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2016-08-02T18:19:16.828+0800 I CONTROL [initandlisten] dbexit: rc: 100 |
4:继续输入指令,创建/data/db,解决上述问题。期间会出入一次开机密码
sudo mkdir -p /data/db |
5:再次试着启动Mongodb
mongod |
出现如下报错:约是说没有权限。
2016-08-02T19:15:14.592+0800 I CONTROL [initandlisten] MongoDB starting : pid=38311 port=27017 dbpath=/data/db 64-bit host=C02Q6N1GFVH5-3.local 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] db version v3.2.8 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2h 3 May 2016 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] allocator: system 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] modules: none 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] build environment: 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] distarch: x86_64 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] target_arch: x86_64 2016-08-02T19:15:14.593+0800 I CONTROL [initandlisten] options: {} 2016-08-02T19:15:14.595+0800 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating 2016-08-02T19:15:14.595+0800 I CONTROL [initandlisten] dbexit: rc: 100 |
6:执行下述指令,解决上述问题,给权限(呵呵,执行完之后没什么反应的)
sudo chown -R 用户名 /data/db |
7:再次试着启动Mongodb
mongod |
waitting 27017。。。成功啦!!!
2016-08-02T19:16:06.621+0800 I CONTROL [initandlisten] MongoDB starting : pid=38338 port=27017 dbpath=/data/db 64-bit host=C02Q6N1GFVH5-3.local 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] db version v3.2.8 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2h 3 May 2016 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] allocator: system 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] modules: none 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] build environment: 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] distarch: x86_64 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] target_arch: x86_64 2016-08-02T19:16:06.622+0800 I CONTROL [initandlisten] options: {} 2016-08-02T19:16:06.622+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0), 2016-08-02T19:16:07.239+0800 I CONTROL [initandlisten] 2016-08-02T19:16:07.239+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 2016-08-02T19:16:07.239+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data' 2016-08-02T19:16:07.239+0800 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker 2016-08-02T19:16:07.390+0800 I NETWORK [initandlisten] waiting for connections on port 27017 |
8:此时打开浏览器,输入下述地址:
http://127.0.0.1:27017/ |
出现如下所示的页面也代表启动成功。
It looks like you are trying to access MongoDB over HTTP on the native driver port. |
天啦噜~就这些吧~
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享题目:Mac下MongoDB的安装-创新互联
本文URL:http://azwzsj.com/article/ghhos.html