LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mongo data base configuration (https://www.linuxquestions.org/questions/linux-newbie-8/mongo-data-base-configuration-4175504633/)

linuxmantra 05-11-2014 10:23 AM

Mongo data base configuration
 
I am new to MongoDB. I installed mongo in my machine which is running RHEL 6.4. As per the our company wiki, I created following directories:
#mkdir /data/
#mkdir /data/db
#mkdir /data/log
#mkdir /data/arb (As per our company wiki, I am making Mongodb Arbiter server, they told me to create /data/arb directory)

I set up all things as per our wiki instruction. But, I got a feedback from team as:

"The database should be configured to live in /data/xxx", here xxx is 'arb' directory because I am making mongodb arbiter server. What I did is, I made following change in mongod.conf file (shown by arrow line):
------------------------------------------------------------
# mongod.conf

#where to log
#logpath=/var/log/mongodb/mongod.log
logpath=/data/log/mongod.log

logappend=true

# fork and run in background
fork=true

port=30000 <----Port for Arbiter
keyFile=/data/keyfile
#dbpath=/var/lib/mongo <----This was earlier & I comment out it
dbpath=/data/arb <-----------It was added by me

# location of pidfile
pidfilepath=/var/run/mongodb/mongod.pid
- - -
--------------------------------------------------------------
I started the mongod service # service mongod restart and I checked the /data/arb file and found following files inside it.
--------------------------------------------------------------
drwxr-xr-x 2 mongod mongod 4096 May 11 10:11 journal
-rw------- 1 mongod mongod 67108864 May 11 10:11 local.0
-rw------- 1 mongod mongod 16777216 May 11 10:11 local.ns
-rwxr-xr-x 1 mongod mongod 5 May 11 10:11 mongod.lock
---------------------------------------------------------------

NOW, could you please tell me as per the feedback given by team to me in my ticket "The database should be configured to live in /data/arb", Have I done it correctly???

THANK YOU IN ADVANCE

eklavya 05-12-2014 08:07 AM

Have you imported database? Can you see the database file in /data/arb
If you have mongo client like rockmongo or similar one, you can import/export database using this.

If you are able to see the data using command line or using client, it means it is configured correctly.

linuxmantra 05-12-2014 08:11 AM

Quote:

Originally Posted by eklavya (Post 5169286)
Have you imported database? Can you see the database file in /data/arb
If you have mongo client like rockmongo or similar one, you can import/export database using this.

If you are able to see the data using command line or using client, it means it is configured correctly.

Content of my /data/arb:

total 81936
drwxr-xr-x 2 mongod mongod 4096 May 12 08:56 journal
-rw------- 1 mongod mongod 67108864 May 12 08:56 local.0
-rw------- 1 mongod mongod 16777216 May 12 08:56 local.ns
-rwxr-xr-x 1 mongod mongod 5 May 12 08:56 mongod.lock

Did you mean this files?

eklavya 05-12-2014 08:28 AM

Yes these files. It looks correct but when you will import real database and you will be able to access data using browser then it will be confirmed your configuration is fine.
You can create test database and check it.
Quote:

# mongo
MongoDB shell version: 2.2.3
Quote:

> use testdb
switched to db testdb
Quote:

> show dbs
local (empty)
Database “testdb” is not created yet.Define a collection named “users“, and save a dummy document(value) inside.
Quote:

> db.users.save( {username:"testing"} )
Now check the inserted data
Quote:

> db.users.find()
Output will be something like this.
{ "_id" : ObjectId("5370cab552f5c7a7a4378e34"), "username" : "testing" }
Now check list of databases
Quote:

> show dbs
testdb 0.0625GB
local (empty)
Database has been created.


All times are GMT -5. The time now is 06:21 PM.