Disabling mongo.log


In many installations of MongoDB verbose logging to the mongo.log file is switched on by default. This file can grow to quite substantial size (hundreds of megs are added regularly) and cleaning the file manually every time is rather tedious.

MongoDB recommends rotating logs but on local dev machines you aren't likely to actually need these logs in the first place.

To disable them edit /usr/local/etc/mongod.conf file (or whenever your mongo config is located - check the arguments provided to mongod with ps aux | grep mongod).

In mongod.conf comment out the logpath line. Restart the service and the logs won't be collected anymore. You may want to still remove that file (look in /usr/local/var/log/mongodb/mongo.log)

Tags: mongo, log, disabling

Installing databases as services with Homebrew on a Mac


First steps

Update your homebrew references and install services package to run the servers in the background.

brew update
brew tap homebrew/services

Installing services

Now you can install MongoDB, Redis or MySQL. Install whatever you need depending on your setup.

brew install mongodb
brew install redis
brew install mysql

Starting services

You can then control services with syntax typically seen in service launchers.

brew services start [service]
brew services stop [service]
brew services restart [service]

Replace [service] bit with mongodb, redis, mysql or whatever service you need to run and you're done.

Some debug options

brew services list
brew services cleanup

Tags: mac, homebrew, mongo, redis, mysql, services