starting with mongodb 2013/8/23
来源:互联网 发布:厦大吴春明 知乎 编辑:程序博客网 时间:2024/04/30 12:36
mongodb experiment
Create a three-replica sets(one primary, one secondary and on arbiter)
0.configure file
0)In file /srv/mongodb/ts0-0/mongodb.conf
port = 27020
dbpath = /srv/mongodb/rs0-0
logpath = /srv/mongodb/rs0-1/mongo.log
logappend = true
replSet = rs0
1)In file /srv/mongodb/ts0-1/mongodb.conf
fork = true
port = 27021
dbpath = /srv/mongodb/rs0-1
logpath = /srv/mongodb/rs0-1/mongo.log
logappend = true
replSet = rs0
1)In file /srv/mongodb/ts0-2/mongodb.conf
port = 27022
dbpath = /srv/mongodb/rs0-2
logpath = /srv/mongodb/rs0-2/mongo.log
logappend = true
replSet = rs0
1.Start each of them
mongod -f /srv/mongodb/ts0-0/mongodb.conf
mongod -f /srv/mongodb/ts0-1/mongodb.conf
mongod -f /srv/mongodb/ts0-2/mongodb.conf
2. Connect to database
mongo --port 27020
3. Configure replica sets
In node 27020, Enter some commands below:
>>rs.initiate(); // As primary
>>rs.add("hostname:port") //add replica set
>>re.addArbi("hostname:port") // add arbiter
4. Modify priority of replica sets
In primary set:
>>cfg = rs.conf();
>>cfg.member[i].priority = num; // Num can be a float number from 0 to 100.
>>cfg.reconfig(); // Never forget this!! Or your configuration won't be effective.
- starting with mongodb 2013/8/23
- SyntaxError: Non-UTF-8 code starting with
- Starting Out with Python
- Starting with Algorithms(Part2)
- Starting with GDI+
- Get starting with RMAN
- SyntaxError: Non-UTF-8 code starting with '\xc1' in file.
- “SyntaxError: Non-UTF-8 code starting with” 语法错误
- SyntaxError: Non-UTF-8 code starting with '\xb2in file.
- GDI+入门(Starting with GDI+)
- Starting with Algorithms(Part 1)
- Starting code reviews with Crucible
- Starting with FLEXIcontent (Basic usage)
- 解决Python代码编码问题 SyntaxError: Non-UTF-8 code starting with '\xc1'
- 解决Python代码编码问题 SyntaxError: Non-UTF-8 code starting with '\xc1'
- SyntaxError: Non-UTF-8 code starting with '\xba' in file 错误的解决方法!!
- Eclipse中出现SyntaxError: Non-UTF-8 code starting with '\xc4' in file错误
- Windows 7 starting with a temporary profile
- POJ2823_Slidingwindow_solution
- redis 持久化与备份策略
- jsp学习之旅的错误记录01
- 晨会如何更好的描述自己的工作
- jQuery 双击事件(dblclick)时,不触发单击事件(click)
- starting with mongodb 2013/8/23
- 北大 ACM 1007 DNA Sorting
- 【C/C++】内存分配函数:malloc,calloc,realloc,_alloca
- 什么是钩子方法
- [draft] Oracle 高可用方案 (check SAA training notes)
- Hadoop HelloWord Examples - A Simple Sort
- STM32芯片温度的测量
- mciSendCommand 函数的使用!
- Android JNI 使用的数据结构JNINativeMethod详解