Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Database \ MongoDB slice simple example     - To use iostat display I / O status under Linux (Linux)

- Use web2py + uWSGI + Nginx Web server built on Linux (Server)

- Using IntelliJ IDEA 13 integrated development environment to build Android (Linux)

- The Java ThreadLocal (Programming)

- Two programs HAProxy + Heartbeat (note, the secondary server vip, normal HAProxy boot method) (Server)

- Linux platform Oracle MySQL connection (Database)

- Linux kernel RCU (Read Copy Update) lock Brief - prequel (Linux)

- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)

- Getting Started with Linux system to learn: how to check in a package is installed on Ubuntu (Linux)

- Exploring the Android Listview display confusion (Programming)

- Text analysis tools - awk (Linux)

- CoreOS Linux introduces Kubernetes kubelet (Server)

- Proficient in C / C ++ can also find a very good job (Programming)

- Linux PXE unattended installation PXE-E32: TFTP OPen timeout the solution (Linux)

- ARM platform compiler installation Golang (Linux)

- Linux remote connectivity tools -OpenSSH (Linux)

- How to find on Linux and delete duplicate files: FSlint (Linux)

- Use the command line MySQL database backup and recovery (Database)

- Linux System Getting Started Tutorial: mounted directly in Linux LVM partition (Linux)

- Oracle 11g new features and associated SQL TUNING (Database)

  MongoDB slice simple example
  Add Date : 2018-11-21      

There is another cluster Mongodb within, slicing technology, a large amount of data to meet the growing demand for MongoDB.

When MongoDB to store vast amounts of data, a machine may be insufficient to store the data is sufficient to provide an acceptable read and write throughput. At this point, we can split the data on multiple machines, so that the database system can store and process more data.

Why slice

Copy all write operations to the primary node
Delay sensitive data in the master query
A single copy set is limited to 12 nodes
When the huge volume of requests will appear when the memory.
Local disk shortage
Vertical expansion is expensive

MongoDB slice
Used to store the actual data block, the actual production environment, a shard server role can set a few machines relica set a commitment to prevent the host single point of failure

Config Server:
mongod instance, stores the entire ClusterMetadata, including the chunk information.

Query Routers:
The front end of the route, whereby the client access, and the whole cluster look like a single database front-end applications can transparently use.

Specific examples

Three shard using a configuration service

1. First start the database server port three are: 55555,55556,55557, host: localhost.

./mongod --port 55555 --dbpath = data / share1 --logpath = data / share1 / logs / s1.log --logappend --fork

./mongod --port 555556 - dbpath = data / share2 --logpath = data / share2 / logs / s2.log --logappend --fork

./mongod --port 55557 --dbpath = data / share3 --logpath = data / share3 / logs / s3.log --logappend --fork

2. Launch configuration server

./mongod --port 55558 --dbpath = data / config --logpath = data / config / logs / cnf.log --logappend --fork

3. Start routing services.

                   ./mongos --port 55554 --dbpath = data / share --logpath = data / share / logs / route.log --logappend --fork --configdb localhost: 55558 --chunkSize 500

Wherein chunkSize to slice the size, configuration, services are mainly stored routing information

4. Add shard

use admin

db.runCommand ({addshard: "localhost: 55555"})

db.runCommand ({addshard: "localhost: 55556"})

db.runCommand ({addshard: "localhost: 55557"})

db.runCommand ({enablesharding: "test"}) // database test partakers sheet capacity

db.runCommand ({shardcollection: "test.log", key: {id: 1, time: 1}}) // specified document in the corresponding database table through what fragmentation. Here is a test based on the log table id and time slicing.

5. See fragment status

db.runCommand ({listshards: 1})
- Linux foundation tutorial: how to modify the host name on CentOS or RHEL 7 (Linux)
- Linux formatted partition error Could not stat / dev / sda No such file or directory Solution (Linux)
- HBase in MVCC implementation mechanism and its application (Database)
- LVM mirrored logical volume to achieve (Linux)
- CentOS 6.5_x64 install Oracle 11g R2 (Database)
- Via Twitter how open source library to be used anywhere Emoji emoticons (Linux)
- Linux batch copy data script (Linux)
- Justniffer installed on Ubuntu 15.04 (Linux)
- Service Discovery: Zookeeper vs etcd vs Consul (Server)
- To create a full command line Android Build System (Linux)
- CentOS 6 adds disk quota limit (Linux)
- JavaScript notes --Objects (Programming)
- Several SQL Server data migration / Export Import Practice (Database)
- How to install the Ruby runtime environment on Mac OS X (Linux)
- Python MySQL database connection (Database)
- Redis Design and Implementation study notes (Database)
- Linux system Passwd file detailed analysis (Linux)
- Recycle Bin function realization in Linux (Linux)
- How ONLYOFFICE collaborative editing document on Linux (Linux)
- Install Unity 8 preview version of the desktop in Ubuntu (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.