如何为 Juju charm 赋予静态 IP 地址 - wordpress

如何为 Juju charm 赋予静态 IP 地址 - wordpress

我通过 juju 安装了一个 wordpress charm。为了能够通过公共 IP 访问此 charm,我将 IP 端口转发到我服务器的公共 IP 地址。最近,wordpress 的 IP 地址发生了变化,导致我的网站瘫痪。我想,这是因为 juju charm 使用的是 DHCP 而不是静态 IP 地址。有没有办法给 charm 一个静态 IP 地址?或者我还有其他方法可以部署此 charm 吗?

我使用的是本地。wordpress 的 public-address 以前是 10.0.3.15,现在改为 10.0.3.158

environment: local
machines:
  "0":
    agent-state: started
    agent-version: 1.20.1.1
    dns-name: localhost
    instance-id: localhost
    series: trusty
    state-server-member-status: has-vote
  "1":
    agent-state: started
    agent-version: 1.20.1.1
    dns-name: 10.0.3.32
    instance-id: madfresco-local-machine-1
    series: trusty
    hardware: arch=amd64
  "2":
    agent-state: started
    agent-version: 1.20.1.1
    dns-name: 10.0.3.158
    instance-id: madfresco-local-machine-2
    series: precise
    hardware: arch=amd64
services:
  mysql:
    charm: cs:trusty/mysql-3
    exposed: false
    relations:
      cluster:
      - mysql
      db:
      - wordpress
    units:
      mysql/0:
        agent-state: started
        agent-version: 1.20.1.1
        machine: "1"
        public-address: 10.0.3.32
  wordpress:
    charm: cs:precise/wordpress-25
    exposed: true
    relations:
      db:
      - mysql
      loadbalancer:
      - wordpress
    units:
      wordpress/0:
        agent-state: started
        agent-version: 1.20.1.1
        machine: "2"
        open-ports:
        - 80/tcp
        public-address: 10.0.3.158

不太确定这是否有帮助,但我发现了这些机器日志:

2014-08-06 08:14:10 ERROR juju.state.api.watcher watcher.go:68 error trying to stop watcher: connection is shut down
2014-08-06 08:14:10 ERROR juju.state.api.watcher watcher.go:68 error trying to stop watcher: connection is shut down
2014-08-06 08:14:11 ERROR juju.worker runner.go:207 fatal "deployer": connection is shut down
2014-08-06 08:14:11 ERROR juju.worker runner.go:207 fatal "upgrader": connection is shut down
2014-08-06 08:14:11 ERROR juju.worker runner.go:207 fatal "2-container-watcher": connection is shut down
2014-08-06 08:14:11 ERROR juju.worker runner.go:207 fatal "authenticationworker": connection is shut down
2014-08-06 08:14:11 ERROR juju.worker runner.go:207 fatal "machiner": connection is shut down
2014-08-06 08:21:35 INFO juju.cmd supercommand.go:37 running jujud [1.20.1.1-precise-amd64 gc]
2014-08-06 08:21:36 INFO juju.cmd.jujud machine.go:156 machine agent machine-2 start (1.20.1.1-precise-amd64 [gc])
2014-08-06 08:21:36 DEBUG juju.agent agent.go:377 read agent config, format "1.18"
2014-08-06 08:21:36 INFO juju.worker runner.go:260 start "statestarter"
2014-08-06 08:21:36 INFO juju.worker runner.go:260 start "termination"
2014-08-06 08:21:36 INFO juju.worker runner.go:260 start "api"
2014-08-06 08:21:36 INFO juju.state.api apiclient.go:242 dialing "wss://10.0.3.1:17070/"
2014-08-06 08:21:36 INFO juju.state.api apiclient.go:176 connection established to "wss://10.0.3.1:17070/"
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "upgrader"
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "upgrade-steps"
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "machiner"
2014-08-06 08:21:43 INFO juju.cmd.jujud machine.go:800 upgrade to 1.20.1.1-precise-amd64 already completed.
2014-08-06 08:21:43 INFO juju.cmd.jujud machine.go:781 upgrade to 1.20.1.1-precise-amd64 completed.
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "apiaddressupdater"
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "logger"
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "machineenvironmentworker"
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "rsyslog"
2014-08-06 08:21:43 DEBUG juju.worker.machineenvironment machineenvironmentworker.go:71 write system files: true
2014-08-06 08:21:43 INFO juju.worker runner.go:260 start "authenticationworker"
2014-08-06 08:21:43 DEBUG juju.worker.rsyslog worker.go:75 starting rsyslog worker mode 1 for "machine-2" "madfresco-local"
2014-08-06 08:21:43 DEBUG juju.worker.logger logger.go:35 initial log config: "<root>=DEBUG"
2014-08-06 08:21:43 DEBUG juju.worker.logger logger.go:60 logger setup
2014-08-06 08:21:43 INFO juju.worker.machiner machiner.go:86 setting addresses for machine-2 to ["local-machine:127.0.0.1" "local-cloud:10.0.3.158" "local-machine:::1" "fe80::$
2014-08-06 08:21:44 DEBUG juju.worker.logger logger.go:45 reconfiguring logging from "<root>=DEBUG" to "<root>=WARNING;unit=DEBUG"
2014-08-06 08:21:44 WARNING juju.cmd.jujud machine.go:357 determining kvm support: exit status 1
no kvm containers possible

答案1

您目前还无法做到这一点,但 juju 即将为 Ubuntu 15.04 提供一些更复杂的网络支持(也许更快)。

相关内容