Install MongoDB on Amazon Linux
Install MongoDB
- Use a 64-bit EC2 Amazon Linux instance to install MongoDB
-
Add a MongoDB yum repository for a 64-bit RPM
sudo vi /etc/yum.repos.d/10gen.repo
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0
-
Install MongoDB
sudo yum install mongo-10gen and mongo-10gen-server
-
Setup the data directory
sudo mkdir -p /data/db/
If a new EBS storage is mounted for the data directory, mount with the noatime and nodiratime atributes
-
Start MongoDB
sudo mongod
For production environment, change the owner of mongo to a local user instead of root and start with mongod
MongoDB Installation Smoke test
-
Start MongoDB client
mongo
-
Insert and retrieve data
db.things.save( { 'stage' : 'test' } ) db.things.find() { "_id" : ObjectId("4db76912b5c36fabd0006041"), "stage" : "test" } exit
For PHP support on MongoDB
-
Install PHP if not done
sudo yum install gcc sudo yum install make sudo yum install httpd mod_ssl sudo yum install php sudo yum install php-devel php-pear sudo yum install pcre-devel
-
Install MongoDB driver for Amazon Linux
sudo pecl install mongo
-
Enable the driver
sudo vi /etc/php.d/mongo.ini
extension=mongo.so
Sample PHP code in using MongoDB
<?php $db = new Mongo(); // Select the store DB $db = $db->store; // Select a collection $collection = $db->users; // Insert $person = array( "name" => "David Jones", "age" => 30 ); $collection->insert($person); // find data $cursor = $collection->find(); // iterate through the results foreach ($cursor as $data) { echo $data["name"] . "\n"; } ?>
I see, that your page needs unique and fresh content. I know it is hard to write posts manually everyday, but there is solution for this.
Just search in google for; servitu’s tricks
Please Like, Share, Tweet or Google+ in order to gain access
to the latest working form of Clash Royale Hack and offer the developers.
I have read so many content concerning the blogger lovers but this article is truly a
pleasant paragraph, keep it up.
While in the Clash Royale Hack that’s online, the user must down load it very first and follow several steps
thereon, the web one allows the user to utilize it in no time.
Furthermore, downloading perhaps hindered by specific circumstances such as internet
rate and others. Not forgetting, additionally requires
installation, that might be really technical
for some.
Hi there, I desire to subscribe forr this website to get newest updates, so
wherte can i doo it please help.