Mysql Download for Mac Os X 10.12 Updated

Mysql Download for Mac Os X 10.12

Today nosotros will install MongoDB on Mac OS X. MongoDB is one of the leading NoSQL database. MySql and Oracle are termed equally "Relation Databases", similarly we can say that MongoDB is a "Document Database". We tin store any valid JSON in MongoDB database. MongoDB is open up source and written in C++ language.

MongoDB stores JSON documents in Binary format termed as BSON (Binary JSON). Some of the features of MongoDB are:

  1. Total indexing support for faster query processing.
  2. Chief-Slave replication for making our system fault tolerant.
  3. Rich Document based query to become the stored data.
  4. Auto Sharding to achieve horizontal scaling.

MongoDB is also very pop NoSQL database because nosotros take drivers for all the major programming languages such as Coffee, PHP, Perl, Python, Scarlet, Scala, C, C++ etc.

Install MongoDB on Mac

This is the commencement tutorial in MongoDB serial and we will learn how to install MongoDB on Mac Os X. For this tutorial, I am using following softwares:

  1. Max Bone Ten x.12.half dozen
  2. MongoDB Server 3.iv.seven that you can download from MongoDB Downloads Page

Follow below commands in order to install MongoDB and start it.

                          pankaj@Pankajs-MacBook-Pro:~/Downloads/$ curl -O https://fastdl.mongodb.org/osx/mongodb-linux-x86_64-3.4.7.tgz pankaj:~ pankaj$ tar -xvf mongodb-linux-x86_64-three.four.7.tgz x mongodb-linux-x86_64-3.4.7/README x mongodb-linux-x86_64-3.4.seven/Tertiary-PARTY-NOTICES x mongodb-linux-x86_64-3.4.seven/MPL-2 x mongodb-linux-x86_64-iii.4.7/GNU-AGPL-iii.0 x mongodb-linux-x86_64-iii.4.7/bin/mongodump x mongodb-linux-x86_64-3.4.7/bin/mongorestore x mongodb-linux-x86_64-3.4.seven/bin/mongoexport x mongodb-linux-x86_64-3.four.vii/bin/mongoimport x mongodb-linux-x86_64-3.4.seven/bin/mongostat x mongodb-linux-x86_64-3.4.7/bin/mongotop x mongodb-linux-x86_64-3.four.7/bin/bsondump 10 mongodb-linux-x86_64-3.4.7/bin/mongofiles x mongodb-linux-x86_64-iii.iv.7/bin/mongooplog ten mongodb-linux-x86_64-3.four.vii/bin/mongoreplay x mongodb-linux-x86_64-three.four.7/bin/mongoperf x mongodb-linux-x86_64-3.4.vii/bin/mongod x mongodb-linux-x86_64-3.iv.7/bin/mongos x mongodb-linux-x86_64-three.iv.7/bin/mongo pankaj@Pankajs-MacBook-Pro:~/Downloads/$ mv mongodb-linux-x86_64-3.4.7 mongodb pankaj@Pankajs-MacBook-Pro:~/Downloads/$ cd mongodb pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb$ mkdir data pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb$ cd bin pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb/bin$ ./mongod --dbpath /Users/pankaj/Downloads/mongodb/data & Mon Oct 14 xv:55:52.131 [initandlisten] MongoDB starting : pid=950 port=27017 dbpath=/Users/pankaj/Downloads/mongodb/data 64-scrap host=Pankajs-MacBook-Pro.local Mon Oct fourteen fifteen:55:52.131 [initandlisten]  Monday October 14 15:55:52.131 [initandlisten] ** Alert: soft rlimits too low. Number of files is 256, should be at to the lowest degree 1000 Monday Oct 14 xv:55:52.131 [initandlisten] db version v3.4.7 Mon Oct fourteen 15:55:52.131 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673 Mon Oct fourteen 15:55:52.131 [initandlisten] build info: Darwin bs-osx-106-x86-64-two.10gen.cc ten.8.0 Darwin Kernel Version 10.viii.0: Tue Jun  7 sixteen:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49 Mon October xiv fifteen:55:52.131 [initandlisten] allocator: organisation Mon October 14 15:55:52.131 [initandlisten] options: { dbpath: "/Users/pankaj/Downloads/mongodb/information" } Mon Oct 14 xv:55:52.132 [initandlisten] journal dir=/Users/pankaj/Downloads/mongodb/information/journal Mon Oct 14 15:55:52.132 [initandlisten] recover : no periodical files nowadays, no recovery needed Mon Oct 14 15:55:52.238 [FileAllocator] allocating new datafile /Users/pankaj/Downloads/mongodb/data/local.ns, filling with zeroes... Monday Oct 14 15:55:52.238 [FileAllocator] creating directory /Users/pankaj/Downloads/mongodb/data/_tmp Mon Oct 14 15:55:52.347 [FileAllocator] washed allocating datafile /Users/pankaj/Downloads/mongodb/data/local.ns, size: 16MB,  took 0.108 secs Mon Oct fourteen 15:55:52.646 [FileAllocator] allocating new datafile /Users/pankaj/Downloads/mongodb/data/local.0, filling with zeroes... Mon Oct 14 xv:55:53.578 [FileAllocator] done allocating datafile /Users/pankaj/Downloads/mongodb/data/local.0, size: 64MB,  took 0.931 secs Mon Oct fourteen 15:55:53.871 [initandlisten] command local.$cmd control: { create: "startup_log", size: 10485760, capped: truthful } ntoreturn:1 keyUpdates:0  reslen:37 1633ms Monday Oct 14 fifteen:55:53.872 [initandlisten] couldn't unlink socket file /tmp/mongodb-27017.sockerrno:13 Permission denied skipping Mon Oct 14 15:55:53.872 [websvr] admin web console waiting for connections on port 28017 Mon October 14 15:55:53.872 [initandlisten] waiting for connections on port 27017 pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb/bin$                      

Start two commands are to download the tar ball using curl command and then extract it with tar command. Then I am renaming the extracted directory to remember the path easily.

If we don't provide information directory, MongoDB server tries to access information technology at "/information/db", so I am overriding it with --dbpath option with mongod executable file.

mongod is the server program that we need to execute to start the MongoDB server and I am catastrophe it with & and then that it runs in groundwork and doesn't get terminated if I close the terminal.

MongoDB default port is 27017 only nosotros tin can change information technology past providing command line choice or through configuration file.

That's it, our MongoDB server is up and running, now we can test it with MongoDB terminal customer.
install mongodb on mac

                          pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb/bin$ ./mongo MongoDB trounce version: 3.4.7 connecting to: examination Server has startup warnings:  Mon Oct 14 16:xi:35.330 [initandlisten]  Mon Oct 14 xvi:11:35.330 [initandlisten] ** Alarm: soft rlimits too low. Number of files is 256, should be at to the lowest degree 1000 > bear witness dbs local	0.078125GB > use journaldev switched to db journaldev > db.names.save({"id":123,"name":"Pankaj"}) > db.names.find() { "_id" : ObjectId("525c7af46e7301702bbfea1e"), "id" : 123, "name" : "Pankaj" } > db.datas.save({}) > evidence collections datas names organisation.indexes > show dbs journaldev	0.203125GB local	0.078125GB > exit bye pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb/bin$                      

show dbs: Control to go the list of databases

use DBNAME: Command to create new DB or switch to an existing DB, notation that until unless you do any save or find performance on new DB, it wont exist created.

db.names.salvage({}): Control to save JSON document in current DB. MongoDB store documents in terms of collections. In this control, names is the collection.

db.names.find(): Command to list all the documents in the names collection.

show collections: Control to list all the collections in the electric current database.

You might notice that I am accessing mongodb executables through relative path starting with ./, you lot can add together mongodb bin location to PATH variable to access mongodb executables direct.

                          pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb/bin$ vi ~/.bash_profile  //add together below line and salve it export PATH=$PATH:/Users/pankaj/Downloads/mongodb/bin pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb/bin$ source ~/.bash_profile                      

Now you can access mongodb executables from anywhere without providing the directory location.

Running MongoDB as Mac Bone X Service

To run MongoDB equally service, nosotros need to create PList file in /Library/LaunchDaemons directory.

org.mongodb.mongod.plist

                          <?xml version="1.0" encoding="UTF-viii"?> <!DOCTYPE plist PUBLIC "-//Apple tree//DTD PLIST 1.0//EN" "https://world wide web.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="i.0"> <dict>   <fundamental>Label</key>   <string>org.mongodb.mongod</string>   <key>ProgramArguments</key>   <assortment>     <cord>/Users/pankaj/Downloads/mongodb/bin/mongod</string>     <string>run</string>     <string>--config</string>     <string>/Users/pankaj/Downloads/mongodb/mongod.conf</string>   </array>   <key>RunAtLoad</key>   <truthful/> <primal>UserName</central> <string>pankaj</string> </dict> </plist>                      
                          pankaj@Pankajs-MacBook-Pro:~$ cd /Library/LaunchDaemons pankaj@Pankajs-MacBook-Pro:/Library/LaunchDaemons$ sudo vi org.mongodb.mongod.plist  pankaj@Pankajs-MacBook-Pro:/Library/LaunchDaemons$ sudo launchctl load org.mongodb.mongod.plist   #below commands to start and stop service through launchctl control pankaj@Pankajs-MacBook-Pro:/Library/LaunchDaemons$ sudo launchctl start org.mongodb.mongod pankaj@Pankajs-MacBook-Pro:/Library/LaunchDaemons$ sudo launchctl stop org.mongodb.mongod  pankaj@Pankajs-MacBook-Pro:/Library/LaunchDaemons$ ps -eaf | grep mongod     0    61     one   0  3:04PM ??         0:06.31 /Users/pankaj/Downloads/mongodb/bin/mongod run --config /Users/pankaj/Downloads/mongodb/mongod.conf pankaj@Pankajs-MacBook-Pro:/Library/LaunchDaemons$                      

Yous might notice that rather than providing options as command line argument, I am using config file to pass arguments to mongod. Some of the commonly used configurations in MongoDB configuration file can be:

                          pankaj@Pankajs-MacBook-Pro:~/Downloads/mongodb$ true cat mongod.conf  #we tin change port, I am setting default port port=27017  #we can enable verbose mode, by default its false verbose=truthful  #limit max connections, cant set more 20000 maxConns=l  #setting up log path logpath=/Users/pankaj/Downloads/mongodb/logs/mongo.log logappend=true  #create PID file pidfilepath=/Users/pankaj/Downloads/mongodb/mongo.pid  #setting dbpath, dont want to use default /information/db path dbpath=/Users/pankaj/Downloads/mongodb/data                      

Notation that you need to create mongo.log file manually and it should have the correct permission. For case, in above configuration I am using "pankaj" user to run the process, and so the log file should be created by same user. If yous don't provide any user information in the plist file, it will exist started with root user.

At present when you lot volition restart the Mac Bone X, you will observe that MongoDB has already been started as service and you don't need to commencement information technology manually.

References:

MongoDB Official Website
Running MongoDB as Service on Mac Bone X

Mysql Download for Mac Os X 10.12

Posted by: thomasanclat.blogspot.com

0 Komentar

Post a Comment




banner