Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ MongoDB replication instance     - Oracle procedure or function Empty Table (Database)

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

- Ubuntu 14.10 / 14.04 / 12.04 How to install Kodi 14.0 RC3 (Linux)

- numpy and SciPy installation under Python for scientific computing package (Linux)

- Permissions and attributes of files and directories under Linux (Linux)

- Inherent limitations of Linux systems network security (Linux)

- Linux system security (Linux)

- Configuring VMWare FreeBSD9.2 remote debugging kernel source code (Linux)

- Using Java arrays implement sequential stack (Programming)

- Linux user login and IP restrictions (Linux)

- Android basics summary article (Programming)

- Gentoo: startx appeared Failed to load module Problem Solving (Linux)

- Java memory model subclasses (Programming)

- Binary tree traversal recursive and non-recursive (cyclic) traversal achieve (Programming)

- Linux tmux tcpdump summary (Linux)

- CentOS 6.4 Python 2.6 upgrade to 2.7 (Linux)

- VMware11 virtual machine Ubuntu14.10 system partition sda1 disk expansion (Linux)

- Python format string (Programming)

- Depth understanding of C language (Programming)

- PULL operation mechanism parsing XML Comments (Programming)

 
         
  MongoDB replication instance
     
  Add Date : 2018-11-21      
         
         
         
  MongoDB is a master-slave replication master can be more than they can be mainly from the master-slave replication. Here is a realization of a master server using a database from one server arbitration by providing a different port.

one. Start a MongoDB service name application, port 1234

./mongod --replSet application --dbpath data / node1 --port 1234 --oplogSize 1024


Described the successful launch.
two. Open Client
./mongo --port 1234

three. Start node2, node3
./mongod --replSet application --dbpath data / node2 - port 1235 --oplogSize 1024

./mongod --replSet application --dbpath data / node3 - port 1236 --oplogSize 1024


four. Start the client port 1234
./mongo --port 1234
Fives. Configuration copies
config = {_ id: "application", members: []}
config.members.push ({_ id: 0, host: "localhost: 1234"})
config.members.push ({_ id: 1, host: "localhost: 1235"})
config.members.push ({_ id: 2, host: "localhost: 1236", arbiterOnly: true})

Back 1 Description added successfully
six. rs.isMaster ()

Seven. Master-slave replication test whether
1. In the main server to add a record
1.1 use test
db.user.insert ({_ id: 1, name: "maybo"})


1.2 Open from the service client
./mongo --port 1235

1.3 Queries
use test
db.user.find ( "{})

SlaveOk = false discovery need to be clear from the current node node
1.4 rs.slaveOk ()
show collections

Master-slave replication has been successful, but the main one minute from the time required to copy.
     
         
         
         
  More:      
 
- Use Git in Eclipse (Linux)
- Kafka + Log4j log implement centralized management (Server)
- How to fix the Ubuntu Error script returned error exit status 1 (Linux)
- Ubuntu 14.10 used ifconfig commands to manage your network configuration (Linux)
- Keepalived + HAProxy high availability load balancing (Server)
- Spring loaded container finishes executing a method (Programming)
- Oracle PL / SQL selective basis (IF CASE), (LOOP WHILE FOR) (Database)
- Linux operating system log system (Linux)
- Security Knowledge: How to hide a backdoor PHP file tips (Linux)
- Java, on the dfile.encoding Systemproperty (Programming)
- CentOS 7 install Hadoop-cdh-2.5 on Mesos (Server)
- Install NetBeans IDE 8.0 on Ubuntu, Linux Mint, Elementary OS, and Debian (Linux)
- Extended VMware Ubuntu root partition size (Linux)
- Command line tool Tmux (Linux)
- Cancel Root Command History under Linux (Linux)
- Linux md5sum verify file integrity (Linux)
- Swift 2.0 brief (Linux)
- Easily solve the MySQL database connection error too many (Database)
- xCAT Installation Kit (Linux)
- Oracle data files deleted recover after physical (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.