Update your homebrew references and install services package to run the servers in the background.
brew update brew tap homebrew/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
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