免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4548 | 回复: 3
打印 上一主题 下一主题

[系统管理] mongodb启动时日志问题 [复制链接]

论坛徽章:
1
2015亚冠之西悉尼流浪者
日期:2015-05-28 16:30:37
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-04-02 23:39 |只看该作者 |倒序浏览
  1. Thu Apr  2 23:21:24.925 [initandlisten] MongoDB starting : pid=1230 port=27017 dbpath=/data/mongodb slave=1 64
  2. -bit host=benny
  3. Thu Apr  2 23:21:24.926 [initandlisten] db version v2.4.13
  4. Thu Apr  2 23:21:24.926 [initandlisten] git version: de9d77996aab9315400b9f203d0c4826211fc32e
  5. Thu Apr  2 23:21:24.926 [initandlisten] build info: Linux ip-10-181-40-136 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP F
  6. ri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
  7. Thu Apr  2 23:21:24.926 [initandlisten] allocator: tcmalloc
  8. Thu Apr  2 23:21:24.926 [initandlisten] options: { auth: "true", bind_ip: "0.0.0.0", config: "/usr/local/mongo
  9. db/conf/mongod.conf", dbpath: "/data/mongodb", fork: "true", journal: "true", logappend: "true", logpath: "/us
  10. r/local/mongodb/log/mongod.log", maxConns: 10000, nohttpinterface: "true", pidfilepath: "/var/run/mongod.pid",
  11. port: 27017, slave: "true", source: "192.168.56.120:27017" }
  12. Thu Apr  2 23:21:24.937 [initandlisten] journal dir=/data/mongodb/journal
  13. Thu Apr  2 23:21:24.938 [initandlisten] recover : no journal files present, no recovery needed
  14. Thu Apr  2 23:21:24.998 [initandlisten] waiting for connections on port 27017
  15. Thu Apr  2 23:21:26.002 [replslave] repl: syncing from host:192.168.56.120:27017
  16. Thu Apr  2 23:21:26.015 [replslave] replHandshake res not: 0 res: { ok: 0.0, errmsg: "unauthorized" }
  17. Thu Apr  2 23:21:27.985 [initandlisten] connection accepted from 127.0.0.1:23528 #1 (1 connection now open)
  18. Thu Apr  2 23:21:27.994 [conn1] command denied: { getLog: "startupWarnings" }
  19. Thu Apr  2 23:21:27.997 [conn1] command denied: { replSetGetStatus: 1.0, forShell: 1.0 }
  20. Thu Apr  2 23:21:40.270 [conn1]  authenticate db: admin { authenticate: 1, nonce: "bd76adb270c8782c", user: "r
  21. oot", key: "9ea4d2913df6a98942887a78e46ba4a6" }
  22. Thu Apr  2 23:23:12.625 [conn1] command admin.$cmd command: { listDatabases: 1.0 } ntoreturn:1 keyUpdates:0 lo
  23. cks(micros) R:11 W:114731 r:129 reslen:235 116ms
  24. Thu Apr  2 23:23:43.773 [replslave] repl:   checkpoint applied 30 operations
  25. Thu Apr  2 23:23:43.773 [replslave] repl:   syncedTo: Apr  2 23:23:33 551d5ef5:1
  26. Thu Apr  2 23:23:47.475 [replslave] CMD: drop thunderGears.test
  27. Thu Apr  2 23:24:11.362 [replslave] build index thunderGears.test { _id: 1 }
  28. Thu Apr  2 23:24:11.364 [replslave] build index done.  scanned 0 total records. 0.001 secs
复制代码
mongodb version: 2.4
Thu Apr  2 23:21:26.015 [replslave] replHandshake res not: 0 res: { ok: 0.0, errmsg: "unauthorized" }  这行是提示权限不足, 可是为何后面的主从复制又可以成功呢?
我这的情况是local库都已添加repl账户, 并确认local库用户密码都一样, 为何我在不同的情况下简单的主从复制, 有的可以成功有的不可以成功呢?

额, 还有个疑问, mongodb如何通过mongo shell指定只同步特定collection呢?  use admin; db.runCommand({"resync": 1}) 这是同步所有库哦
最后上我用的配置问件, 大神们发现问题请告诉我哦!
  1. port=27017
  2. dbpath=/data/mongodb
  3. logpath=/usr/local/mongodb/log/mongod.log
  4. logappend=true
  5. pidfilepath=/var/run/mongod.pid
  6. fork=true
  7. maxConns=10000
  8. auth=true
  9. journal=true
  10. bind_ip=0.0.0.0
  11. oplogSize=128
  12. nohttpinterface=true
  13. master=true
  14. slave=true
  15. source=192.168.56.120:27017
  16. #autoresync=true
复制代码

论坛徽章:
1
2015亚冠之西悉尼流浪者
日期:2015-05-28 16:30:37
2 [报告]
发表于 2015-04-02 23:44 |只看该作者
回复 1# tank064


额, 这是slave的配置文件, 主库和这个差不多, 可以在配置文件里only=xxx 或是mongod --only xxx指定同步特定库, mongo shell命令行有该如何操作呢, 可以像mysql那样手动中断复制么?

论坛徽章:
1
2015亚冠之西悉尼流浪者
日期:2015-05-28 16:30:37
3 [报告]
发表于 2015-04-03 00:47 |只看该作者
  1. Fri Apr  3 00:40:16.392 [replslave] repl: syncing from host:192.168.56.120:27017
  2. Fri Apr  3 00:40:16.404 [replslave] replHandshake res not: 0 res: { ok: 0.0, errmsg: "unauthorized" }
  3. Fri Apr  3 00:40:16.406 [replslave] repl:   nextOpTime Apr  3 00:08:13 551d696d:1 > syncedTo Apr  3 00:08:05 5
  4. 51d6965:1
  5. repl:   time diff: 8sec
  6. repl:   tailing: 0
  7. repl:   data too stale, halting replication
  8. Fri Apr  3 00:40:16.406 [replslave] caught SyncException
  9. Fri Apr  3 00:40:16.406 [replslave] repl: sleep 10 sec before next pass
  10. Fri Apr  3 00:40:21.937 [initandlisten] connection accepted from 127.0.0.1:23537 #1 (1 connection now open)
  11. Fri Apr  3 00:40:21.947 [conn1] command denied: { getLog: "startupWarnings" }
  12. Fri Apr  3 00:40:21.951 [conn1] command denied: { replSetGetStatus: 1.0, forShell: 1.0 }
  13. Fri Apr  3 00:40:26.408 [replslave] auto forcing resync from 192.168.56.120:27017
  14. Fri Apr  3 00:40:26.415 [replslave] replHandshake res not: 0 res: { ok: 0.0, errmsg: "unauthorized" }
  15. Fri Apr  3 00:40:26.417 [replslave] resync: dropping database admin
  16. Fri Apr  3 00:40:26.421 [replslave] removeJournalFiles
  17. Fri Apr  3 00:40:26.455 [replslave] repl: syncing from host:192.168.56.120:27017
复制代码
回复 1# tank064

我在从库开启"autoresync=true" , 为啥会导致从库的admin库不存在了呢?  这玩意比mysql坑人啊


   

论坛徽章:
1
2015亚冠之西悉尼流浪者
日期:2015-05-28 16:30:37
4 [报告]
发表于 2015-04-03 10:48 |只看该作者
额, 启动slave时, 用source指定master IP:PORT  用only指定只定同步哪一个库, autoresync 开启自动同步就ok了,,


用在命令行 手动同步经验的大神请留言哦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP