Wait for connections to MongoDB and redis to be established on startup. Added configuration option to specify redis DB.