我正在使用核心操作系统并使用云配置文件配置它。我需要为我的应用程序使用etcd服务。
这是云-配置文件的相关部分。
- name: etcd.service
command: start
content: |
[Unit]
Description=etcd
Requires=setup-network-environment.service
After=setup-network-environment.service
[Service]
EnvironmentFile=/etc/network-environment
User=etcd
PermissionsStartOnly=true
ExecStart=/usr/bin/etcd \
--name ${DEFAULT_IPV4} \
--addr ${DEFAULT_IPV4}:4001 \
--bind-addr 0.0.0.0 \
--discovery https://discovery.etcd.io/SOMEKEY \
--data-dir /var/lib/etcd \
--http-read-timeout 86400 \
--peer-addr ${DEFAULT_IPV4}:7001 \
--snapshot true
Restart=always
RestartSec=10s我不知道如何更新etcd的版本。
发布于 2015-04-22 15:31:01
原来etcd2已经安装在coreos上了。它目前是在coreos 653发行版中发布的,还附带了etcd。若要在云端配置中更改它,只需更改
ExecStart=/usr/bin/etcd至
ExecStart=/usr/bin/etcd2并删除一些在etcd2中不推荐的标志。
发布于 2015-04-22 14:38:55
我有一个模板生成器,我可以告诉它通过设置一个环境变量在etcd和etcd2之间切换。我做的一件事是使用etcd2.service名称或etcd.service (我不只是将etcd2配置放在etcd单元部分)。这是可行的,但是,您可能会考虑将文件中的所有etcd.service引用更改为etcd2.service。不管怎么说,下面是用于ExecStart的etcd2部分:
ExecStart=/usr/bin/etcd2 \
--name ${d['etcd']['name']} \
--advertise-client-urls ${d['etcd']['advertise-client-urls']} \
--discovery ${d['etcd']['discovery']} \
--data-dir /var/lib/etcd \
--initial-advertise-peer-urls ${d['etcd']['initial-advertise-peer-urls']} \
--listen-client-urls ${d['etcd']['listen-client-urls']} \
--listen-peer-urls ${d['etcd']['listen-peer-urls']}以下是d‘’etcd的env变量
"etcd": {
"mver":"etcd2.service",
"discovery":"http://discovery.etcd.io/SOMEKEY",
"addr":"$private_ipv4:4001",
"name":"$private_ipv4",
"peer-addr":"$private_ipv4:7001",
"advertise-client-urls":"http://$private_ipv4:2379",
"initial-advertise-peer-urls":"http://$private_ipv4:2380",
"listen-client-urls":"http://0.0.0.0:2379,http://0.0.0.0:4001",
"listen-peer-urls":"http://$private_ipv4:2380,http://$private_ipv4:7001"
}我记得在某个地方读到$public_ipv4是这些变量之一所需要的,put,我只是使用了所有这些变量的私有ip。我这里的环境是数字海洋。一定要使用coreos(至少在撰写本文时我认为这仍然是必需的)。
发布于 2015-04-23 17:07:50
云-config解析器支持etcd2和新的配置参数:https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/#etcd2。
举个例子:
#cloud-config
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
discovery: https://discovery.etcd.io/<token>
# multi-region and multi-cloud deployments need to use $public_ipv4
advertise-client-urls: http://$public_ipv4:2379
initial-advertise-peer-urls: http://$private_ipv4:2380
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001https://stackoverflow.com/questions/29794626
复制相似问题