• 博客访问: 2078232
  • 博文数量: 160
  • 用 户 组: 普通用户
  • 注册时间: 2013-11-14 10:49
  • 认证徽章:
个人简介

每个人都有梦想,去实现吧!

文章分类

全部博文(160)

文章存档

2017年(11)

2016年(18)

2015年(36)

2014年(80)

2013年(15)

分类: NoSQL

2017-02-24 16:25:29

如果是集群分片环境建议使用官方方法:
这里环境是传统的master/slave,并没有使用replicate set,而且后期版本mongodb将废弃m/s,如果是单实例或者传统m/s的结构,修改oplogsize只需删除local库即可,操作记录如下:
先关闭master和auth功能
[root@fogtestdb data]# vi /etc/mongodb.cnf

dbpath = /mongodb/data
logpath = /var/log/mongodb/mongodb.log
pidfilepath = /var/run/mongodb/mongodb.pid
logappend = true
port = 27017
fork = true
#master = true
maxConns=2048
noprealloc = true
httpinterface = true
oplogSize=1024
#auth=true
#keyFile = /etc/mongo.key

重启mogodb
[root@fogtestdb data]# mongod -f /etc/mongodb.cnf --shutdown
note: noprealloc may hurt performance in many applications
killing process with pid: 4749
[root@fogtestdb data]# mongod -f /etc/mongodb.cnf &

删除local库
[root@mongodb ~] # mongo
> use local
> db.dropDatabase()

修改oplogsize大小并启动mongodb
[root@fogtestdb data]# vi /etc/mongodb.cnf

dbpath = /mongodb/data
logpath = /var/log/mongodb/mongodb.log
pidfilepath = /var/run/mongodb/mongodb.pid
logappend = true
port = 27017
fork = true
master = true
maxConns=2048
noprealloc = true
httpinterface = true
oplogSize=20480
auth=true
keyFile = /etc/mongo.key

重启mongodb
[root@fogtestdb data]# mongod -f /etc/mongodb.cnf --shutdown
[root@fogtestdb data]# mongod -f /etc/mongodb.cnf &
[1] 4802
[root@fogtestdb data]# note: noprealloc may hurt performance in many applications
about to fork child process, waiting until server is ready for connections.
forked process: 4804
child process started successfully, parent exiting
[1]+ Done mongod -f /etc/mongodb.cnf

登入查看oplogsize
[root@fogtestdb data]# mongo 127.0.0.1:27017/admin -uroot -ptest
MongoDB shell version: 3.2.0
connecting to: 127.0.0.1:27017/admin
Server has startup warnings:
2017-02-22T14:52:04.246+0800 I CONTROL [initandlisten]
2017-02-22T14:52:04.246+0800 I CONTROL [initandlisten] ** WARNING: The server is started with the web server interface and access control.
2017-02-22T14:52:04.246+0800 I CONTROL [initandlisten] ** The web interfaces (rest, httpinterface and/or jsonp) are insecure
2017-02-22T14:52:04.246+0800 I CONTROL [initandlisten] ** and should be disabled unless required for backward compatibility.
2017-02-22T14:52:04.246+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2017-02-22T14:52:04.246+0800 I CONTROL [initandlisten]
>
查看oplog大小
> db.printReplicationInfo()
configured oplog size: 20480MB
log length start to end: 624021secs (173.34hrs)
oplog first event time: Fri Feb 10 2017 10:24:16 GMT+0800 (CST)
oplog last event time: Fri Feb 17 2017 15:44:37 GMT+0800 (CST)
now: Fri Feb 17 2017 15:44:47 GMT+0800 (CST)
阅读(999) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册

/bosoo/001K.html /8848/823d.html /daxue/032d.html /ks/057e.html /daxue/720M.html /ymw/181Z.html /daxue/201T.html /bg88/666s.html /ggs/442F.html /bosoo/840h.html /bosoo/484S.html /0088/323h.html /gpw/768K.html /pmw/510T.html /ggs/763l.html /wb/751n.html /888/750D.html /88410/745F.html /123/077R.html /888/612B.html /wb/365Y.html /0088/310a.html /bbs/346k.html /gupiao/440j.html /bosoo/027T.html /xyw/432j.html /1088/174W.html /3088/774c.html /3088/408E.html /1088/280s.html /gpw/338c.html /ggs/217o.html /gupiao/627v.html /xyw/263U.html /888/101Q.html /123/374f.html /pmw/874z.html /bbs/080K.html /pmw/705o.html /ymw/646d.html /8848/216J.html /ks/836E.html