etcd无法启动 - 供应商预设:已禁用

时间:2016-02-19 10:42:52

标签: azure vagrant coreos

使用此cloud-config开始使用vagrant启动coreos:

#cloud-config

coreos:
  etcd2:
    name: core-01
    initial-advertise-peer-urls: http://$private_ipv4:2380
    listen-peer-urls:
    http://$private_ipv4:2380,http://$private_ipv4:7001
    initial-cluster-token: core-01_etcd
    initial-cluster: core-01=http://$private_ipv4:2380
    initial-cluster-state: new
    advertise-client-urls:
    http://$public_ipv4:2379,http://$public_ipv4:4001
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
  fleet:
    public-ip: $public_ipv4
  flannel:
    interface: $public_ipv4
  units:
    - name: etcd2.service
      command: start
    - name: fleet.service
      command: start
    - name: flanneld.service
      drop-ins:
      - name: 50-network-config.conf
        content: |
          [Service]
          ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
      command: start
    - name: docker-tcp.socket
      command: start
      enable: true
      content: |
        [Unit]
        Description=Docker Socket for the API

        [Socket]
        ListenStream=2375
        Service=docker.service
        BindIPv6Only=both

        [Install]
        WantedBy=sockets.target

etcd无法启动:

systemctl status etcd
● etcd.service - etcd
   Loaded: loaded (/usr/lib64/systemd/system/etcd.service; static; vendor preset: disabled)
   Active: inactive (dead)

我在没有cloud-config的情况下在Azure上启动CoreOS VM,它给了我同样的错误。

1 个答案:

答案 0 :(得分:1)

查看服务启动模式:

systemctl list-unit-files | grep etcd

应启用它。

如果是“蒙面”

systemctl unmask etcd.service

如果是“禁用”

systemctl enable etcd.service

在cloud-config文件中,我们看到需要更多服务。 所以你可以使用

systemctl edit etcd.service --full

编辑此服务文件:

[Unit]
#Description=etcd...
#...
#After=network.target
#e.g. Start this Service before etcd.service
Wants=flanneld.service

有关更详细的systemctl说明,请参阅:

https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
https://wiki.archlinux.org/index.php/Systemd