Thursday, May 18, 2017

Resource temporarily unavailable

If you see a message like following while working on centos system, that means the particular user you are using has exceeded the open process limit.


bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable


So you need to increase it. Here is the way...

Login as root. Go to "limits.conf" file.

> vi /etc/security/limits.conf

Set a higher number of "nproc" value.
Add these two lines.
user          soft    nproc     65550
user          hard    nproc     65555

user - replace with your username

source : https://access.redhat.com/solutions/30316

Tuesday, May 16, 2017

Get "pretty" result always without typing .pretty() on mongo.

When executing mongo commands we put .pretty() at the end to get a readable out put.

Ex:
db.myTable.find({"id":"123"}).pretty()
However there is a way to avoid this command. Just enter the following line into "$HOME/.mongorc.js"
DBQuery.prototype._prettyShell = true
That will enable pretty print globally by default.