Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Database \ MongoDB slice simple example     - Linux Shell Scripting Interview Question (Linux)

- Linux common network tools: batch scanning of nmap hosting service (Linux)

- BGP routers want to play it by CentOS (Linux)

- Linux environment Duplex (multi-machine) automatic mutual backup scheme (Linux)

- Use backup-manager system backup on Linux (Linux)

- Ubuntu 14.04 installed NVIDIA graphics driver (Linux)

- linux raid levels and concepts introduced (Linux)

- Virtualization and IT cooperation (Linux)

- 20 Unix / Linux command skills (Linux)

- Android child thread really do not update UI (Programming)

- FileZilla FTP && TLS connection settings of (Linux)

- Easily create RPM packages using the FPM (Linux)

- Binary tree to the next node (Programming)

- Linux disk quota-related instruction (Linux)

- Java implementation linear table - represents the order of representation and chain (Programming)

- How to install Linux Kernel 4.0 On CentOS 7 system (Linux)

- Linux more efficient than select a model epoll (Linux)

- Node.js developers must know four JavaScript concepts (Programming)

- Linux firewall to prevent external network attacks (Linux)

- Linux System Getting Started Learning: Debian download, installation and graphical interface (Linux)

  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 system boot process detail (Linux)
- Linux cd command Detailed (Linux)
- Use read command to read user input (Programming)
- Linux Network Security: nmap port scanning software (Linux)
- Spring declarative transaction management (Programming)
- Using Python multithreaded mistakes summary (Programming)
- Linux daemon (Linux)
- CentOS 7.0 Enable iptables firewall (Linux)
- OpenStack package problems and solutions under CentOS6 (Linux)
- Linux how to prohibit the use of Ping command (Linux)
- Linux performance optimization features Tuned and ktune (Linux)
- Compile and install Redis and register as a system service under RedHat5.8 environment (Database)
- Linux kernel RCU (Read Copy Update) lock Brief (Linux)
- File compression and packaging commands under Linux (Linux)
- RedHat Linux 7 build yum source server (Server)
- JavaScript closures and the scope chain (Programming)
- Use the vi text editor and copy and paste Linux tips (Linux)
- Vmstat command Linux Performance Monitoring (Linux)
- UUID in Java (Programming)
- Quick paging ROW_NUMBER conducted (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.