mongodb副本集仲裁节点搭建
服务器准备:
主节点192.168.100.106
从节点192.168.100.107
仲裁节点192.168.100.108
三台服务器:
关闭防火墙
service iptables stop
chkconfig iptables off
创建文件夹
mkdir -p /export/mongo/data/db
mkdir -p /export/mongo/log
mkdir -p /export/mongo/key
mkdir -p /export/mongo/run
mkdir -p /export/mongo/conf
上传mongodb-linux-x86_64-3.4.6.tgz并解压在/export/mongo目录下
tar -zxvf mongodb-linux-x86_64-3.4.6.tgz
mv mongodb-linux-x86_64-3.4.6 mongodb
cd /export/mongo/log
创建mongod.log文件
主节点:
vim /export/mongo/conf/mongo.conf
port =28007
fork =true
dbpath =/export/mongo/data/db
logpath =/export/mongo/log/mongod.log
pidfilepath=/export/mongo/run/28007.pid
logappend =true
shardsvr =true
replSet =shard1
bind_ip=主节点IP
oplogSize=10000
noprealloc=true
从节点:
vim /export/mongo/conf/mongo.conf
port =28008
fork =true
dbpath =/export/mongo/data/db
logpath =/export/mongo/log/mongod.log
pidfilepath=/export/mongo/run/28008.pid
logappend =true
shardsvr =true
replSet =shard1
bind_ip=从节点IP
oplogSize=10000
noprealloc=true
仲裁节点:
vim /export/mongo/conf/mongo.conf
port =28009
fork =true
dbpath =/export/mongo/data/db
logpath =/export/mongo/log/mongod.log
pidfilepath=/export/mongo/run/28009.pid
logappend =true
shardsvr =true
replSet =shard1
bind_ip=仲裁节点IP
oplogSize=10000
noprealloc=true
三台服务启动mongodb:
cd /export/mongo/mongodb/bin
./mongod -f /export/mongo/conf/mongo.conf
主节点:
cd /export/mongo/mongodb/bin
./mongo 主节点IP:28007
use admin
config={_id:'shard1',members:[{_id:0,host:'118.1.2.81:28007'},{_id:1,host:'118.1.2.82:28008'},{_id:2,host:'118.1.2.74:28009', arbiterOnly:true}]}
rs.initiate(config)
--查看副本集情况
rs.status()
测试写入数据:
use db_test
db.tb_test01.insert( {"name":"yiibai tutorials"})
db.tb_test01.find()
最新文章
- GDB调试汇编分析
- gridView RowDataBound事件 鼠标经过行颜色变化及根据字段值显示指定内容
- W5500 keep-alive的用途与用法--新华龙电子
- 【CMD】日常总结
- linux下安装python环境
- phpStorm支持CodeIgniter代码提示/自动完成
- CentOS7安装Docker,运行Nginx镜像、Centos镜像
- Ibatis 异常:Unable to open connection to ";oledb , provider V2.0.0.0 in framework .NET V2.0";.
- githup在线预览demo
- java 表格项的删除、编辑、增加 修改版
- Linux 编译安装 apache 2.4
- Exception in thread ";main"; java.io.IOException: Failed to set permissions of path
- c++11 新特性之 autokeyword
- strutsprepareAndExecuteFiter
- Tsinsen-1487:分配游戏【树状数组】
- java内存管理(堆、栈、方法区)
- ssh免密验证,shell批量设置
- ubuntu升级显卡驱动
- 如何实现Activiti的分支条件的自定义配置(转)
- SpringData使用与整合