In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Description:
Operating system: CentOS 6.664 bit
Main library: 10.24.24.19
From the library: 10.24.24.20
To achieve the goal:
Install and configure the MongoDB database
Specific operations:
First, close SElinux and configure firewall
1 、 vi / etc/selinux/config
# SELINUX=enforcing # comment out
# SELINUXTYPE=targeted # comment out
SELINUX=disabled # increased
: wq! # Save exit
Setenforce 0 # makes the configuration effective immediately
2. Edit vi / etc/sysconfig/iptables #
-A RH-Firewall-1-INPUT-m state-- state NEW-m tcp-p tcp-- dport 27017-j ACCEPT # allow port 27017 to pass through the firewall
: wq! # Save exit
/ etc/init.d/iptables restart # restart the firewall for the configuration to take effect
Second, install MongoDB
# the latest version at present
MongoDB download address: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.10.tgz
Upload mongodb-linux-x86_64-2.6.10.tgz to the / usr/local/src directory
# enter the software storage directory
Cd / usr/local/src
# decompression
Tar zxvf mongodb-linux-x86_64-2.6.10.tgz
# move the extracted folder to the MongoDB installation directory
Mv mongodb-linux-x86_64-2.6.10 / usr/local/mongodb
Mkdir-p / home/data/mongodb/mongodb_data/ # create MongoDB database storage path
Mkdir-p / home/data/mongodb/mongodb_log/ # create MongoDB database log storage path
# start MongoDB
/ usr/local/mongodb/bin/mongod-port 27017-fork-dbpath=/home/data/mongodb/mongodb_data/-logpath=/home/data/mongodb/mongodb_log/mongodb.log-logappend
Check to see if MongoDB is started
[root@mongodb local] # netstat-lanp | grep "27017"
Tcp 0 0 0.0.0 0 27017 0.0.0 0 15 * LISTEN 1145/mongod
Unix 2 [ACC] STREAM LISTENING 13496 1145/mongod / tmp/mongodb-27017.sock
# enter the MongoDB database console
Cd / usr/local/mongodb/bin/
# enter admin database
. / mongo
# shut down the MongoDB database
Use admin
Db.shutdownServer ()
Exit # exit
Third, set up the MongoDB database
1. Cd / usr/local/mongodb/ # enter the MongoDB installation directory
Vim / usr/local/mongodb/mongodb.conf # editing
Port=27017 # Port number
Dbpath=/home/data/mongodb/mongodb_data/ # database path
Logpath=/home/data/mongodb/mongodb_log/mongodb.log # Log output file path
Pidfilepath=/usr/local/mongodb/mongo.pid
Fork=true # set up background running
Logappend=true # Log output method
Shardsvr=true
Directoryperdb=true
# auth=true # enable authentication
: wq! # Save exit
2 、
Cd / usr/local/mongodb/bin/
# start MongoDB
. / mongod-- config / usr/local/mongodb/mongodb.conf
# turn off MongoDB
. / mongo 127.0.0.1:27017/admin-- eval "db.shutdownServer ()"
# set boot MongoDB
Vim / etc/rc.d/init.d/mongod
Ulimit-SHn 655350
#! / bin/sh
# chkconfig:-64 36
# description:mongod
Case $1 in
Start)
/ usr/local/mongodb/bin/mongod-maxConns 20000-config / usr/local/mongodb/mongodb.conf
Stop)
/ usr/local/mongodb/bin/mongo 127.0.0.1:27017/admin-- eval "db.shutdownServer ()"
Status)
/ usr/local/mongodb/bin/mongo 127.0.0.1:27017/admin-- eval "db.stats ()"
Esac
: wq! # Save exit
Chmod + x / etc/rc.d/init.d/mongod # add script execution permissions
Chkconfig mongod on # set boot up
Service mongod start # launch MongoDB
3. Vim / etc/profile # add environment variables, edit, and add the following code on the last line
Export PATH=$PATH:/usr/local/mongodb/bin
: wq! # Save exit
Source / etc/profile # makes the configuration effective immediately
Mongo # enter the MongoDB console
Show dbs # View default database
Use admin # switch to admin database
Exit # exit the MongoDB console
At this point, the MongoDB database installation and configuration is complete.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.