mongod --port 3000 --shardsvr --replSet rs-a --dbpath “D:\software\MongoDB\data\data\rs-a-0” --logpath “D:\software\MongoDB\data\log\rs-a-0.log”
mongod --port 3001 --shardsvr --replSet rs-a --dbpath “D:\software\MongoDB\data\data\rs-a-1” --logpath “D:\software\MongoDB\data\log\rs-a-1.log”
mongod --port 3002 --shardsvr --replSet rs-a --dbpath “D:\software\MongoDB\data\data\rs-a-2” --logpath “D:\software\MongoDB\data\log\rs-a-2.log”
副本集配置
rs.status()
rs.initiate()
rs.isMaster()
rs.add(“localhost:3001”)
rs.add(“localhost:3002”)
rs.remove(“localhost:3001”)
rs.remove(“localhost:3002”)
rs.add(“172.16.1.9:3001”)
rs.add(“172.16.1.9:3002”)
rs.status()
配置服务器 配置Config——server
mongod --port 27019 --configsvr --replSet rs-conf --dbpath “D:\software\MongoDB\data\data\config0” --logpath “D:\software\MongoDB\data\log\config0.log”
mongod --port 27020 --configsvr --replSet rs-conf --dbpath “D:\software\MongoDB\data\data\config1” --logpath “D:\software\MongoDB\data\log\config1.log”
新开一个窗口 连接27019
rs.initiate()
回车 到RPIMARY
rs.add(“localhost:27020”)
配置路由服务器 注意加上端口号
mongos --port 27088 --configdb rs-conf/localhost:27019,localhost:27020 --logpath “D:\software\MongoDB\data\log\mongos.log”
添加创建的分片
连接时加上mongos的端口号 连接成功会显示 mongos>
将我们前面创建的分片添加进去,使用命令 mongo --port 27088
登录mongos,使用sh.addShard添加分片
sh.status() 查看分片的状态
sh.addShard(“rs-a/172.16.1.9:3000, 172.16.1.9:3001, 172.16.1.9:3002”)
目录 数据类型 运算符 写在最后的话 数据类型 基本数据类型 表示符号 所占大小by...
Linux 内核 下载 编译 安装 ubuntu 2021 摘要 为什么要进行 调试 安装自定义的内...
动机: 查询功能是我们在网站上见过的最普遍也是最常用的一个功能模块了。以往的...
复制代码 代码如下: html, address, blockquote, body, dd, div, dl, dt, fields...
百度图像识别 运行效果图 一、创建平台应用 二、创建Android项目 三、网络访问框...
?你是否会时常感觉自己怎么也记不住东西是不是总是会感觉别人记忆力很强其实记忆...
思维导图 点击下图,可以看具体内容! 介绍 正则表达式,大家在开发中应该是经常...
文章目录 ·NTFS安全权限 一、NTFS权限概述 二、文件系统概述 三、NTFS文件系统...
1 月 29 日消息 泄露的 Windows 10X 编译版本显示,该操作系统将为单屏 PC 重新...
先看看效果图 开发环境准备 小程序 出来第二天就被破解,第三天微信就把开发工具...