官方安装手册

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat/

安装完成后,登录出现如下告警:

1.登录mongo shell

[root@localhost~]#mongo

缺少openssl、libssh3

yum-yinstallopensslservicemongodrestart

2.I use mongodb 3.0 and find a warning:

[root@localhost~]#mongoMongoDBshellversion:3.0.1connectingto:testServerhasstartupwarnings:2015-03-13T16:28:29.405+0800ICONTROL[initandlisten]2015-03-13T16:28:29.406+0800ICONTROL[initandlisten]**WARNING:/sys/kernel/mm/transparent_hugepage/enabledis'always'.2015-03-13T16:28:29.406+0800ICONTROL[initandlisten]**Wesuggestsettingitto'never'2015-03-13T16:28:29.406+0800ICONTROL[initandlisten]2015-03-13T16:28:29.407+0800ICONTROL[initandlisten]**WARNING:/sys/kernel/mm/transparent_hugepage/defragis'always'.2015-03-13T16:28:29.407+0800ICONTROL[initandlisten]**Wesuggestsettingitto'never'2015-03-13T16:28:29.407+0800ICONTROL[initandlisten]

solved:

vi/etc/init.d/mongod#行首添加iftest-f/sys/kernel/mm/transparent_hugepage/enabled;thenechonever>/sys/kernel/mm/transparent_hugepage/enabledfiiftest-f/sys/kernel/mm/transparent_hugepage/defrag;thenechonever>/sys/kernel/mm/transparent_hugepage/defragfi重启mongodservicemongodrestart

3.Recommended ulimit Settings

Every deployment may have unique requirements and settings; however, the following thresholds and settings are particularly important for mongod and mongos deployments:

-f (file size): unlimited

-t (cpu time): unlimited

-v (virtual memory): unlimited [1]

-n (open files): 64000

-m (memory size): unlimited [1] [2]

-u (processes/threads): 64000

Always remember to restart your mongod and mongos instances after changing the ulimit settings to ensure that the changes take effect.


vi /etc/profile

在最后添加

ulimit -n 64000

ulimit -u 64000

source /etc/profile

2015-04-02T01:36:21.150-0700ICONTROL[initandlisten]2015-04-02T01:36:21.150-0700ICONTROL[initandlisten]**WARNING:softrlimitstoolow.rlimitssetto1024processes,64000files.Numberofprocessesshouldbeatleast32000:0.5timesnumberoffiles.