There are many ways to install MongoDB, you can install the source code, and you can use the Yum source installation method in CentOS. Since MongoDB is updated more quickly, I prefer to use the Yum source installation method. The installation steps under 64-bit CentOS are as follows:
1. Preparatory work
Run the Yum command to view MongoDB package information [email protected]~]# yum Info Mongo-10gen
(Hint that there is no matching information) that the Yum source in your CentOS system does not contain MONGODB resources, so you need to add the Yum source before installing MongoDB with the Yum command, which means adding *.repo in the/etc/yum.repos.d/directory Yum Source configuration file
2, Vi/etc/yum.repos.d/10gen.repo, enter the following statement:
[10gen]
Name=10gen Repository
Baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
Gpgcheck=0
After you have configured the Yum source, you can query MongoDB-related information if the configuration correctly executes the following command:
View information for a MONGODB server package
[email protected] geffzhang]# Yum info mongo-10gen-server
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates:centos.ustc.edu.cn
Installed Packages
Name:mongo-10gen-server
Arch:x86_64
version:2.0.6
Release:mongodb_1
Size:13 M
Repo:installed
From Repo:10gen
Summary:mongo server, sharding server, and support scripts
url:http://www.mongodb.org
LICENSE:AGPL 3.0
Description:mongo (from "humongous") is a schema-free document-oriented
: Database.
:
: This package provides the MONGO server software, MONGO sharding
: Server Softwware, default configuration files, and INIT.D scripts.
To view client installation conditions
[Email protected] geffzhang]#
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates:centos.ustc.edu.cn
Installed Packages
Name:mongo-10gen
Arch:x86_64
version:2.0.6
Release:mongodb_1
size:69 M
Repo:installed
From Repo:10gen
Summary:mongo Client shell and tools
url:http://www.mongodb.org
LICENSE:AGPL 3.0
Description:mongo (from "humongous") is a schema-free document-oriented
: Database. IT features dynamic profileable queries, full indexing,
: Replication and fail-over support, efficient storage of large
: Binary Data Objects, and auto-sharding.
:
: This package provides the MONGO shell, import/export tools, and
: Other client utilities.
3. Installing MongoDB server side and client tools
[email protected] geffzhang]# Yum install Mongo-10gen-server
[email protected] geffzhang]# Yum install Mongo-10gen
4. Start MongoDB
Service Mongod Start
Updated later, stop MongoDB, execute yum update Mongo-10gen mongo-10gen-server.
5, server configuration:/etc/mongod.conf
# mongo.conf
#where to log
Logpath=/var/log/mongo/mongod.log
Logappend=true #以追加方式写入日志
# fork and run in background
Fork = True
#port = 27017 #端口
Dbpath=/var/lib/mongo #数据库文件保存位置
Directoryperdb=true
# Enables periodic logging of CPU utilization and I/O wait
#启用定期记录CPU利用率和 I/O waits
#cpu = True
# Turn on/off security. OFF is currently the default
# whether to run in secure authentication mode, default is non-secure way of authentication
#noauth = True
#auth = True
# Verbose logging output.
# Verbose record output
#verbose = True
# Inspect all client data for validity in receipt (useful for
# Developing drivers) Check the validity of the client receiving data when developing the driver
#objcheck = True
# Enable DB quota management enables database quota management, with a default of 8 files per db, which can be set with the Quotafiles parameter
#quota = True
# Set Oplog record level
# Set oplogging level where n is
# 0=off (default)
# 1=w
# 2=r
# 3=both
# 7=w+some Reads
#oplog = 0
# diagnostic/debugging option Dynamic Debug Item
#nocursors = True
# Ignore Query hints ignore queries hint
#nohints = True
# Disable HTTP interface, default to localhost:28017
# Disable The HTTP interface (Defaults to localhost:27018). This port number is wrong.
#nohttpinterface = True
# Close the server-side script, which will greatly limit the functionality
# Turns off server-side scripting. This would result in greatly limited
# functionality
#noscripting = True
# Close Scan table, any query will be scan failed
# Turns off table scans. Any query this would do a table scan fails.
#notablescan = True
# Close data file pre-allocation
# Disable data File preallocation.
#noprealloc = True
# Specify the size of the. ns file for the new database, in MB
# specify. ns file size for new databases.
# nssize = <size>
# Accout token for Mongo monitoring server.
#mms-token = <token>
# MONGO the name of the monitoring server
# server name for Mongo monitoring server.
#mms-name = <server-name>
# MONGO The ping interval of the monitoring server
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>
# Replication Options Copy option
# in replicated MONGO databases, specify here whether the is a slave or master in replication, specifies that the current is a dependency
#slave = True
#source = master.example.com
# Slave only:specify A single database to replicate
#only = master.example.com
# or
#master = True
#source = slave.example.com
Hadoop Mong DB CentOS 6 installs MongoDB and server-side configuration with Yum