我正在尝试在 Amazon EC2 上部署分片 MongoDB 集群,使用以下说明http://manage.jujucharms.com/charms/precise/mongodb。
但是(我已经尝试了三次),我的 mongos 单元总是失败,并出现代理状态信息:
hook failed: "mongos-relation-changed"
这是 juju status 的输出:
environment: amazon
machines:
"0":
agent-state: started
agent-version: 1.16.6
dns-name: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
instance-id: i-e36159c2
instance-state: running
series: precise
hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M
"1":
agent-state: started
agent-version: 1.16.6
dns-name: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
instance-id: i-b7645c96
instance-state: running
series: precise
hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M
"2":
agent-state: started
agent-version: 1.16.6
dns-name: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
instance-id: i-d5645cf4
instance-state: running
series: precise
hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M
"3":
agent-state: started
agent-version: 1.16.6
dns-name: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
instance-id: i-98665eb9
instance-state: running
series: precise
hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M
"4":
agent-state: started
agent-version: 1.16.6
dns-name: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
instance-id: i-fa645cdb
instance-state: running
series: precise
hardware: arch=amd64 cpu-cores=1 cpu-power=100 mem=1740M root-disk=8192M
services:
configsvr:
charm: cs:precise/mongodb-26
exposed: false
relations:
configsvr:
- mongos
replica-set:
- configsvr
units:
configsvr/0:
agent-state: started
agent-version: 1.16.6
machine: "1"
open-ports:
- 27017/tcp
- 27019/tcp
- 27021/tcp
- 28017/tcp
- 28019/tcp
public-address: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
mongos:
charm: cs:precise/mongodb-26
exposed: true
relations:
mongos:
- shard1
- shard2
mongos-cfg:
- configsvr
replica-set:
- mongos
units:
mongos/0:
agent-state: error
agent-state-info: 'hook failed: "mongos-relation-changed"'
agent-version: 1.16.6
machine: "2"
open-ports:
- 27017/tcp
- 27019/tcp
- 28017/tcp
public-address: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
shard1:
charm: cs:precise/mongodb-26
exposed: true
relations:
database:
- mongos
replica-set:
- shard1
units:
shard1/0:
agent-state: started
agent-version: 1.16.6
machine: "3"
open-ports:
- 27017/tcp
- 27019/tcp
- 27021/tcp
- 28017/tcp
public-address: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
shard2:
charm: cs:precise/mongodb-26
exposed: true
relations:
database:
- mongos
replica-set:
- shard2
units:
shard2/0:
agent-state: started
agent-version: 1.16.6
machine: "4"
open-ports:
- 27017/tcp
- 27019/tcp
- 27021/tcp
- 28017/tcp
public-address: ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
tail /var/log/juju/unit-mongos-0.log
以下是mongos/0的输出:
2014-03-05 19:59:44 INFO worker.uniter.jujuc server.go:108 running hook tool "juju-log" ["mongos_relation_change: undefined rel_type: None"]
2014-03-05 19:59:44 DEBUG worker.uniter.jujuc server.go:109 hook context id "mongos/0:mongos-cfg-relation-changed:7095643384867257998"; dir "/var/lib/juju/agents/unit-mongos-0/charm"
2014-03-05 19:59:44 INFO juju juju-log.go:66 mongos/0 mongos-cfg:5: mongos_relation_change: undefined rel_type: None
2014-03-05 19:59:45 ERROR juju.worker.uniter uniter.go:350 hook failed: exit status 1
2014-03-05 19:59:45 DEBUG juju.worker.uniter modes.go:423 ModeAbide exiting
2014-03-05 19:59:45 INFO juju.worker.uniter modes.go:421 ModeHookError starting
2014-03-05 19:59:45 DEBUG juju.worker.uniter.filter filter.go:418 want resolved event
2014-03-05 19:59:45 DEBUG juju.worker.uniter.filter filter.go:412 want forced upgrade true
2014-03-05 19:59:45 DEBUG juju.worker.uniter.filter filter.go:523 no new charm event
2014-03-05 20:06:32 DEBUG juju.worker.uniter.filter filter.go:338 got relations change
发生了什么事?我该如何解决这个问题?
解决办法是可以的:)
答案1
调试此类故障的第一步是查看设备的日志。具体操作如下:
juju ssh mongos/0
cd /var/log/juju
如果错误/解决方案不明显,请随时使用设备的日志更新您的问题。