** WARNING: You are running this process as the root user, which is not recommended

Hi All,

I have installed MongoDB on Linux Centos 6.x and it's Server (mongod) running fine. but as soon as I connect server though it's Client (mongo) from the same Linux(Centos) machine I am getting following warnings message on the console. I am pretty much sure that I not running Client (mongo) as root.

 

Server has startup warnings:
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten]
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten]
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten]
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-05-14T01:44:07.262+0530 I CONTROL  [initandlisten]

Can anyone explain what these warnings are and How to fix them ?

Posted by Andy on 2015-03-28 07:11:14.0


Hi Andy,

You got three warning messages, let me explain these warning and following are the fix for these warnings.

Remember - when you login to the MongoDB server from the same Linux Machine, then you login as Administrator. MongoDB give this message to Administrator 

** WARNING: You are running this process as the root user, which is not recommended.

This WARNING means what you are running MongoDB server as root, Follow the below steps
  • Create a new Linux User i.e. admin (Linux command to create new user is - #adduser admin)
  • Login as new Linux User on the server i.e. admin
  • Under the  /home/new_user directory of the new user, download and install MongoDB binaries. 
  • Start the MongoDB server process as new User. 

** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

Suggestion - See, This is new feature introduced in CentOs 6.x and it enabled by default. Changing it's setting will directly impact your CPU time.
if your MongoDB server is running on old Hardware or with limited RAM, I suggest you to not change it. it will downgrade performance. 

You can use the following steps to fix this warning message
  • Login as root on Linux which is hosting MongoDB server.
  • # cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
[always] madvise never
  • # rm /var/tmp/enabled.swp
  • # echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled 
  • # cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
always madvise [never]

** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

Suggestion - See, This is new feature introduced in CentOs 6.x and it enabled by default. Changing it's setting will directly impact your CPU time. 
​if your MongoDB server is running on old Hardware or with limited RAM, I suggest you to not change it. it will downgrade performance. 

You can use the following steps to fix this warning message
  • Login as root on Linux which is hosting MongoDB server.
  • # cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
  • # rm /var/tmp/enabled.swp
  • # echo never > /sys/kernel/mm/transparent_hugepage/defrag 
  • # cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]

Restart your MongoDB server(mongod) and run MongoDB client (mongo), you will not find these warning messages.
 
[~/MongoDB_3.x/bin]$ ./mongo --port 27016 -u navi -p navi --authenticationDatabase admin
MongoDB shell version: 3.0.3
connecting to: 127.0.0.1:27016/test
>


Good Luck !!

Posted by Navdeep on 2015-05-13 23:42:33.0