Skip to Content
MongoDB权威指南(第3版)
book

MongoDB权威指南(第3版)

by Shannon Bradshaw, Eoin Brazil, Kristina Chodorow
November 2021
Intermediate to advanced
410 pages
12h 1m
Chinese
Posts & Telecom Press
Content preview from MongoDB权威指南(第3版)
创建副本集
199
我们需要注意以下几个关键概念。
客户端在单台服务器上执行的请求都可以发送到主节点执行(读操作、写操作、执行命
令、创建索引等)。
客户端不能在从节点上执行写操作。
默认情况下,客户端不能在从节点上读取数据。可以显式地指定“我知道我正在从从节
点中读取数据”来启用此功能。
10.7
 更改副本集配置
可以随时更改副本集的配置:添加、删除或者修改成员。很多常用的操作有对应的
shell
助函数。例如,可以使用
rs.add
为副本集添加新成员:
> rs.add("localhost:27020")
类似地,可以从副本集中删除成员:
> rs.remove("localhost:27017")
{ "ok" : 1, "operationTime" : Timestamp(1501202441, 2) }
可以在
shell
中运行
rs.config()
来检查重新配置是否成功。这个命令打印出了当前配置
信息:
> rs.config()
{
"_id" : "mdbDefGuide",
"version" : 3,
"protocolVersion" : NumberLong(1),
"members" : [
{
"_id" : 1,
"host" : "localhost:27018",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

大数据项目管理:从规划到实现

大数据项目管理:从规划到实现

Ted Malaska, Jonathan Seidman
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Spark快速大数据分析(第2版)

Spark快速大数据分析(第2版)

Jules S. Damji, Brooke Wenig, Tathagata Das, Denny Lee
Kafka权威指南(第2版)

Kafka权威指南(第2版)

Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty

Publisher Resources

ISBN: 9787115576538