好久沒發(fā)博文啦~今天來一發(fā)~廢話少說~GoOn。
在墨玉等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè) 網(wǎng)站設(shè)計制作按需網(wǎng)站制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計,成都全網(wǎng)營銷推廣,外貿(mào)網(wǎng)站建設(shè),墨玉網(wǎng)站建設(shè)費(fèi)用合理。一:HomeBrew簡介與安裝
簡介:就是mac上的軟件包管理工具,方便安裝與卸載。
安裝:打開終端,輸入如下命令,期間會輸入一次回車+兩次開機(jī)密碼。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
二:MongoDB安裝
1:打開終端,輸入下述指令
brew update |
2 :繼續(xù)輸入下面指令,期間會出現(xiàn)約兩次進(jìn)度條(忘記截圖)
brew install mongodb |
3:輸入指令,啟動Mongodb
mongod |
出現(xiàn)如下報錯:約是說沒有/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:繼續(xù)輸入指令,創(chuàng)建/data/db,解決上述問題。期間會出入一次開機(jī)密碼
sudo mkdir -p /data/db |
5:再次試著啟動Mongodb
mongod |
出現(xiàn)如下報錯:約是說沒有權(quán)限。
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:執(zhí)行下述指令,解決上述問題,給權(quán)限(呵呵,執(zhí)行完之后沒什么反應(yīng)的)
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/ |
出現(xiàn)如下所示的頁面也代表啟動成功。
It looks like you are trying to access MongoDB over HTTP on the native driver port. |
天啦?!瓦@些吧~
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。