Implementation of MongoDB cluster construction and Sharding

Source: Internet
Author: User
How can I build a MongoDB replication cluster in a MongoDB cluster? Type: Master? Which J? Master/slave) replica set mode (replicaset) replica and mode at least 3 ???? (One master two? Module ?? Tomb ???? Copy master ?? ? K and ?? Mei prize mirror? Mu ??? Redundant ?. Tags: MongoDBdebian

MongoDBCluster creation

MongoDB replication cluster? Type:

Primary? Which J? Master/slave)

Replica set mode (replica set)

The copy and mode must be at least 3 ???? (One master two? Module ?? Tomb ???? Copy master ?? ? K and ?? Mei prize mirror? Mu ??? Redundant ?.

(Incluarbiter :? H parameter ???, But does not hold any ??? /Span>

Limit 0 ?? First? : Yes ????, But cannot be ?? Master ??

Which of the following is repiset? Ji? X cluster name ?)


1.?? Ann? MongDB

Accurate? H environment:

System? : 64-bit Debian 7.2

Mongodb: mongodb-linux-x86_64-2.4.5.tgz (officer? Yes)

Root @ namenode1:/usr/local/tools # tar xfmongodb-linux-x86_64-2.4.5.tgz

Root @ namenode1:/usr/local/tools # mv mongodb-linux-x86_64-2.4.5/usr/local/
Root @ namenode1:/usr/local/tools # cd/usr/local/
Root @ namenode1:/usr/local # ln-s/usr/local/mongodb-linux-x86_64-2.4.5 // usr/local/mongodb

Root @ namenode1:/usr/local # ll | grep mongo
Lrwxrwxrwx 1 root staff 38 March 17 15:35 mongodb->/usr/local/mongodb-linux-x86_64-2.4.5/
Drwxr-sr-x 3 root staff 4096 March 17 15:08 mongodb-linux-x86_64-2.4.5

#?? Creation ?? /Span>

Root @ namenode1 :~ # Groupadd-r development D
Root @ namenode1 :~ # Useradd-M-r-g mongod-d/data/db-s/bin/false-c mongodmongod

# Create a project?

Root @ namenode1 :~ # Mkdir-p/var/log/mongo/

Root @ namenode1 :~ # Mkdir-p/mongo/data
Root @ namenode1 :~ # Chown mongod/mongo/data/var/log/mongo/


Root @ namenode1 :~ # Ll/var/log/| grep mongo

Drwxr-xr-x 2 mongod root 4096 Mar 17 15: 25 mongo
Root @ namenode1 :~ # Ll/mongo/
Total 4
Drwxr-xr-x 2 mongod root 4096 Mar 17 data

#?? /Span> LC_ALL = "C" join? Environment? Quantity, in case? E

Root @ namenode1 :~ # Echo 'export LC_ALL = "C" '>/etc/profile

#?? Create a configuration file (? Why ?? Pm package security? Copy the configuration file after mongodb ??? Pure?

Root @ namenode1 :~ # 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 =/mongo/data

# Location of pidfile
Pidfilepath =/var/run/mongodb/mongod. pid

# Disables write-ahead journaling
# Nojournal = true

# Enables periodic logging of CPU utilization and I/O wait
# Cpu = true

# Turn on/off security. Off is currently the default
# Noauth = true
# Auth = true

# Verbose logging output.
# Verbose = true

# Inspect all client data for validity on receept (useful
# Developing drivers)
# Objcheck = true

# Enable db quota management
# Quota = true

# Set oplogging level where n is
#0 = off (default)
#1 = W
#2 = R
#3 = both
#7 = W + some reads
# Diaglog = 0

# Ignore query hints
# Nohints = true

# Disable the HTTP interface (Defaults to localhost: 27018 ).
# Nohttpinterface = true

# Turns off server-side scripting. This will result in greatly limited
# Functionality
# Noscripting = true

# Turns off table scans. Any query that wocould do a table scan fails.
# Notablescan = true

# Disable data file preallocation.
# Noprealloc = true

# Specify. ns file size for new databases.
# Nssize =

# Accout token for Mongo monitoring server.
# Mms-token =

# Server name for Mongo monitoring server.
# Mms-name =

# Ping interval for Mongo monitoring server.
# Mms-interval =

# Replication Options

# In replicated mongo databases, specify here whether this is a slave or master
# 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

Start ?? Ongodb

Export LC_ALL = "C"

Root @ namenode2:/usr/local/mongodb/bin # mongod-f/etc/mongod. conf

 

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.