dial tcp:5433 timeout on the auth proxy end when trying connect local private IP address of the AlloyDB instance i/o timeout
failed to connect to instance: Dial error: failed to dial (instance URI = "projects/myproject/locations/us-central1/clusters/mycluster/instances/myprimary"): dial tcp 10.205.117.5:5433: i/o timeout
From the comments:
The problem is accessing from local won't work. AlloyDB currently doesn't implement a Public IP connection, so the only way to connect to it is from within the same VPC (cloud network) as the AlloyDB cluster itself. That's why connecting from a GCE instance on the same network works while connecting from the local machine does not.
./alloydb-auth-proxy projects/<projects_name>/locations/<instance_location>/clusters/<cluster_name>/instances/<instance_name> --credentials-file <path_to_key> --port 5432 --address 0.0.0.0
I was having the same issue, it is because of the " between the uri. now i fix it by running command above
Related
I created an AWS EC2 (ubuntu-20.04) instance and setup a mongo server as per https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-ubuntu/
(mongo server is running in default port 27017 and not secured by any username/password)
I am able to connect to it from within the VM (after connecting to VM by SSH), by running the terminal command:
mongo
I have configured EC2 instance's Security Group's inbound rule to access port 27017 from my local system's IP.
however when I try to connect to it from my local system's terminal by command:
mongo --host "<public_ip_of_vm>:27017"
Its throwing error:
connecting to:
mongodb://<public_ip_of_vm>:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server <public_ip_of_vm>:27017, connection attempt
failed: SocketException: Error connecting to <public_ip_of_vm>:27017 :: caused
by :: Connection refused : connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6 exception: connect failed exiting with code 1
Not sure what's causing this issue, I have checked the ufw rules too.
port 27017 is open.
Did you modify ?
/etc/mongod.conf
Have a look at this tutorial, especially the step 2. Maybe this helps
https://ianlondon.github.io/blog/mongodb-auth/
Connection refused means you probably do not have a firewall problem. Connection timeout indicates a firewall issue.
Since you can connect locally via localhost, the error indicates that the mongo process is only listening on localhost.
Edit the file /etc/mogod.conf. The interesting line is bindIp.
It should look like this for IPv4 only:
bindIp: 0.0.0.0
If you have IPv6 enabled
bindIp: ::,0.0.0.0
Warning: enable authentication first. You might be hacked faster than you might expect.
Is it possible to setup/use HAProxy to forwards requests to a mongo database? If so can someone provide a basic example of how to set this up in the haproxy.cfg file?
I tried this, but this doesn't work:
listen mongo
bind 10.123.45.6:27017
mode tcp
balance roundrobin
server mongo1 10.456.78.9:27017
Where 10.123.45.6 is the IP of instance w/ HAProxy installed.
Where 10.456.78.9 is the IP of instance w/ mongodb installed.
Screenshot when trying to invoke client via command line:
C:\Program Files\MongoDB\Server\3.6\bin>mongo "mongodb://10.123.45.6:27017"
MongoDB shell version v3.6.11
connecting to: mongodb://10.123.45.6:27017/?gssapiServiceName=mongodb
2020-01-23T15:53:41.707-0800 W NETWORK [thread1] Failed to connect to 10.123.45.6:27017 after 5000ms milliseconds, giving up.
2020-01-23T15:53:41.707-0800 E QUERY [thread1] Error: couldn't connect to server 10.123.45.6:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:263:13
#(connect):1:6
exception: connect failed
Your settings are right, however I am adding an example for you
listen port_27017
bind :27017
mode tcp
server mongodb-port 10.156.78.9:27017
It should connect, but just to confirm from where are trying to connect? Is it within the local network or somewhere from the cloud. Because as per RFC 1918 all the 10.0.0.0/8 belong to private network, if you are outside the network and trying to access the 10.123.45.6 it won't work.
And if it is within network, and try to tail the log of HAProxy and see if it is able to connect to the Mongo or not.
If it is outside, you need to connect to HAProxy using it's public IP address rather than private IP.
I have a MongoDb hosted locally in my machine and runs successfully in port localhost:27017. The database has a user name and password with a collection named, "testDb". In the code, I am able to access the database successfully using localhost.
I am trying to access this MongoDb from a remote desktop using ngrok. I hace implemented the port forwarding and the following response is shown in the command prompt.
Forwarding https://5e825c82.ngrok.io -> http://localhost:27017
I also tried changing the port =>
Forwarding https://5e825c82.ngrok.io -> http://localhost:28017
Both ports failed with the following Error message:
The connection to http://5e825c82.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:28017.
Make sure that a web service is running on localhost:28017 and that it is a valid address.
The error encountered was: dial tcp [::1]:28017: connectex: No connection could be made because the target machine actively refused it.
// Works fine
MongoClient client = new MongoClient("mongodb://admin:admin#localhost:27017/testDb");
// Fails:
MongoClient client = new MongoClient("mongodb://admin:admin#5e825c82.ngrok.io/testDb");
I would like to know how to establish a connection to the MongoDb with ngrok.
MongoDB uses TCP not HTTP.
Try following command :
ngrok tcp 27017
(note the tcp, not http which I think is what you used)
There are a couple of extra steps you need to do for some reason when you use TCP, and ngrok will prompt you and tell you what you need to do when you try the above command.
Sign up for an ngrok account at https://dashboard.ngrok.com/get-started
Run locally the command shown on this page in the box 3. Connect your account (eg. ngrok authtoken 123ABC456ETC)
Now try that command again (ngrok tcp 27017)
I have Followed the below path http://clearwater.readthedocs.org/en/stable/Manual_Install/ for installation of Clearwater IMS node-specific modules. But when i was trying to install Homer & Homestead getting as connection refused.
TCP poll failed to 127.0.0.1 9160
nc: connect to 127.0.0.1 port 9160 (tcp) failed: Connection refused
Failed to connect to '127.0.0.1:7199': Connection refused
Due to which i am not able to proceed further.
Can anyone help me here.
the error comes sometimes when your port is not feee or port is using by some other services check once port is free or not
I have a Google Compute Engine instance which is running an active MongoDB server. I can connect to and interact with the server on the local machine via SSH.
However, when I attempt to connect to the database instance from an external source, like my home computer, I'm getting a connection refused. I have setup a firewall rule on the default network that looks like this:
Source Ranges:
0.0.0.0/0
Allowed Protocols or Ports:
tcp:27017
udp:27017
However, even after adding this rule to the default network I am still getting a connection refused when running:
$ mongo [ipaddress]
I'm not sure why the instance is refusing the incoming connection.