Lennart Koopmann

{ :blog => true }

Tag Results

2 posts tagged mongo

mongo_analyzer

I wrote a little Sinatra application that can be very helpful at optimizing your MongoDB applications. It was very handy while optimizing the Graylog2 MongoDB parts so I made it public and configurable.

It allows you to enable/disable the MongoDB profiler and see it’s results in an overview page. Just start the profiler, run the MongoDB parts of you application you want to test and reload the mongo_analyzer overview page. It will list all queries that took longer than 100ms when in slow queries mode or all queries that were executed when in all queries mode.

You can also view and manage the indexes of your collections to try out effects on the query execution times.

I consider this software as beta. Please report bugs or feature requests in the GitHub issue tracker.

Download and installation instructions: https://github.com/lennartkoopmann/mongo_analyzer

MongoMapper/Rails: Connect to a MongoDB database with username and password

MongoMapper is a great project but missing a lot of documentation in some core parts. I wanted to find out how to connect to a MongoDB instance that requires authentication and this is how I did it:

First step: Adding a new section to your database configuration

# config/database.yml
mongodb:
  hostname: localhost
  database: graylog2
  port: 27017
  authenticate: true
  username: graylog2user
  password: graylog2pw

Read More