Centos5.9 Install MongoDB Database steps

Source: Internet
Author: User
Tags auth install mongodb mongodb mongodb create database time interval create database

Today we have to install the MongoDB bar, this is a database, in order to lazy, this article on the use of Yum installation, after all, yum convenient, rely on the package will be installed, unless it is a separate entire DB server to compile the installation.
System: CentOS 5.9
1. Pre-Installation Preparation
This is for a 64-bit system Yum Source:
echo "[MongoDB]
Name=mongodb Repository
Baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
Gpgcheck=0
Enabled=1 "| sudo tee-a/etc/yum.repos.d/mongodb.repo

This is for a 32-bit system Yum source
echo "[MongoDB]
Name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
Gpgcheck=0
Enabled=1 "| sudo tee-a/etc/yum.repos.d/mongodb.repo

2. Install MongoDB
Yum-y Install Mongo-10gen Mongo-10gen-server

3. Configure MongoDB
Cat/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 #数据库文件保存位置

# Enables periodic logging of CPU utilization and I/O wait
#启用定期记录CPU利用率和 I/O wait
#cpu = True

# Turn On/off Security. Off is currently the default
# is run as security authentication, default is not authenticated unsecured way
#noauth = True
#auth = True

# Verbose logging output.
# Verbose record output
#verbose = True

# Inspect all client data for validity on receipt (useful for
# Developing drivers to check the validity of client-received data when developing drivers
#objcheck = True

# Enable DB quota management enables database quota management, which can have 8 files per db By default and 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 items
#nocursors = True

# Ignore Query hints Ignore inquiry hints
#nohints = True
# Disable HTTP interface, default to localhost:28017
# Disable The HTTP interface (Defaults to localhost:27018). This port number is written incorrectly.
#nohttpinterface = True

# Close server-side scripts, which will greatly restrict functionality
# Turns off server-side scripting. This'll result in greatly limited
# functionality
#noscripting = True
# Close Scan table, any query will be scan failed
# Turns off table scans. Any query so 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 megabytes: MB
# specify. ns file size for new databases.
# nssize = <size>

# Accout token for Mongo monitoring server.
#mms-token = <token>
# MONGO the name of the monitor server
# server name for Mongo monitoring server.
#mms-name = <server-name>
# MONGO The ping interval of the monitor server
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>

# Replication Options Replication option

# in replicated MONGO databases, specify here whether this is a slave or master in replication, specifies that the current is a subordinate relationship
#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

These are some of the parameters in the default configuration file, and more parameters can be viewed with the mongod-h command



[Root@test ~]# Mongod-h
Allowed Options:

General Options:
-H [--help] Show this usage information
--version Show version Information
-F [--config] arg configuration file specifying additional options specify boot profile path
-V [--verbose] is more verbose (include multiple
verbosity e.g.-VVVVV)
--quiet quieter output
--port ARG specify port number ports
--BIND_IP Arg comma separated list of IP addresses to listen on-
All local IPs by default bound IP can be multiple
--maxconns arg max number of simultaneous connections maximum concurrent connections
--logpath arg log file to send write to instead of Stdout-has to
Being a file, not directory log file path
--logappend Append to LogPath instead of over-writing log write mode
--pidfilepath arg full path to Pidfile (if not set, no Pidfile
Created) PID file path
--keyfile ARG private key for cluster authentication
Replica sets) cluster authentication private key, only available for replica set
--unixsocketprefix arg alternative directory for UNIX domain sockets
(Defaults to/tmp) Alternative directory
--fork Fork Server process
--auth run with Security using authentication Mode
--CPU periodically show CPU and iowait utilization periodic CPU and IO wait utilization
--dbpath arg directory for datafiles database file path
--diaglog arg 0=off 1=w 2=r 3=both 7=w+some reads Oplog record level
--directoryperdb each database would be stored in a separate directory
Each database is stored in a separate directory
--journal enable journaling log, recommended to open, in abnormal downtime can restore some data
--journaloptions ARG journal Diagnostic options
--ipv6 Enable IPV6 support (disabled by default)
--jsonp allow JSONP access via HTTP (Has security
Implications) allows JSONP to be accessed via HTTP, which has security implications
--noauth run without security without a secure authentication method
--nohttpinterface Disable HTTP interface Disable HTTP interface
--noprealloc Disable data file Preallocation-will often hurt
Performance disabling the pre-allocation of data files can often impair performance
--noscripting Disable scripting engine disable scripting engine
--notablescan does not allow table scans does not allow tables to scan
--nounixsocket Disable listening on UNIX sockets prohibit UNIX sockets listening
--nssize Arg (=16). ns file Size (in MB) for new databases set the size of the. ns files
--objcheck inspect client data for validity on receipt check the validity of the data received from the clients
--profile arg 0=off 1=slow, 2=all
--quota limits each database to a certain number of files (8
Default) enables database quota management, which can have 8 files per db and can be set with the Quotafiles parameter
--quotafiles arg number of files Allower per db, requires--quota
--rest turn on the simple Rest API to open the REST API
--repair Run Repair on all DBS repair all databases
--repairpath arg root directory for repair files-defaults to dbpath repair the root of the file, the default
considers the directory specified by DBPath
--slowms arg (=100) value of slow for profile and console log
--smallfiles use a smaller default file size
--syncdelay Arg (=60) seconds between disk syncs (0=never, but not
Recommended) time to synchronize data with the hard disk, default 60 seconds, 0 means no sync to hard drive (not recommended)
--sysinfo Print Some diagnostic system information prints some diagnostic system information
--upgrade Upgrade DB If needed upgrade the database file to a new format if necessary
(Required when <=1.0 to 1.1+ upgrade)

Replication Options: Replication option
--fastsync indicate that this instance be starting from a DBPath
Snapshot of the REPL peer sync from a dbpath snapshot
--autoresync automatically resync if slave the data is stale automatic synchronization if the from machine is not new
Automatic sync
--oplogsize arg size limit (in MB) for op log oplog

Master/slave options: Master/from configuration option
--master Master Mode
--slave slave mode dependent modes
--source Arg when slave:specify Master as <server:port> designated primary server address on secondary server
--only Arg when slave:specify a single database to replicate secondary server specifies the
Database
--slavedelay Arg specify delay (in seconds) to is used when applying
Master Ops to slave specifies the time interval in seconds to synchronize data from the primary server

Replica SET options: Replica set option
--replset arg arg is <setname>[/<optionalseedhostlist>]
Parameter:< name >[< seed Host List

Sharding Options: Fragment Setup option
--configsvr Declare this is a config db of a cluster; Default port
27019; The default Dir/data/configdb declares that this is a clustered configuration database,
The default port is 27019 the default path is/data/configdb
--shardsvr declare this is a shard db of a cluster; Default port
27018 declares that this is a fragmented database of clusters with a default port of 27018
--nomoveparanoia turn off paranoid saving of the data for Movechunk. This
is on by default to now, but default would switch
Close to save large chunks of data. Now it's the default, but it's going to change

5. Start MongoDB
Service Mongod Start
Chkconfig Mongod on

If the startup display succeeds, you can enter at the command line:
Mongo
Test and manipulate the database. MONGODB CREATE database and configure user methods

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.