In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In the Linux environment, starting MongoDB by default will have a lot of alarm messages. If we install the database just for simple testing and learning, there won't be too many problems. However, if we are building a formal production environment, or when the system may have higher performance requirements, we need to reduce these hidden dangers as much as possible and get better configuration content.
1. Environmental description
We used Red Hat 6.5 for testing.
[root@oracle-test] # uname-a
Linux oracle-test 2.6.32-431.el6.x86_64 # 1 SMP Sun Nov 10 22:19:54 EST 2013 x86 "64 GNU/Linux
[root@oracle-test ~] # cat / etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
In the default startup mode, there are several Warning messages, as follows:
[mongodb@oracle-test ~] $mongod
2017-07-13T22:50:24.098+0800 I CONTROL [initandlisten] MongoDB starting: pid=19087 port=27017 dbpath=/data/db 64-bit host=oracle-test
(for reasons of space, there are omissions. )
2017-07-13T22:50:24.138+0800 I STORAGE [initandlisten]
2017-07-13T22:50:24.138+0800 I STORAGE [initandlisten] * * WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-07-13T22:50:24.138+0800 I STORAGE [initandlisten] * * See, _ manager= (close_idle_time=100000), checkpoint= (wait=60,log_size=2GB), statistics_log= (wait=0)
2017-07-13T22:50:24.212+0800 I CONTROL [initandlisten]
2017-07-13T22:50:24.212+0800 I CONTROL [initandlisten] * * WARNING: Access control is not enabled for the database.
(for reasons of space, there are omissions. )
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten]
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/enabled is' always'.
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never'
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten]
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/defrag is' always'.
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never'
2017-07-13T22:50:24.213+0800 I CONTROL [initandlisten]
(for reasons of space, there are omissions. )
These four pieces of information respectively indicate the four potential risk points of the current information.
ü Using the XFS filesystem:MongoDB, like MySQL, supports the storage engine (Storage Engine) system architecture mode. WiredTiger is the main engine supported by MongoDB at present
ü Access control: access control. MongoDB has no permission control over access without starting the server with the-auth parameter. So there will be a hint.
The other two are tips on HugePage management strategies. HugePage, translated into large pages in Chinese, is a way of managing memory in the Linux operating system. Compared with the usual mode, memory allocation management in HugePage mode is different. From the prompt, MongoDB obviously doesn't want this feature to be enabled.
This article focuses on handling the HugePage feature shutdown.
2. Online operation configuration
According to the prompts, the configuration status file is saved in the / sys/kernel/mm/transparent_hugepage directory.
[root@oracle-test /] # cd / sys/kernel/mm/transparent_hugepage
[root@oracle-test transparent_hugepage] # ls-l
Total 0
-rw-r--r--. 1 root root 4096 Jun 21 20:26 defrag
-rw-r--r--. 1 root root 4096 Jun 21 20:26 enabled
Drwxr-xr-x. 2 root root 0 Jul 13 22:52 khugepaged
[root@oracle-test transparent_hugepage] # cat enabled
[always] madvise never
[root@oracle-test transparent_hugepage] # cat defrag
[always] madvise never
The value always is not accepted. We need to set it to Never.
[root@oracle-test transparent_hugepage] # echo never > > / sys/kernel/mm/transparent_hugepage/enabled
[root@oracle-test transparent_hugepage] # echo never > > / sys/kernel/mm/transparent_hugepage/defrag
[root@oracle-test transparent_hugepage] # cat enabled
Always madvise [never]
[root@oracle-test transparent_hugepage] # cat defrag
Always madvise [never]
After the operation, restart MongoDB to notice that the prompt disappears. Because of the length, the content is omitted. However, if the server is restarted in this way, the configuration content will be restored.
[root@oracle-test ~] # cat / sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
[root@oracle-test ~] # cat / sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
If possible, we still expect to find a permanent solution to the problem.
3. The solution to two kinds of online biography.
On the Internet, there are two solutions to permanent shutdown. The author has made an attempt.
Method 1: modify the grub.conf configuration file and add the Never project.
Root@oracle-test ~] # cd / etc
[root@oracle-test etc] # ls-l | grep grub
Lrwxrwxrwx. 1 root root 22 Jul 27 2015 grub.conf->.. / boot/grub/grub.conf
[root@oracle-test etc] # vi grub.conf
R-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_linux6proser/lv_root SYSFONT=latarcyrheb-sun16 crashkernel=128M rd_LVM_LV=vg_linux6proser/lv_swap KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
Initrd / initramfs-2.6.32-431.el6.x86_64.img
Transparent_hugepage=never-- add new lines
~
"grub.conf" 19L, 893C written
After rebooting the system, check the parameters.
[root@oracle-test ~] # cat / sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
[root@oracle-test ~] # cat / sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
It has no effect, at least in the author's environment.
Method 2: modify the rc.local file and execute it automatically in the startup phase. In the / etc/rc.local file, add the corresponding content.
[root@oracle-test ~] # vi / etc/rc.local
Touch / var/lock/subsys/local
If test-f / sys/kernel/mm/redhat_transparent_hugepage/enabled; then
Echo never > / sys/kernel/mm/redhat_transparent_hugepage/enabled
Fi
If test-f / sys/kernel/mm/redhat_transparent_hugepage/defrag; then
Echo never > / sys/kernel/mm/redhat_transparent_hugepage/defrag
Fi
~
After rebooting, check the HugePage status.
[root@oracle-test ~] # cat / sys/kernel/mm/transparent_hugepage/enabled
Always madvise [never]
[root@oracle-test ~] # cat / sys/kernel/mm/transparent_hugepage/defrag
Always madvise [never]
The setting was successful.
4. Conclusion
This article introduces the methods and strategies for dealing with HugePage alarm logs, which are not perfect, but at least a proven scheme. The author guesses that from the point of view of Linux, there should be a complete plan to turn off this function, which should be left for us to continue to study.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.