MongoDB|MongoDB 启动问题解决
# mongo
MongoDB shell version: 3.2.16
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten]
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] ** WARNING: You are running on a NUMA machine.
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] **We suggest launching mongod like this to avoid performance problems:
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] **numactl --interleave=all mongod [other options]
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten]
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] **We suggest setting it to 'never'
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten]
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten] **We suggest setting it to 'never'
2017-08-17T17:27:31.443+0800 I CONTROL[initandlisten]
2017-08-17T17:27:31.444+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.
2017-08-17T17:27:31.444+0800 I CONTROL[initandlisten]
>
第一个问题: 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.
解决方法:
1.系统级别
# vi /etc/sysctl.conf
fs.file-max = 100000
# sysctl -p查看方法:
# cat /proc/sys/fs/file-max
# sysctl fs.file-max2.用户级别
设置方法:
# vi /etc/security/limits.conf
mongod soft nofile 65535
mongod hard nofile 65535
mongod soft nproc 32768
mongod hard nproc 32768查看方法:
# su - user
$ ulimit -Hn
$ ulimit -Sn注意:
root用户还需单独设置
# vi /etc/security/limits.conf
root soft nofile 65536
root hard nofile 65535CentOS还需开启PAM模块
# vi /etc/pam.d/login
session required pam_limits.so
【MongoDB|MongoDB 启动问题解决】第二个问题:
WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.We suggest setting it to 'never'
WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.We suggest setting it to 'never'
解决方法:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag# vim /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag查看方法:
# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
# cat /sys/kernel/mm/redhat_transparent_hugepage/defrag
always madvise [never]
第三个问题:
WARNING: You are running on a NUMA machine.We suggest launching mongod like this to avoid performance problems:numactl --interleave=all mongod [other options]
解决方法:
echo 0 | sudo tee /proc/sys/vm/zone_reclaim_mode
sysctl -w vm.zone_reclaim_mode=0
推荐阅读
- parallels|parallels desktop 解决网络初始化失败问题
- jhipster|jhipster 升级无效问题
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- “精神病患者”的角度问题
- 解决SpringBoot引用别的模块无法注入的问题
- Hive常见问题汇总
- 姚老师互动问答会|姚老师互动问答会 # 问题001(如何更有智慧的和身边人分享金刚智慧())
- 【Hadoop踩雷】Mac下安装Hadoop3以及Java版本问题
- 【教育故事】|【教育故事】 一个“问题学生”的蜕变
- 蓝桥杯试题