CENTOS6 configuration Installation MongoDB and master-slave synchronization and data backup and recovery

Source: Internet
Author: User
Tags auth mkdir mongodb require time interval

= = = Installation, Configuration = = =

The code is as follows Copy Code

#下载源码包
Cd/usr/local/src/mongodb
Wget-c http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.7.tgz

#解压, copy the bin folder to the specified directory/usr/local/mongodb
TAR-XZVF./mongodb-linux-x86_64-2.2.7.tgz
CD./mongodb-linux-x86_64-2.2.7
Mkdir/usr/local/mongodb
Cp-rf./bin/usr/local/mongodb/# to copy the Bin folder to the past! Note: The end of/can not be missed!

#定义数据目录, log directory (create a new data directory under the MongoDB directory, store the log, create a new logs directory, and then create a new log file in the directory, for example, we named Mongodb.log)
Cd/usr/local/mongodb
mkdir./data
mkdir./logs
Touch./logs/mongodb.log

#启动mongodb (boot MongoDB for the Bin folder under CD to MongoDB directory)

Here is the login method that requires permission, user name and password to connect
/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data--logpath=/usr/local/mongodb/logs/mongodb.log-- Logappend--auth--port=27017--fork

This one does not require a password (use this for a while!). )
/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data--logpath=/usr/local/mongodb/logs/mongodb.log-- Logappend--port=27017--fork

Parameter explanation:

--dbpath database path (data file)
--logpath log file path
--master designated as the main machine
--slave specified as from machine
--SOURCE Specifies the IP address of the primary machine
--POLOGSIZE specifies that the log file size does not exceed 64M. Because Resync is very large and time-consuming, it is best to avoid resync by setting a large enough oplogsize (the default oplog size is 5% of the size of the idle disk).
--logappend the end of the log file add
--port Enable port number
--fork running in the background
--only specify which database to copy only
--slavedelay refers to the time interval from replication detection
--auth whether to require authentication permission logins (username and password)


-H [--help] Show this usage information
--version Show version Information
-F [--config] arg configuration file specifying additional options
--port Arg Specify port number
--BIND_IP arg local IP addresses to bind Listener-all local IPs
Bound by default
-V [--verbose] is more verbose (include multiple
verbosity e.g.-VVVVV)
--dbpath Arg (=/data/db/) directory for datafiles specify data storage directory
--quiet Quieter output Silent mode
--logpath arg file to send all output to instead of stdout specify log storage directory
--logappend APPND to LogPath instead of over-writing Specify whether the log is written in an append or overwrite way
--fork Fork Server process to create a subprocess
--CPU periodically show CPU and iowait utilization periodic display CPU and IO usage
--noauth run without security no authentication mode
--auth run with security authentication mode
--objcheck inspect client data for validity on receipt check the validity check of clients ' input data
--quota Enable DB quota management start database quota management
--quotafiles arg number of files Allower per db, requires--quota specify how many files each database allows
--appsrvpath arg root directory for the Babble app server
--nocursors diagnostic/debugging option Debug Diagnostics options
--nohints Ignore query hints ignore hit hits
--nohttpinterface Disable HTTP Interface shutdown HTTP interface, default is 28017
--noscripting Disable scripting engine shutdown script engine
--noprealloc Disable data file preallocation shutdown database File size pre-allocation
--smallfiles use a smaller default file size with a smaller defaults
--nssize Arg (=16). ns file Size (in MB) for new databases The default size of the newly-NS files
--diaglog arg 0=off 1=w 2=r 3=both 7=w+some reads provides a way to read-only, write only, read or write, or mainly write + part of the reading mode
--sysinfo Print Some diagnostic system Information printer diagnostic information
--upgrade upgrade DB If needed update database if needed
--repair Run Repair on all DBS repairs all databases
--notablescan does not allow table scans does not run a sheet scan
--syncdelay Arg (=60) seconds between disk syncs (0 for never) system synchronized Refresh Disk Time, default 60s

Replication options:www.111cn.net
--master Master Mode primary replication mode
--slave slave mode from replication
--source Arg when slave:specify master as <server:port> specifies the address and port of the master when from
--only Arg when slave:specify a singleton to replicate specifies a single library that needs to be copied from the primary
--pairwith ARG address of the server to pair with
--arbiter arg address of arbiter server arbiter, used in main and pair
--autoresync automatically resync if slave data is stale automatic synchronization from
--oplogsize arg size limit (in MB) for OP log specifies the size of the action logs
--opidmem arg size limit (in bytes) for in memory storage of OP ids specifies the memory size of the storage action log

    Sharding options:
   --configsvr            Declare this is a config db of a cluster specify the configuration server in Shard
   --SHARDSVR&NBSP;&N bsp;          declare this is a shard db of a cluster specify Shard server

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.