mongodb replica set 添加 删除 节点 2种方法
replica set多服务器主从,添加,删除节点,肯定会经常遇到的。下面详细说明一下,添加,删除节点的2种方法。 一,利用rs.reconfig,来添加,删除节点 1,添加节点 repmore:PRIMARY config = {_id:"repmore",members:[{_id:0,host:'127.0.0.1:27017',priorit
replica set多服务器主从,添加,删除节点,肯定会经常遇到的。下面详细说明一下,添加,删除节点的2种方法。
一,利用rs.reconfig,来添加,删除节点
1,添加节点
repmore:PRIMARY> config = {_id:"repmore",members:[{_id:0,host:'127.0.0.1:27017',priority :2},{_id:1,host:'127.0.0.1:27018',priority:1}]}; //添加节点 repmore:PRIMARY> rs.reconfig(config); //使配置生效 repmore:PRIMARY> rs.status(); //查看节点状态
节点添加成功。
注意:新增节点的replSet要和其他节点要一样
2,删除节点
repmore:PRIMARY> config = {_id:"repmore",members:[{_id:0,host:'127.0.0.1:27017',priority :2}]}; //删除节点 repmore:PRIMARY> rs.reconfig(config); //使配置生效 repmore:PRIMARY> rs.status(); //查看节点状态
二,利用rs.add和rs.remove来添加删除节点
repmore:PRIMARY> rs.add("127.0.0.1:27018"); //添加节点 repmore:PRIMARY> rs.remove("127.0.0.1:27018"); //删除节
注意:利用rs.add和rs.remove是不用rs.reconfig来使用配置生效的。



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

1. First of all, it is false to block and delete someone permanently and not add them permanently. If you want to add the other party after you have blocked them and deleted them, you only need the other party's consent. 2. If a user blocks someone, the other party will not be able to send messages to the user, view the user's circle of friends, or make calls with the user. 3. Blocking does not mean deleting the other party from the user's WeChat contact list. 4. If the user deletes the other party from the user's WeChat contact list after blocking them, there is no way to recover after deletion. 5. If the user wants to add the other party as a friend again, the other party needs to agree and add the user again.

It is recommended to use the latest version of MongoDB (currently 5.0) as it provides the latest features and improvements. When selecting a version, you need to consider functional requirements, compatibility, stability, and community support. For example, the latest version has features such as transactions and aggregation pipeline optimization. Make sure the version is compatible with the application. For production environments, choose the long-term support version. The latest version has more active community support.

1. Open the Douyin app, click [Message] at the bottom of the interface, and click the chat conversation entry that needs to be deleted. 2. Long press any chat record, click [Multiple Select], and check the chat records you want to delete. 3. Click the [Delete] button in the lower right corner and select [Confirm deletion] in the pop-up window to permanently delete these records.

Node.js is a server-side JavaScript runtime, while Vue.js is a client-side JavaScript framework for creating interactive user interfaces. Node.js is used for server-side development, such as back-end service API development and data processing, while Vue.js is used for client-side development, such as single-page applications and responsive user interfaces.

MongoDB is a document-oriented, distributed database system used to store and manage large amounts of structured and unstructured data. Its core concepts include document storage and distribution, and its main features include dynamic schema, indexing, aggregation, map-reduce and replication. It is widely used in content management systems, e-commerce platforms, social media websites, IoT applications, and mobile application development.

On Linux/macOS: Create the data directory and start the "mongod" service. On Windows: Create the data directory and start the MongoDB service from Service Manager. In Docker: Run the "docker run" command. On other platforms: Please consult the MongoDB documentation. Verification method: Run the "mongo" command to connect and view the server version.

As a leader in cryptocurrency trading, Gate.io offers a wide range of trading pairs, derivatives and financial services. The Chinese version of the website Sesame Open Door Gate is convenient for Chinese users and provides the same functions as Gate.io, but it is more suitable for Chinese people's habits. Users can access the Gate.io exchange or Sesame Open Gate official website through the designated website. Please be sure to keep your account information carefully and only visit the official website to ensure safety.

Solutions to resolve Navicat expiration issues include: renew the license; uninstall and reinstall; disable automatic updates; use Navicat Premium Essentials free version; contact Navicat customer support.
