mongodb主从切换
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.3k
- Forks
- 614
- PR merge metrics
- No merged PRs in 30d
Description
DESC
我们使用的是阿里云mongodb,需要配置两个主从ip(例如下面192.168.10.2,192.168.10.3)
问题:第一个节点(192.168.10.2)挂掉之后不会自动切换到第二个节点(192.168.10.3)
db: {
type: 'mongo',
log_sql: true,
log_connect: true,
adapter: {
mongo: {
host: ['192.168.10.2','192.168.10.3'],
port: ['3717'],
database: 'dev',
prefix: '',
user: 'root',
password: '123456',
options: {
authSource: "admin"
},
server: {
poolSize: 1
}
}
}
}
ENV
Platform:
centos6
Node.js Version:
v6.3.1
ThinkJS Version:
v2.2.15
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the Mongo adapter configuration shown in the issue and reproduce the failure using the stated CentOS 6 and Node.js v6.3.1 environment. Trace how the two hosts and port are handled; done means that losing 192.168.10.2 automatically moves connections to 192.168.10.3. No source file or test is named, so locating the adapter entry point is part of the work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, node.js
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100