Linux下安裝mongodb詳細過程

來源:互聯網
上載者:User

標籤:

本次安裝mongodb使用yum.repo方式。詳細過程請參考,也列出一些安裝過程中的錯誤,歡迎指正。

mongodb版本:3.0

先在linux下cd 到 /etc/yum.repos.d/

建立指令檔mongodb-org-3.0.repo:

1 [mongodb-org-3.0]2 name=MongoDB 3.0 Repository3 baseurl=https://repo.mongodb.org/yum/redhat/6/mongodb-org/3.0/x86_64/4 gpgcheck=05 enabled=1

:wq儲存後,清理yum資源

yum clean all

然後搜尋下源

yum search mongodb

以搜尋出來的名稱為準。

search後出來的結果是mongodb-org.x86_64,然後mongo安裝即可

yum install mongodb-org.x86_64

 

註:在安裝過程中,如果遇到下面的錯誤:

[[email protected] yum.repos.d]# yum install mongodbLoaded plugins: fastestmirrorSetting up Install ProcessLoading mirror speeds from cached hostfile* base: mirror.bit.edu.cn* epel: mirrors.aliyun.com* extras: mirror.neu.edu.cn* updates: mirrors.btte.netResolving Dependencies--> Running transaction check---> Package mongodb.x86_64 0:2.4.13-1.el6 will be installed--> Processing Conflict: mongodb-org-3.0.2-1.el6.x86_64 conflicts mongodb--> Processing Conflict: mongodb-org-mongos-3.0.2-1.el6.x86_64 conflicts mongodb--> Processing Conflict: mongodb-org-server-3.0.2-1.el6.x86_64 conflicts mongodb--> Processing Conflict: mongodb-org-shell-3.0.2-1.el6.x86_64 conflicts mongodb--> Processing Conflict: mongodb-org-tools-3.0.2-1.el6.x86_64 conflicts mongodb--> Finished Dependency ResolutionError: mongodb-org-mongos conflicts with mongodb-2.4.13-1.el6.x86_64Error: mongodb-org-server conflicts with mongodb-2.4.13-1.el6.x86_64Error: mongodb-org-tools conflicts with mongodb-2.4.13-1.el6.x86_64Error: mongodb-org-shell conflicts with mongodb-2.4.13-1.el6.x86_64Error: mongodb-org conflicts with mongodb-2.4.13-1.el6.x86_64You could try using --skip-broken to work around the problemYou could try running: rpm -Va --nofiles --nodigest

 

解決方案如下:

 yum install mongodb-org.x86_64 --skip-broken

跳過依賴關係就可以安裝了。

mongod啟動:

service mongod start

 

關閉(尋找到進程然後kill掉):

ps -ef|grep mongodkill xx pid

 

如果存在類似下面的一些警告:

I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always‘.I CONTROL  [initandlisten] **        We suggest setting it to ‘never‘I CONTROL  [initandlisten] I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always‘. I CONTROL  [initandlisten] **        We suggest setting it to ‘never‘
echo "never" > /sys/kernel/mm/transparent_hugepage/enabledecho "never" > /sys/kernel/mm/transparent_hugepage/defrag

 

請參考下面資料:http://bbs.51cto.com/thread-1146184-1.html

如果有遇到這種錯誤:

2015-05-08T11:33:14.789+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 1024 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.

可以嘗試:

cd /etc/security/limits.dvim 90-nproc.conf

* soft nproc 32000

root soft nproc unlimited

將第一行改成提示的值(此處的值:Number of processes should be at least 32000)

 

關閉mongodb:

mongod -f /etc/mongod.conf --shutdown

查看mongo狀態:

service mongod status

啟動mongo:

mongod -f /etc/mongod.conf

查看運行狀態:

ps aux|grep mongod
netstat -aux|grep mongod

 

Linux下安裝mongodb詳細過程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.