In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. System version
[root@test2 ~] # cat / etc/issue CentOS release 6.5 (Final) Kernel\ r on an\ m
two。 Download MongoDB to / usr/loca/
[root@test2 ~] # cd / usr/local/cd / usr/local/ [root@test2 ~] # cd / usr/local/wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.0.7.tgz
3. Extract and create the storage and log directory of the database:
[root@test2 local] # tar-zxvf mongodb-linux-x86_64-rhel62-3.0.7.tgz [root@test2 local] # mkdir-p mogodb/ {data,logs} [root@test2 local] # cd mogodb/ [root@test2 mogodb] # ls bin data GNU-AGPL-3.0 logs README THIRD-PARTY-NOTICES [root@test2 mogodb] # cd logs/ [root@test2 logs] # touch mongodb.log
4. Establish a configuration file
[root@test2 mogodb] # vi / usr/local/mongodb/bin/mongodb.conf dbpath=/usr/local/mongodb/data logpath=/usr/local/mongodb/logs/mongodb.log port=27017 fork=true nohttpinterface=true
5. Start MongoDB
[root@test2 mongodb] # / usr/local/mongodb/bin/mongod-bind_ip localhost-f / usr/local/mongodb/bin/mongodb.conf about to fork child process, waiting until server is ready for connections. Forked process: 1449 child process started successfully, parent exiting
6. Set Boot self-boot MongoDB
[root@test2 mongodb] # echo "/ usr/local/mongodb/bin/mongod-config / usr/local/mongodb/bin/mongodb.conf" > > / etc/rc.local/usr/local/mongodb/bin/mongod-config / usr/local/mongodb/bin/mongodb.conf
7. Test:
(1) enter the shell mode of Mongodb:
[root@test2] # / usr/local/mongodb/bin/mongo MongoDB shell version: 3.0.7 connecting to: test Server has startup warnings: 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] * * WARNING: You are running this process as the root user, which is not recommended. 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/enabled is' always'. 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never' 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/defrag is' always'. 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never' 2015-11-11T18:26:02.022+0800 I CONTROL [initandlisten] >
(2) View the list of databases
> show dbsshow dbs local 0.078GB
(3) View the database version
> db.version (); db.version (); 3.0.7
(4) close the database
[root@test2 bin] # / usr/local/mongodb/bin/mongod-- shutdown-- config / usr/local/mongodb/bin/mongodb.conf 2015-11-11T18:36:01.404+0800 I CONTROL log file "/ usr/local/mongodb/logs/mongodb.log" exists; moved to "/ usr/local/mongodb/logs/mongodb.log.2015-11-11T10-36-01" Killing process with pid: 1449
Or use kill
[root@test2] # ps-ef | grep mongoroot 1505 10 18:37? 00:00:03 / usr/local/mongodb/bin/mongod-- bind_ip localhost-f / usr/local/mongodb/bin/mongodb.confroot 1544 1324 0 18:45 pts/2 00:00:00 grep mongo [root@test2] # kill 1505
Note: kill-9 pid cannot be used in this place, which will result in data loss and mongodb may report an error.
If you shut down mongodb using kill-9 pid and mongodb does not start properly, delete the mongod.lock file
[root@test2 bin] # kill rm-rf / usr/local/mongodb/data/mongod.lock
[root@test2 bin] # / usr/local/mongodb/bin/mongod-- config / usr/local/mongodb/bin/mongodb.conf
This article draws lessons from the "doiido" blog, http://doiido.blog.51cto.com/5503054/1562541
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.