Etcd: Error: invalid character 'p' after top-level value with etcdctl use

Created on 15 Jun 2015  路  7Comments  路  Source: etcd-io/etcd

[member]

ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"

ETCD_SNAPSHOT_COUNTER="10000"

ETCD_HEARTBEAT_INTERVAL="100"

ETCD_ELECTION_TIMEOUT="1000"

ETCD_LISTEN_PEER_URLS="http://192.168.33.10:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.33.10:2379,http://127.0.0.1:2379"

ETCD_MAX_SNAPSHOTS="5"

ETCD_MAX_WALS="5"

ETCD_CORS=""

[cluster]

ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.33.10:2380"
ETCD_INITIAL_CLUSTER="infra0=http://192.168.33.10:2380,infra1=http://192.168.33.9:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-1"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.33.10:2380"

ETCD_DISCOVERY=""

ETCD_DISCOVERY_SRV=""

ETCD_DISCOVERY_FALLBACK="proxy"

ETCD_DISCOVERY_PROXY=""

[proxy]

ETCD_PROXY="off"

[security]

ETCD_CA_FILE=""

ETCD_CERT_FILE=""

ETCD_KEY_FILE=""

ETCD_PEER_CA_FILE=""

ETCD_PEER_CERT_FILE=""

ETCD_PEER_KEY_FILE=""

I setup my /etc/etcd/etcd.conf file as suggested in https://github.com/coreos/etcd/blob/master/Documentation/clustering.md
. I can curl to it just fine, but etcdctl gives me a 404 error.

[root@localhost vagrant]# etcdctl get /foo/bar
Error: invalid character 'p' after top-level value

Any ideas?

Most helpful comment

In my case when I received this error, I had typoed my configuration in such a way that the etcd was advertising its client URL as its peer URL. Changing the advertised client URL to the correct port fixed the issue.

All 7 comments

@PeterLamar etcdctl by default will reach your localhost:4001 or 2379. I think you might have other server serving on that addr(4001).

Its a clean Fedora 22 image, with this being the first thing installed. I don't think anything is running on 4001, but happy to try any commands you suggest.

Try etcdctl --debug get /foo/bar, which tells you the details about its operations.

@PeterLamar I am closing this due to low activity. Report back if you can reproduce this and provide more detail information. Thanks!

In my case when I received this error, I had typoed my configuration in such a way that the etcd was advertising its client URL as its peer URL. Changing the advertised client URL to the correct port fixed the issue.

Thanks @alindeman Your method fixed my problem. :-)

/usr/lib/systemd/system/etcd.service

cat << EOF > $tmpdir/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify

EnvironmentFile=$ETCD_CONFIG_DIR/etcd

ExecStart=/usr/bin/etcd \
--name=$etcd_name \
--data-dir=/var/lib/etcd/default.etcd \
--listen-peer-urls=https://$ip:2380 \
--listen-client-urls=https://$ip:2379,http://127.0.0.1:2379 \
--advertise-client-urls=https://$ip:2379 \
--initial-advertise-peer-urls=https://$ip:2380 \
--initial-cluster=etcd01=https://$MASTER_IP:2380,etcd02=https://$NODE1_IP:2380,etcd03=https://$NODE2_IP:2380,etcd04=https://$NODE3_IP:2380 \
--initial-cluster-token=etcd-cluster \
--initial-cluster-state=new \
--cert-file=$ETCD_CERT_DIR/server.pem \
--key-file=$ETCD_CERT_DIR/server-key.pem \
--peer-cert-file=$ETCD_CERT_DIR/server.pem \
--peer-key-file=$ETCD_CERT_DIR/server-key.pem \
--trusted-ca-file=$ETCD_CERT_DIR/ca.pem \
--peer-trusted-ca-file=$ETCD_CERT_DIR/ca.pem

Restart=on-failure

LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF

be carefull of advertise-client-urls 琚潙鍝暒

Was this page helpful?
0 / 5 - 0 ratings