简单的 6 步配置 MongoDB 复制集
在本次教程中,我们将创建含有三个节点的MongoDB群集。第一个节点是主节点,第二个节点是Failover节点,第三个节点是仲裁节点。
在本次教程中,我们将创建含有三个节点的MongoDB群集。第一个节点是主节点,,第二个节点是Failover节点,第三个节点是仲裁节点。
1. 安装Mongo并设置配置文件
安装3台服务器并调整配置文件/etc/mongod.conf:
#Select your replication set name
replSet=[replication_set_name]
#Select the replication log size
oplogSize=1024
Disable the bind_ip parameter to avoid binding to only 127.0.0.1 interface
#bind_ip
2. 重启三台mongod守护进程
> sudo service mongod restart
3. 在主节点上创建初始化配置
登录到主节点并创建一个初始化的配置。请注意使用私有IP不要使用回送地址(127.0.0.1):
> mongo
Primary> cfg = {"_id" : "[replication_set_name]", "members" : [{"_id" : 0,"host" : "[Primary_Host_IP]:27017"}]}
Primary> rs.initiate(cfg);
4. 在复制集中添加Failover实例
Primary> rs.add("[Failover_Host_IP]:27017")
5. 在复制集中添加仲裁实例
Primary>rs.addArb(":27017")
6. 确认复制集的状态
Primary>rs.status()
底线
我希望每个数据群集的安装都是容易的就像MongoDB复制集的安装一样。
Linux下设置MongoDB开机自启动
CentOS编译安装MongoDB
CentOS 编译安装 MongoDB与mongoDB的php扩展
CentOS 6 使用 yum 安装MongoDB及服务器端配置
Ubuntu 13.04下安装MongoDB2.4.3
MongoDB入门必读(概念与实战并重)
《MongoDB 权威指南》(MongoDB: The Definitive Guide)英文文字版[PDF]
MongoDB 的详细介绍:请点这里
MongoDB 的下载地址:请点这里
本文永久更新链接地址:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]
