September 8, 2011 · Server · Email This Post

Sponsored Link
MongoDB wasn’t designed in a lab. We built MongoDB from our own experiences building large scale, high availability, robust systems. We didn’t start from scratch, we really tried to figure out what was broken, and tackle that. So the way I think about MongoDB is that if you take MySql, and change the data model from relational to document based, you get a lot of great features: embedded docs for speed, manageability, agile development with schema-less databases, easier horizontal scalability because joins aren’t as important. There are lots of things that work great in relational databases: indexes, dynamic queries and updates to name a few, and we haven’t changed much there. For example, the way you design your indexes in MongoDB should be exactly the way you do it in MySql or Oracle, you just have the option of indexing an embedded field.

Why MongoDB?

Document-oriented
Documents (objects) map nicely to programming language data types
Embedded documents and arrays reduce need for joins
Dynamically-typed (schemaless) for easy schema evolution
No joins and no multi-document transactions for high performance and easy scalability
High performance
No joins and embedding makes reads and writes fast
Indexes including indexing of keys from embedded documents and arrays
Optional asynchronous writes
High availability
Replicated servers with automatic master failover
Easy scalability
Automatic sharding (auto-partitioning of data across servers)
Reads and writes are distributed over shards
No joins or multi-document transactions make distributed queries easy and fast
Eventually-consistent reads can be distributed over replicated servers
Rich query language

Install MongoDB on ubuntu server

Install mongoDB server with php support

sudo apt-get install mongodb mongo-clients php5-dev

Now download the official mongoDB php driver from github using the following command

git clone https://github.com/mongodb/mongo-php-driver.git

Now go to the directory and run the following commands

cd mongo-php-driver

phpize

./configure

sudo make install

Now you need to copy the driver to php extenstion directory you can find this using the following command

php -i | grep extension_dir

Once you know the copy

sudo cp modules/mongo.so /path/to/php/extension_dir/

Now create a file to load the driver into php at start up

sudo vi /etc/php5/conf.d/mongo.ini

with the line:

extension=mongo.so

Save and exit the file

Finally restart apache server using the following command

sudo /etc/init.d/apache2 restart

Testing

If you want to test this go grab a copy of the excellent phpMoAdmin and drop the file anywhere you load it through a browser.

Via WGO

Sponsored Link

Incoming search terms:

Related posts

1 Comment to “How to install MongoDB on ubuntu server”

  1. Shaun Gibbins says:

    Slight misprint there, should be mongodb-clients instead of mongo-clients

    apt-get install mongodb mongodb-clients php5-dev

    [Reply]

Leave a Reply