Skip to content

Commit

Permalink
Etcd data dir must be empty
Browse files Browse the repository at this point in the history
Otherwise we get the error "unknown wal version in data dir /var/etcd"

When this is the homedir for etcd, e.g. .bashrc confuses it
  • Loading branch information
justinsb committed Feb 2, 2015
1 parent e335e2d commit 9a29d9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/etcd/default
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
{% set etcd_servers = grains.etcd_servers -%}
{% endif -%}

DAEMON_ARGS="-addr {{etcd_servers}}:4001 -bind-addr {{etcd_servers}}:4001 -data-dir /var/etcd"
DAEMON_ARGS="-addr {{etcd_servers}}:4001 -bind-addr {{etcd_servers}}:4001 -data-dir /var/etcd/data"
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/etcd/etcd.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bind_addr = "0.0.0.0"
peer_bind_addr = "0.0.0.0"
data_dir = "/var/etcd"
data_dir = "/var/etcd/data"
max_retry_attempts = 60
10 changes: 10 additions & 0 deletions cluster/saltbase/salt/etcd/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ etcd:
- user: etcd
- group: etcd

/var/etcd/data:
file.directory:
- user: etcd
- group: etcd
- dir_mode: 700
- require:
- user: etcd
- group: etcd

{% if grains['os_family'] == 'RedHat' %}

/etc/default/etcd:
Expand Down Expand Up @@ -125,6 +134,7 @@ etcd-service:
- file: etcd-symlink
- require:
- file: /var/etcd
- file: /var/etcd/data
- user: etcd
- group: etcd

2 changes: 1 addition & 1 deletion cluster/saltbase/salt/etcd/initd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NAME=etcd
DAEMON=/usr/local/bin/$NAME
# DAEMON_ARGS="-peer-addr $HOSTNAME:7001 -name $HOSTNAME"
host_ip=$(hostname -i)
DAEMON_ARGS="-addr ${host_ip}:4001 -bind-addr ${host_ip}:4001 -data-dir /var/etcd -initial-advertise-peer-urls http://${HOSTNAME}:2380 -name ${HOSTNAME} -initial-cluster ${HOSTNAME}=http://${HOSTNAME}:2380"
DAEMON_ARGS="-addr ${host_ip}:4001 -bind-addr ${host_ip}:4001 -data-dir /var/etcd/data -initial-advertise-peer-urls http://${HOSTNAME}:2380 -name ${HOSTNAME} -initial-cluster ${HOSTNAME}=http://${HOSTNAME}:2380"
DAEMON_LOG_FILE=/var/log/$NAME.log
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
Expand Down

0 comments on commit 9a29d9f

Please sign in to comment.