Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation of mongodb on linux

2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Download address

Http://www.mongodb.org/

2. Prepare before installation

2.1. Create data directory and log directory

[root@gflinux4 mongodb] # mkdir-p/opt/mongo/ {data,logs}

2.1. Create users and groups

[root@gflinux mongodb] # useradd mongo

[root@gflinux mongodb] # groupadd mongo

Groupadd: group mongo exists

2.3 change directory belonging to group

[root@gflinux mongodb] # chown-Rmongo:mongo / opt/mongo/

[root@gflinux mongodb] # ll

Total 112244

3. Decompression

[root@gflinuxmongodb] # tar-zxvf mongodb-linux-i686-2.6.5.tgz

[root@gflinux mongodb] # cd mongodb-linux-i686-2.6.5

[root@gflinux mongodb-linux-i686-2.6.5] # ll

Cdtotal 64

Drwxr-xr-x 2 root root 4096 Oct 31 11:47 bin

-rw-r--r-- 1 root root 34520 Oct 8 00:13 GNU-AGPL-3.0

-rw-r--r-- 1 root root 1359 Oct 8 00:13 README

-rw-r--r-- 1 root root 17793 Oct 8 00:13 THIRD-PARTY-NOTICES

4. Migrate the data to the / usr/local/mongo directory

4.1 copy files to / usr/local/mongo

[root@gflinux4 mongodb] # cp-Rmongodb-linux-i686-2.6.5 / usr/local/mongo

[root@gflinux4 mongodb] # cd/usr/local/mongo/

[root@gflinux4 mongo] # ll

Total 64

Drwxr-xr-x 2 root root 4096 Dec 25 03:39 bin

-rw-r--r-- 1 root root 34520 Dec 25 03:39GNU-AGPL-3.0

-rw-r--r-- 1 root root 1359 Dec 25 03:39 README

-rw-r--r-- 1 root root 17793 Dec 25 03:39THIRD-PARTY-NOTICES

[root@gflinux4 mongo] # cd bin/

[root@gflinux4 bin] # ll

Total 279652

-rwxr-xr-x 1 root root 23262756 Dec 2503 Dec 39 bsondump

-rwxr-xr-x 1 root root 11646208 Dec 2503 Dec 39 mongo

-rwxr-xr-x 1 root root 23425560 Dec 2503 Dec 39 mongod

-rwxr-xr-x 1 root root 23333956 Dec 2503 Dec 39 mongodump

-rwxr-xr-x 1 root root 23281924 Dec 2503 Dec 39 mongoexport

-rwxr-xr-x 1 root root 23326132 Dec 2503 Dec 39 mongofiles

-rwxr-xr-x 1 root root 23301860 Dec 2503 Dec 39 mongoimport

-rwxr-xr-x 1 root root 23272516 Dec 2503 Dec 39 mongooplog

-rwxr-xr-x 1 root root 23079220 Dec 2503 Dec 39 mongoperf

-rwxr-xr-x 1 root root 23371588 Dec 25 03:39mongorestore

-rwxr-xr-x 1 root root 18096080 Dec 2503 Dec 39 mongos

-rwxr-xr-x 1 root root 23321732 Dec 2503 Dec 39 mongostat

-rwxr-xr-x 1 root root 23265828 Dec 2503 Dec 39 mongotop

Copy mongo and mongod into / usr/bin/

[root@gflinux4 bin] # cp mongo / usr/bin/

[root@gflinux4 bin] # cp mongod / usr/bin/

5. Initialize the data and log directories

[root@gflinux4] # mongod-- port 10001--dbpath / opt/mongo/data-- logpath / opt/mongo/logs/mongodb.log

2014-12-25T03:45:35.518+0800

2014-12-25T03:45:35.519+0800 warning:32-bit servers don't have journaling enabled by default. Please use-- journalif you want durability.

2014-12-25T03:45:35.520+0800

[root@gflinux4 data] # pwd

/ opt/mongo/data

[root@gflinux4 data] # ll

Total 82016

-rw- 1 root root 67108864 Dec 2503 Dec 45 local.0

-rw- 1 root root 16777216 Dec 2503 Dec 45 local.ns

-rwxr-xr-x 1 root root 6 Dec 25 03:45 mongod.lock

Drwxr-xr-x 2 root root 4096 Dec 25 03:45 _ tmp

[root@gflinux4 data] #

[root@gflinux4 logs] # pwd

/ opt/mongo/logs

[root@gflinux4 logs] # ll

Total 4

-rw-r--r-- 1 root root 2300 Dec 25 03:45mongodb.log

[root@gflinux4 logs] #

6. Connect mongo

[root@gflinux4 logs] # mongo localhost:10001

MongoDB shell version: 2.6.5

Connecting to: localhost:10001/test

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

Http://docs.mongodb.org/

Questions? Try the support group

Http://groups.google.com/group/mongodb-user

Server has startup warnings:

2014-12-25T03:45:35.533+0800 [initandlisten]

2014-12-25T03:45:35.533+0800 [initandlisten] * NOTE: This is a 32 bit MongoDB binary.

2014-12-25T03:45:35.533+0800 [initandlisten] * 32 bit buildsare limited to less than 2GB of data (or less with-- journal).

2014-12-25T03:45:35.534+0800 [initandlisten] * * Note thatjournaling defaults to off for 32 bit and is currently off.

2014-12-25T03:45:35.534+0800 [initandlisten] * * See http://dochub.mongodb.org/core/32bit

2014-12-25T03:45:35.534+0800 [initandlisten]

> db.foo.save ({aVl1})

WriteResult ({"nInserted": 1})

> db.foo.find ()

{"_ id": ObjectId ("549b18ffff3a181677422f45"), "a": 1}

>

7. Testing

Http://192.168.88.101:10001/

It looks like you are trying to access MongoDBover HTTP on the native driver port.

8. Client connection

Connect using MongoVUE.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report