Bug 1263077

Summary: add default options to etcd ExecStart in etcd.service
Product: Red Hat Enterprise Linux 7 Reporter: Guohua Ouyang <gouyang>
Component: etcdAssignee: Jan Chaloupka <jchaloup>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: gouyang, ypu
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: etcd-2.2.2-3.el7_2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-16 16:40:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Guohua Ouyang 2015-09-15 06:04:05 UTC
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,http://10.66.15.25:2379 --advertise-client-urls=http://localhost:2379,http://10.66.15.25:2379


Version-Release number of selected component (if applicable):
etcd-2.1.1-2.el7.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Jan Chaloupka 2015-09-15 07:34:22 UTC
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 08:19:23 UTC
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]

ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://10.66.15.25:2380"
ETCD_LISTEN_CLIENT_URLS="http://10.66.15.25:2379"


#[cluster]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.66.15.25:2380"
# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..."
ETCD_INITIAL_CLUSTER="default0=http://10.66.15.25:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS="http://10.66.15.25:2379"

How do you think?

Comment 4 Jan Chaloupka 2015-09-15 08:54:49 UTC
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 08:57:10 UTC
$ echo ${A:-http://localhost:2379}
http://localhost:2379

works as expected as well.

Comment 6 Guohua Ouyang 2015-09-15 09:08:32 UTC
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 05:34:56 UTC
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 http://10.66.15.25:2380: Get http://10.66.15.25:2380/members: dial tcp 10.66.15.25:2380: 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 05:51:19 UTC
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 13:11:12 UTC
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 16:40:00 UTC
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.

https://rhn.redhat.com/errata/RHBA-2016-0231.html