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

Mongodb2.6 installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The operating system environment is as follows:

[root@zxl-nginx ~] # cat / etc/issueCentOS release 6.4 (Final) Kernel\ r on an\ m [root@zxl-nginx ~] # uname-r2.6.32-358.el6.x86_64

Mongodb2.6 download address

# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.11.tgz

Install mongodb2.6

[root@zxl-nginx src] # ll mongodb-linux-x86_64-2.6.11.gz-rw-r--r-- 1 root root 116659120 Dec 13 09:32 mongodb-linux-x86_64-2.6.11.gz [root@zxl-nginx src] # tar fxz mongodb-linux-x86_64-2.6.11.gz [root@zxl-nginx src] # mv mongodb-linux-x86_64-2.6.11 / usr/local/ [root@zxl-nginx src] # ln-s / usr/local/mongodb-linux-x86_64-2.6.11 / usr/local/mongodb

Create a mongodb user

[root@zxl-nginx src] # groupadd-r mongodb [root@zxl-nginx src] # useradd-r-g mongodb mongodb

Create a mongodb database and logs directory

[root@zxl-nginx src] # mkdir / data/ [root@zxl-nginx src] # mkdir / data/logs / data/m20000 [root@zxl-nginx src] # chown mongodb.mongodb / data-R

Mongo environment variable configuration

Vim / etc/profileexport PATH=$PATH:/usr/local/mongodb/bin

Load environment profile

Source / ect/profile

Start mongodb

Mongod-dbpath=/data/m20000/-logpath=/data/logs/m20000.log-logappend-fork-port 20000

Log in to mongodb

[root@zxl-nginx ~] # mongo-- port 20000MongoDB shell version: 2.6.11connecting to: 127.0.0.1:20000/test > dbtest

Create data and view

> use zxlswitched to db zxl > db.ha.insert ({name: "abc", age:21}) WriteResult ({"nInserted": 1}) > db.ha.find () {"_ id": ObjectId ("56739b27154b52481c1c5749"), "name": "abc", "age": 21}

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