当我在 maas 控制器上使用 juju 部署 wordpress 和 mysql charms 时,如下所示:
juju deploy --to lxc:0 wordpress
juju deploy --to lxc:0 mysql
juju add-relation wordpress:db mysql:db --debug
输出内容如下
DEBUG juju.api api.go 492 API hostnames unchanged - not resolving
再耐心一点,wordpress 就会失败,juju status 命令会显示以下内容:
wordpress/0
workload-status:
current: error
message: 'hook failed: "db-relation-changed" for mysql:db'
juju status --form tabular 为单位部分返回了以下内容:
[Units]
ID WORKLOAD-STATE AGENT-STATE VERSION MACHINE PORTS PUBLIC-ADDRESS MESSAGE
juju-gui/0 unknown idle 1.24.0 0 8080/tcp HP22.rigonet.nl
mysql/0 unknown idle 1.24.0 0/lxc/2 192.168.50.86
wordpress/0 error idle 1.24.0 0/lxc/7 80/tcp 192.168.50.83 hook failed: "db-relation-changed" for mysql:db
我通过 juju ssh wordpress/0 搜索文件 /var/log/juju/unit-wordpress-0.log 并发现:
2015-07-15 15:42:16 INFO worker.uniter.jujuc server.go:138 running hook tool "relation-get" ["password"]
2015-07-15 15:42:16 DEBUG worker.uniter.jujuc server.go:139 hook context id "wordpress/0-db-relation-changed-1875247148271195053"; dir "/var/lib/juju/agents/unit-wordpress-0/charm"
2015-07-15 15:42:16 INFO worker.uniter.jujuc server.go:138 running hook tool "relation-get" ["private-address"]
2015-07-15 15:42:16 DEBUG worker.uniter.jujuc server.go:139 hook context id "wordpress/0-db-relation-changed-1875247148271195053"; dir "/var/lib/juju/agents/unit-wordpress-0/charm"
2015-07-15 15:42:17 DEBUG juju.worker.leadership tracker.go:138 wordpress/0 renewing lease for wordpress leadership
2015-07-15 15:42:17 DEBUG juju.worker.leadership tracker.go:165 checking wordpress/0 for wordpress leadership
2015-07-15 15:42:17 DEBUG juju.worker.leadership tracker.go:180 wordpress/0 confirmed for wordpress leadership until 2015-07-15 15:43:17.202318193 +0000 UTC
2015-07-15 15:42:17 INFO juju.worker.leadership tracker.go:182 wordpress/0 will renew wordpress leadership at 2015-07-15 15:42:47.202318193 +0000 UTC
2015-07-15 15:42:26 INFO juju.worker.uniter.context context.go:534 handling reboot
**2015-07-15 15:42:26 ERROR juju.worker.uniter.operation runhook.go:107 hook "db-relation-changed" failed: exit status 2**
2015-07-15 15:42:26 INFO juju.worker.uniter modes.go:546 ModeAbide exiting
2015-07-15 15:42:26 INFO juju.worker.uniter modes.go:544 ModeHookError starting
2015-07-15 15:42:26 DEBUG juju.worker.uniter.filter filter.go:597 want resolved event
2015-07-15 15:42:26 DEBUG juju.worker.uniter.filter filter.go:591 want forced upgrade true
2015-07-15 15:42:26 DEBUG juju.worker.uniter.filter filter.go:727 no new charm event
2015-07-15 15:42:26 DEBUG juju.worker.uniter modes.go:31 [AGENT-STATUS] error: hook failed: "db-relation-changed"
2015-07-15 15:42:26 DEBUG juju.worker.leadership tracker.go:154 wordpress/0 got wait request for wordpress leadership loss
2015-07-15 15:42:26 DEBUG juju.worker.leadership tracker.go:248 wordpress/0 still has wordpress leadership
我找到的machine-0-lxc-7.log文件
2015-07-15 15:40:15 INFO juju.worker runner.go:261 start "rsyslog"
2015-07-15 15:40:15 DEBUG juju.worker.rsyslog worker.go:105 starting rsyslog worker mode 1 for "machine-0-lxc-7" ""
2015-07-15 15:40:15 DEBUG juju.worker.logger logger.go:60 logger setup
2015-07-15 15:40:15 INFO juju.worker runner.go:261 start "stateconverter"
2015-07-15 15:40:15 INFO juju.worker runner.go:261 start "diskmanager"
2015-07-15 15:40:15 INFO juju.worker runner.go:261 start "storageprovisioner-machine"
2015-07-15 15:40:15 DEBUG juju.network network.go:220 no lxc bridge addresses to filter for machine
2015-07-15 15:40:15 INFO juju.worker.machiner machiner.go:94 setting addresses for machine-0-lxc-7 to ["local-machine:127.0.0.1" "local-cloud:192.168.50.83" "local-machine:::1"]
2015-07-15 15:40:15 DEBUG juju.worker.proxyupdater proxyupdater.go:151 new proxy settings proxy.Settings{Http:"", Https:"", Ftp:"", NoProxy:""}
2015-07-15 15:40:15 DEBUG juju.worker.logger logger.go:45 reconfiguring logging from "<root>=DEBUG" to "<root>=DEBUG;unit=DEBUG"
2015-07-15 15:40:15 INFO juju.worker.diskmanager diskmanager.go:62 block devices changed: []
2015-07-15 15:40:15 DEBUG juju.network network.go:220 no lxc bridge addresses to filter for machine
2015-07-15 15:40:15 INFO juju.worker.apiaddressupdater apiaddressupdater.go:78 API addresses updated to [["HP22.rigonet.nl:17070" "192.168.50.16:17070" "127.0.0.1:17070" "[::1]:17070"]]
2015-07-15 15:40:15 DEBUG juju.worker.reboot reboot.go:82 Reboot worker got action: noop
2015-07-15 15:40:15 DEBUG juju.worker.rsyslog worker.go:213 making syslog connection for "juju-machine-0-lxc-7" to 192.168.50.16:6514
2015-07-15 15:40:15 INFO juju.worker runner.go:261 start "networker"
2015-07-15 15:40:15 INFO juju.worker runner.go:261 start "authenticationworker"
2015-07-15 15:40:15 INFO juju.networker networker.go:163 networker is disabled - not starting on machine "machine-0-lxc-7"
2015-07-15 15:40:15 DEBUG juju.worker.proxyupdater proxyupdater.go:170 new apt proxy settings proxy.Settings{Http:"", Https:"", Ftp:"", NoProxy:""}
我在 /var/log/syslog 中发现的唯一有趣的东西是:
Jul 15 15:41:22 HP22 kernel: [1280629.664746] type=1400 audit(1436974882.268:99): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/run/rpc_pipefs/" pid=7655 comm="mount" fstype="rpc_pipefs" srcname="rpc_pipefs" flags="rw"
Jul 15 15:41:22 HP22 kernel: [1280629.664831] type=1400 audit(1436974882.268:100): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/run/rpc_pipefs/" pid=7655 comm="mount" fstype="rpc_pipefs" srcname="rpc_pipefs" flags="ro"
Jul 15 15:41:22 HP22 kernel: [1280629.687213] type=1400 audit(1436974882.288:101): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/run/rpc_pipefs/" pid=7668 comm="mount" fstype="rpc_pipefs" srcname="rpc_pipefs" flags="rw"
Jul 15 15:41:22 HP22 kernel: [1280629.687302] type=1400 audit(1436974882.288:102): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/run/rpc_pipefs/" pid=7668 comm="mount" fstype="rpc_pipefs" srcname="rpc_pipefs" flags="ro"
Jul 15 15:41:22 HP22 kernel: [1280629.729821] type=1400 audit(1436974882.332:105): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/run/rpc_pipefs/" pid=7692 comm="mount" fstype="rpc_pipefs" srcname="rpc_pipefs" flags="rw"
在 maas 控制器上,我还安装了 webmin,以便快速查看我的 BIND DNS 区域。我注意到主机从 DHCP 服务器获得了一个静态 IP 地址。该机器上的 lxc 容器被赋予了我在 MAAS 中为集群定义的范围内的 DHCP 地址,但其机器名称 (machine-0-lxc-7) 未在 DNS 服务器上注册。奇怪的是 LXC 容器也没有出现在 MAAS 中。
我该怎么做才能进一步调试并使其运行。
问候,Joham