I am learning mongoDb.
I did the following: I understand this.
mkdir -p mongodb
cp -R -n mongodb-osx-x86_64-2.6.7/ mongodb
These next ** instructions are not crystal clear to me.
** Ensure the location of the binaries is in the PATH variable. The MongoDB binaries are in the bin/ directory of the archive. To ensure that the binaries are in your PATH, you can modify your PATH.
For example, you can add the following line to your shell’s rc file (e.g. ~/.bashrc):
export PATH=<mongodb-install-directory>/bin:$PATH
Replace with the path to the extracted MongoDB archive.
End of the instructions.
From terminal on my Mac
$which bash
/bin/bash
The bin directory has a bunch of commands: bash, chmod, ln, pid, mkdir.
I cannot find the directory where I should include the PATH code above.
Thanks
Abhay's instructions worked !
Sorry that the following is long but I believe it is necessary because you were so clear last time and I want you to see my file structure.
If email is easier let me know but this will more likely than not help others :)
I really want to understand my file structure so if you do not mind a bit of further clarification.
Thanks again for your expertise.
1. But why are all of the binaries (the executables) listed individually in this bin folder ? Are they the 'only' files that should 'live' in this folder ? Perhaps when I was installing bower grunt etc. I should installed those (bower grunt etc) into a different location. I am trying to keep my file structures logical and clean. Here is what I have.
MacBookPro:usr regina$ cd ..
MacBookPro:/ regina$ ls
Applications bin net
CoreSyncInstall.log cores private
Library data sbin
Network dev tmp
System etc usr
Users home var
Volumes mach_kernel
MacBookPro:/ regina$ cd usr/local/bin
MacBookPro:bin regina$ ls
bower grunt mongod mongorestore npm
browserify gulp mongodump mongos statsd
bsondump http-server mongoexport mongosniff yo
cake karma mongofiles mongostat
coffee lessc mongoimport mongotop
cordova mkdirp mongooplog node
express mongo mongoperf nodemon
MacBookPro:bin regina$
2. Also, I wanted to look at my .bashrc file. I do not have one. I am on osx 10.8.5 I want to 'view' my $PATH variable. I believe I found it somewhere months ago. I was using nano to open a bunch of files because I was curious. Was it listed as an environmental variable ?
MacBookPro:/ regina$ ls
Applications bin net
CoreSyncInstall.log cores private
Library data sbin
Network dev tmp
System etc usr
Users home var
Volumes mach_kernel
MacBookPro:/ regina$ cd home
MacBookPro:home regina$ ls -la
total 2
dr-xr-xr-x 2 root wheel 1 Feb 3 08:29 .
drwxr-xr-x 33 root wheel 1190 Jan 25 17:21 ..
MacBookPro:home regina$
I start the mongo shell like this. I am not showing all of the lines output in terminal.
Look at my file structure. I originally followed a cp command but it did not explain 'where' to copy the archived (desktop) mongodb-osx-x84.... folder so look where I copied it to. Now I have these files in 2 locations - yes ? And I have a mongodb folder inside of a higher level mongodb folder. Why ? How did I manage this ? It seems illogical. I have been indented 4 spaces but the below will not format so I just added line breaks. sorry.MacBookPro:home regina$ cd ..
MacBookPro:/ regina$ ls Applications bin net CoreSyncInstall.log cores private Library data sbin Network dev tmp System etc usr Users home var Volumes mach_kernel
MacBookPro:/ regina$ cd data
MacBookPro:data regina$ ls
db mongodb
MacBookPro:data regina$ cd mongodb
MacBookPro:mongodb regina$ ls
mongodb MacBookPro:mongodb regina$ cd mongodb MacBookPro:mongodb regina$ ls GNU-AGPL-3.0 THIRD-PARTY-NOTICES README bin
MacBookPro:mongodb regina$ cd bin
MacBookPro:bin regina$ ls
bsondump mongodump mongoimport mongorestore mongostat mongo mongoexport mongooplog mongos mongotop mongod mongofiles mongoperf mongosniff
This is what happens when I try and type 'mongo' as another forum suggested.
MacBookPro:bin regina$ mongo MongoDB shell version: 2.6.7 connecting to: test 2015-02-03T08:36:54.157-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
So I typed this which still failed.
MacBookPro:bin regina$ ./mongo
MongoDB shell version: 2.6.7
connecting to: test
2015-02-03T08:37:03.599-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
Then I tried this which connected - opened port 27017 - and is listening. Why did I need the daemon command ?
MacBookPro:bin regina$ ./mongod
./mongod --help for help and startup options
2015-02-03T08:37:08.712-0500 [initandlisten] MongoDB starting : pid=487 port=27017 dbpath=/data/db 64-bit host=macbookpro.home
more lines of code
2015-02-03T08:37:09.018-0500 [initandlisten] waiting for connections on port 27017