Error querying Consul agent: Get http://127.0.0.1:8500/v1/kv/vault?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused - consul

~]$ /apps/bin/consul/consul kv export vault
Error querying Consul agent: Get http://127.0.0.1:8500/v1/kv/vault?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused
I'm trying to export entire vault/ folder from consul.
seeing the below error
Error querying Consul agent: Get http://127.0.0.1:8500/v1/kv/vault?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused

You have to change the http/s address of Consul agent to which you're trying to connect. The default one is http://127.0.0.1:8500 and it doesn't work as you can see in the error.
To do this, set the following environment variable using the export command:
export CONSUL_HTTP_ADDR = <http/s_address_to_consul_agent>
If connecting via TLS, set also:
export CONSUL_CACERT = <path_to_cert_file>
Alternatively, you can set the above values as the parameters to consul kv export command:
consul kv export -http-addr=<http/s_address_to_consul_agent> -ca-file=<path_to_cert_file>

Related

Error Connecting to ElasticSearch on CapRover

Have installed ElasticSearch on CapRover using One-Click install; but got the following error when trying to connect:
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000019CF191C370>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
CapRover remaps the port of ElasticSearch: 9200 -> 80
so need to either explicitly specify the port 80:
"<your url or ip>:80"
or alternatively you can change CapRover's port mapping to 9200

Elasticsearch connection refused

I'm trying to access elasticsearch, not from the host machine, however I get connection refused error.
What I tried:
telnet ip_address 9200
result was:
connect to address ip_address: Connection refused
telnet: Unable to connect to remote host
changing the elasticsearch.yml file. I changed host field to 0.0.0.0 and also tried the actual ip of the host machine, but it didn't help, I still got the error that connenction was refused.
Can you suggest what else can I try to solve this problem?

How to enable remote access to Master's proxy - "Failed connect to <ip>:8080; Connection refused"

I am playing with Kubernetes on https://labs.play-with-k8s.com.
I tried to use the kubectl proxy following the instructions in Kubernete's website.
On the Master node (192.168.0.13) I ran: kubectl proxy --port=8080:
[node1 ~]$ kubectl proxy --port=8080
Starting to serve on 127.0.0.1:8080
On the Worker node I ran curl -v http://192.168.0.13:8080 and it failed:
[node2 ~]$ curl -v http://192.168.0.13:8080
* About to connect() to 192.168.0.13 port 8080 (#0)
* Trying 192.168.0.13...
* Connection refused
* Failed connect to 192.168.0.13:8080; Connection refused
* Closing connection 0
curl: (7) Failed connect to 192.168.0.13:8080; Connection refused
Any idea why the connection is refused ?
Starting to serve on 127.0.0.1:8080
As shown in the message it emits on startup, that is because kubectl proxy only listens on localhost (i.e. 127.0.0.1), unless you instruct it otherwise:
kubectl proxy --address=0.0.0.0 --accept-hosts='.*'
and that --accept-hosts business is a regular expression for hosts (presumably Referer headers? DNS lookups?) from which kubectl will accept connections, and .* is a regex that matches every string including the empty ones.

Cannot connect to an EC2 instance through web sockets

I am running an Akka HTTP service on port 8080 in my EC2 instance. It expects web socket connections, but normal HTTP should return 400 bad request.
I use this code to start Akka service:
Http().bindAndHandle(route, "localhost", 8080)
From the remote terminal I have this expected behavior, but not from outside.
$ wget ec2-XX-XXX-XX-XXX.compute-1.amazonaws.com:8080
--2017-10-01 15:27:31-- http://ec2-XX-XXX-XX-XXX.compute-1.amazonaws.com:8080/
Resolving ec2-XX-XXX-XX-XXX.compute-1.amazonaws.com... XX.XXX.XX.XXX
Connecting to ec2-XX-XXX-XX-XXX.compute-1.amazonaws.com|XX.XXX.XX.XXX|:8080... failed: Connection refused.
Here is my inbound rules configuration:
If I do netstat --listen -p the port 8080 does not appear.
Thanks!
I found out the problem. I should be binding the service to the private IP address of the EC2 instance.

Unable `go get` a repository via an HTTP proxy

When I am trying to install Burrow https://github.com/linkedin/Burrow#build-and-install
go get github.com/linkedin/Burrow
I am getting the following error :
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1"
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)
I have already set up proxy by:
export http_proxy=myproxy:port
export https_proxy=myproxy:port
Edit:
go get -u gopkg.in/gcfg.v1
also gives the same error:
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1"
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)
Edit1:
go get -v gopkg.in/gcfg.v1
Fetching https://gopkg.in/gcfg.v1?go-get=1
https fetch failed: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" (https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)
I was also getting the same error. Turns out that my https proxy was incorrect. Make sure both http and https proxy are pointing to same proxy starting with http.
export http_proxy=<http://proxy:port>
export https_proxy=<http://proxy:port>
Remove env HTTPS_PROXY from your PC:
SystemProperty - Environment - current user variable/system variable : find and remove HTTPS_PROXY.
Restart your terminal to enable env modification to take effect.
I solved the problem using:
export https_proxy=$http_proxy
To a more long lasting solution the /etc/environment can be updated.

Resources