MongoDB Installation/configuration (file)/startup issues
: Http://www.mongodb.org/downloads
[email protected] software]# LL | grep Mongodb-linux-x86_64-2.4.12.tar
-rw-r--r--. 1 root root 95267358 January 6 11:02 Mongodb-linux-x86_64-2.4.12.tar
[Email protected] software]# TAR-XVF Mongodb-linux-x86_64-2.4.12.tar
[Email protected] software]# CD mongodb-linux-x86_64-2.4.12
[email protected] mongodb-linux-x86_64-2.4.12]# LL
Total Dosage 64
Drwxr-xr-x. 2 root root 4096 January 7 13:13 Bin
-RW-------. 1 Nagios nagios 34520 August 4 gnu-agpl-3.0
-RW-------. 1 Nagios Nagios 1359 August 4 README
-RW-------. 1 Nagios nagios 18436 August 4 third-party-notices
All ongodb-linux-x86_64-2.4.12 files are CP to/usr/local/mongodb
[Email protected] mongodb-linux-x86_64-2.4.12]# CP-RF */usr/local/mongodb/
[Email protected] mongodb]# Cd/usr/local/mongodb
To create a data catalog:
[Email protected] mongodb]# mkdir data
To create a log file:
[email protected] mongodb]# Touch logs
[[Email protected] mongodb]# CD bin
[Email protected] bin]# pwd
/usr/local/mongodb/bin
[email protected] bin]# LL
Total dosage 237824
-rwxr-xr-x. 1 root root 18316272 January 6 14:30 bsondump
-rwxr-xr-x. 1 root root 9537192 January 6 14:30 MONGO
-rwxr-xr-x. 1 root root 18376872 January 6 14:30 Mongod
-rwxr-xr-x. 1 root root 18373328 January 6 14:30 mongodump
-rwxr-xr-x. 1 root root 18328816 January 6 14:30 Mongoexport
-rwxr-xr-x. 1 root root 18377760 January 6 14:30 mongofiles
-rwxr-xr-x. 1 root root 18340944 January 6 14:30 Mongoimport
-rwxr-xr-x. 1 root root 18320432 January 6 14:30 Mongooplog
-rwxr-xr-x. 1 root root 18320080 January 6 14:30 Mongoperf
-rwxr-xr-x. 1 root root 18381296 January 6 14:30 Mongorestore
-rwxr-xr-x. 1 root root 13868984 January 6 14:30 MONGOs
-rwxr-xr-x. 1 root root 18286728 January 6 14:30 Mongosniff
-rwxr-xr-x. 1 root root 18366064 January 6 14:30 Mongostat
-rwxr-xr-x. 1 root root 18320944 January 6 14:30 mongotop
The file MONGO (Customer Service command)/mongod (MONGO boot command) CP to/usr/bin (the two commands become the global command)
[email protected] bin]# CP mongod/usr/bin/
[email protected] bin]# CP mongo/usr/bin/
To create a MONGO configuration file:
[Email protected] bin]# touch/etc/mongodb.conf
Configure the parameters in the file.
# config file stored in/etc/mongod.conf
#------------------------------is the content---------------------------------------
# mongo.conf
# Database File Save location
Dbpath=/usr/local/mongodb/data
# Where to save log files
Logpath=/usr/local/mongodb/logs
# logs are recorded in a way that logs are saved as added
Logappend
# requires authentication
Auth
# Run Port
port=27017
# Run in the background
Fork
# PID File path
Pidfilepath=/usr/local/mongodb/mongodb.pid
To start the MongoDB service:
[Email protected] bin]# Mongod--config=/etc/mongodb.conf
About-to-fork child process, waiting until server was ready for connections.
Forked process:30913
All output going to:/usr/local/mongodb/logs
Child process started successfully, parent exiting
To see if the service started successfully:
[Email protected] bin]# NETSTAT-LANP | grep "27017"
UNIX 2 [ACC] STREAM LISTENING 211915 30932/mongod/tmp/mongodb-27017.sock
To close the MongoDB service:
[Email protected] bin]# Mongod--dbpath=/usr/local/mongodb/data--shutdown
Killing process with pid:30913
Configure the MongoDB service to boot: add Mongod--config=/etc/mongodb.conf to/etc/rc.local
[Email protected] bin]# vi/etc/rc.local
#!/bin/sh
#
# This script is executed *after* all and the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to does the full Sys V style init stuff.
Mongod--config=/etc/mongodb.conf
Touch/var/lock/subsys/local
/usr/local/net-snmp/sbin/snmpd-c/etc/snmpd.con
======= above is the configuration and installation of MongoDB ===============================================================
mongodb.conf Startup Parameters
Configuration files are stored in/etc/mongod.conf
#------------------------------is the content---------------------------------------
# mongo.conf
# Log File storage location
Logpath=/var/log/mongo/mongod.log
# write the log in append mode
Logappend=true
# whether the daemon is running (running in the background)
Fork = True
# Set port (default 27017)
#port = 27017
# Database File Save location
Dbpath=/var/lib/mongo
# Enables periodic logging of CPU utilization and I/O wait
# Enable periodic logging of CPU utilization and 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
# Enable database quota management, the default per db can have 8 files, 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
=====================================
An individual's understanding of some of the important parameters:
--dbpath: Data storage directory, MongoDB boot must have parameters.
–logpath: Log storage file, MongoDB boot if not with this parameter.
--logappend: The log is written to the log file in append mode.
--auth: Users who log in to MONGO must authenticate (provide password and account number), empty account can login but do not have permission to operate DB,
If this parameter is not specified at startup, then the user logged in to MONGO has all the permissions (unsafe),
The user permissions in the Admin schema are the largest and can be queried for information in any other schema, and users in other schemas can only view information in their own schemas.
–-port: Specify port
--shutdown: Close MONGO Service
--fork: Run in the background, this parameter must be used with--logpath.
http://blog.csdn.net/yuwenruli/article/details/8529192
This article is from the "SQL Server MySQL" blog, so be sure to keep this source http://dwchaoyue.blog.51cto.com/2826417/1600127
MongoDB Installation/configuration (file)/startup issues