Posted 11 years ago.

This notes is meant for share at Drupal India Hangout #2 @ 9.30AM IST on 6th April 2013, organized by Shyamala from Chennai.

Setting up MongoDB on a Ubuntu Box

  • Edit the source list        vi /etc/apt/sources.list
  • Add the repo        deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
  • update package list         apt-get update
  • install apt-get install mongodb-10gen

        

  • Install pear, required by PECL        apt-get install php-pear
  • Install PHP Mongo Driver using PECL        pecl install mongo
  • Edit php.ini        vi /etc/php5/apache2/php.ini . Add extension=mongo.so        extension=mongo.so
  • Restart Apache        /etc/init.d/apache2 restart

        

Drupal + MongoDB        

  • Create settings file at default folder        local.settings.php

'default' =?> array( // Connection name/alias
'host' => 'localhost', // Omit USER:PASS@ if Mongo isn't configured to use authentication.
'db' => 'drupal' // Database name. Make something up, mongodb will automatically create the database.
),
);include_once('./includes/cache.inc');
# -- Configure Cache
$conf['cache_backends'][] = 'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
$conf['cache_class_cache'] = 'DrupalMongoDBCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalMongoDBCache';
$conf['cache_default_class'] = 'DrupalMongoDBCache';
# -- Don't touch SQL if in Cache
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
# Session Caching
$conf['session_inc'] = 'sites/all/modules/mongodb/mongodb_session/mongodb_session.inc';
$conf['cache_session'] = 'DrupalMongoDBCache';
# Field Storage
$conf['field_storage_default'] = 'mongodb_field_storage';
# Message Queue
$conf['queue_default_class'] = 'MongoDBQueue';
?>


Resources:

Videos:

Modules:

Add new comment

Submitted by tanay on Fri, 04/05/2013 - 22:24