Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use etcd command line #4653

Closed
ighouri opened this issue Mar 1, 2016 · 3 comments
Closed

unable to use etcd command line #4653

ighouri opened this issue Mar 1, 2016 · 3 comments

Comments

@ighouri
Copy link

ighouri commented Mar 1, 2016

I have configured etcd correctly and service seems running fine as I was successfully able to hit the etcd server using https in my browser but when I try to use etcdctl in my machine, it says etcd cluster is misconfigured and connection is refused because of bad HTTP response (please see below). Also, I am not sure why in first place it is trying to do http connection instead of https connection.

Any quick help or a clue is much appreciated. Thanks in advance.

1). Here is my /etc/etcd/etcd.conf file.

`# [member]
ETCD_NAME="compute-238213-1"
ETCD_DATA_DIR="/var/lib/etcd/compute-238213-1.etcd"
ETCD_SNAPSHOT_COUNT="10000"
ETCD_HEARTBEAT_INTERVAL="100"
ETCD_ELECTION_TIMEOUT="1000"
ETCD_LISTEN_PEER_URLS="http://10.65.226.16:2380"
ETCD_LISTEN_CLIENT_URLS="https://10.65.226.16:2379,https://127.0.0.1:2379"
ETCD_MAX_SNAPSHOTS="5"
ETCD_MAX_WALS="5"
ETCD_CORS="none"

[cluster]

ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.65.226.16:2380"
ETCD_INITIAL_CLUSTER="compute-238213-1=http://10.65.226.16:2380,compute-238343-2=http://10.65.96.254:2380,compute-238213-2=http://10.65.226.159:2380,compute-238343-1=http://10.65.96.26:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-1"
ETCD_ADVERTISE_CLIENT_URLS="https://10.65.226.16:2379"

[proxy]

ETCD_PROXY="off"
ETCD_PROXY_FAILURE_WAIT="5000"
ETCD_PROXY_REFRESH_INTERVAL="30000"
ETCD_PROXY_DIAL_TIMEOUT="1000"
ETCD_PROXY_WRITE_TIMEOUT="5000"
ETCD_PROXY_READ_TIMEOUT="0"

[security]

ETCD_CERT_FILE="/var/lib/certs/server.crt"
ETCD_KEY_FILE="/var/lib/certs/server.key"

[logging]

ETCD_DEBUG="false"
ETCD_LOG_PACKAGE_LEVELS="none"

[unsafe]

ETCD_FORCE_NEW_CLUSTER="false"

[experimental]

ETCD_EXPERIMENTAL_V3DEMO="false"

[miscellaneous]

ETCD_VERSION="false"

[profiling]

ETCD_ENABLE_PPROF="false"`

2). Here is etcd service runs fine.

service etcd status
Redirecting to /bin/systemctl status etcd.service
etcd.service - Etcd Server
Loaded: loaded (/usr/lib/systemd/system/etcd.service; enabled)
Active: active (running) since Tue 2016-03-01 22:12:09 UTC; 39min ago
Main PID: 13802 (etcd)
CGroup: /system.slice/etcd.service
└─13802 /usr/bin/etcd
Mar 01 22:12:09 mydocker-238213-1-10782743 etcd[13802]: 7252efcc73b96d2a [term: 2] received a MsgVote message with higher ...m: 4]
Mar 01 22:12:09 mydocker-238213-1-10782743 etcd[13802]: 7252efcc73b96d2a became follower at term 4
Mar 01 22:12:09 mydocker-238213-1-10782743 etcd[13802]: 7252efcc73b96d2a [logterm: 1, index: 4, vote: 0] voted for ad5b6f9...erm 4
Mar 01 22:12:09 mydocker-238213-1-10782743 etcd[13802]: raft.node: 7252efcc73b96d2a elected leader ad5b6f972077cd4 at term 4
Mar 01 22:12:09 mydocker-238213-1-10782743 etcd[13802]: published {Name:compute-238213-1 ClientURLs:[https://10.65.226.16:...f00ec
Mar 01 22:12:09 mydocker-238213-1-10782743 etcd[13802]: set the initial cluster version to 2.1
Mar 01 22:12:26 mydocker-238213-1-10782743 systemd[1]: [/usr/lib/systemd/system/etcd.service:3] Unknown lvalue 'Documentai...Unit'
Mar 01 22:12:27 mydocker-238213-1-10782743 etcd[13802]: the connection with 9955953c0dc7cab9 became active
Mar 01 22:12:29 mydocker-238213-1-10782743 systemd[1]: [/usr/lib/systemd/system/etcd.service:3] Unknown lvalue 'Documentai...Unit'
Mar 01 22:12:29 mydocker-238213-1-10782743 etcd[13802]: updated the cluster version from 2.1 to 2.2
Hint: Some lines were ellipsized, use -l to show in full.

3). Here is how I was able to access my etcd server in the browser using SSL which returns correct version of etcd here.
https://10.65.226.16:2379/version

Problem
I am unable to use etcd command line interface from my server.

`[root@mydocker-238213-1-10782743 etcd]# hostname -i
10.65.226.16

[root@mydocker-238213-1-10782743 etcd]# etcdctl --debug --cert-file /var/lib/certs/server.crt --key-file /var/lib/certs/server.key member list
start to sync cluster using endpoints(http://127.0.0.1:4001,http://127.0.0.1:2379)
cURL Command: curl -X GET http://127.0.0.1:4001/v2/members
cURL Command: curl -X GET http://127.0.0.1:2379/v2/members
Error: client: etcd cluster is unavailable or misconfigured
error #0: dial tcp 127.0.0.1:4001: getsockopt: connection refused
error #1: malformed HTTP response "\x15\x03\x01\x00\x02\x02"

[root@mydocker-238213-1-10782743 etcd]# `

@gyuho
Copy link
Contributor

gyuho commented Mar 3, 2016

@ighouri Did you specify ca-file flag to etcdctl? You can see it tries to connect to http.

Please see https://github.com/coreos/etcd/blob/master/etcdctl/main.go#L42.

@ighouri
Copy link
Author

ighouri commented Mar 4, 2016

@gyuho ,

No I have not .. I have certificate and key only i.e. server.crt and server.key respectively. Since this is a self signed certificate I have created, i do not have the Certificate Authority CA file that I can point to --ca-file option in etcdctl.

@xiang90
Copy link
Contributor

xiang90 commented Mar 4, 2016

@ighouri specify endpoint with https schema for etcdctl will solve your issue. Thanks!

@xiang90 xiang90 closed this as completed Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants