Bug 1263077 - add default options to etcd ExecStart in etcd.service
add default options to etcd ExecStart in etcd.service
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: etcd (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Jan Chaloupka
: Extras
Depends On:
  Show dependency treegraph
Reported: 2015-09-15 02:04 EDT by Guohua Ouyang
Modified: 2016-02-16 11:40 EST (History)
2 users (show)

See Also:
Fixed In Version: etcd-2.2.2-3.el7_2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-02-16 11:40:00 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Guohua Ouyang 2015-09-15 02:04:05 EDT
Description of problem:
Current etcd run without any options at the command line, user have no idea what options is etcd running by checking the status of the service.

Add these default arguments to it like below, it will be very clear by then.
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=${ETCD_NAME} --data-dir=${ETCD_DATA_DIR} --listen-client-urls=${ETCD_LISTEN_CLIENT_URLS} --advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS}"

# status etcd -l
etcd.service - Etcd Server
   Loaded: loaded (/usr/lib/systemd/system/etcd.service; enabled)
   Active: active (running) since Tue 2015-09-15 13:57:26 CST; 3min 53s ago
 Main PID: 22047 (etcd)
   CGroup: /system.slice/etcd.service
           └─22047 /usr/bin/etcd --name=default --data-dir=/var/lib/etcd/default.etcd --listen-client-urls=http://localhost:2379, --advertise-client-urls=http://localhost:2379,

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:
Comment 2 Jan Chaloupka 2015-09-15 03:34:22 EDT
Hi Guohua,

there is a lot of arguments that etcd supports. Which would be the primary? All of them? /etc/etcd/etcd.conf consists of environment variables which etcd reads. So this will work. However, it will duplicate what etcd already does.

I suppose reading from /proc/22047/environ is not user friendly and can be done only by root.
Comment 3 Guohua Ouyang 2015-09-15 04:19:23 EDT
Hi Jan,

I'm intending to only add those uncommented arguments in /etc/etcd/etcd.conf at first, after review the file again, I'd like to add those arguments which has URL, the list I want to see is:

# [member]


# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..."

How do you think?
Comment 4 Jan Chaloupka 2015-09-15 04:54:49 EDT
I see one problem. If a user decides to comment out ETCD_INITIAL_CLUSTER_STATE for example, etcd will get empty --initial-cluster-state option. It will not get set to default "new". It will need something like this:

etcd ... --initial-cluster-state=${ETCD_INITIAL_CLUSTER_STATE:-new} ...

The same for the remaining options.

Another problem is when default values will change. This will require awareness of a packager and continuous checking default and available values.

Otherwise don't see any other problem ATM.
Comment 5 Jan Chaloupka 2015-09-15 04:57:10 EDT
$ echo ${A:-http://localhost:2379}

works as expected as well.
Comment 6 Guohua Ouyang 2015-09-15 05:08:32 EDT
ah, that's a problem. users use default conf file will fail in many situation with these cluster arguments.

I'd like to fall back to these uncomment out arguments, only support these I added in the example.
Comment 7 Guohua Ouyang 2015-09-23 01:34:56 EDT
I tested that by adding these arguments in etcd.service, it cannot run proxy mode properly with or without --advertise-client-urls set.

Without --advertise-client-urls set, the error looks like below:
invalid value "" for flag -advertise-client-urls: URL scheme must be http or https:

With --advertise-client-urls set, etcdserver will try to set up the cluster with the advertised urls, which should not be presenting in proxy mode.

etcdserver: could not get cluster response from Get dial tcp connection refused

There maybe more different situations out there when proxy and cluster argument involved in.

I'd like to close this request at the moment.
Comment 8 Guohua Ouyang 2015-09-23 01:51:19 EDT
ah, it would be safe to add "--name=${ETCD_NAME} --data-dir=${ETCD_DATA_DIR} --listen-client-urls=${ETCD_LISTEN_CLIENT_URLS}".

It's helpful and looks enough to me.
Comment 11 Joy Pu 2016-01-08 08:11:12 EST
Checked with following steps and seems it is fixed in etcd-2.2.2-5.el7

1. check the etcd.service file
 # cat /usr/lib/systemd/system/etcd.service |grep ExecStart
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"${ETCD_NAME}\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\""

2. start etcd service and check the status with:
# systemctl status etcd -l
● etcd.service - Etcd Server
   Loaded: loaded (/usr/lib/systemd/system/etcd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2016-01-08 05:41:38 EST; 10h ago
 Main PID: 885 (etcd)
   CGroup: /system.slice/etcd.service
           └─885 /usr/bin/etcd --name=default --data-dir=/var/lib/etcd/default.etcd --listen-client-urls=http://localhost:2379

So update this one to VERIFIED
Comment 13 errata-xmlrpc 2016-02-16 11:40:00 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.