While connecting from Mongo Client in Windows VM to Mongodb 4.4 in Mac host OS, receiving "Timed out after 5000 ms while waiting to connect" - mongodb

Mongodb 4.4.14 is intalled in Mac OS Monterey version 12.4.
Connection from Robo 3T installed in Mac itself works.
Connection from mongo cli in mac itself also works:
$ mongo
MongoDB shell version v4.4.14
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("ab8018b3-c4f2-4236-8c3b-abef5468bb03") }
MongoDB server version: 4.4.14
---
The server generated these startup warnings when booting:
2022-06-02T15:59:13.574+05:30: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
MongoDB Enterprise >
While connecting from Studio 3T installed in Windows Virtual Machine (it is Parallels software, NOT VirtualBox) to this mongodb 4.4, receiving the following error:
Connection failed.
SERVER [192.168.1.2:27017] (Type: UNKNOWN) CONNECTING
Details:
Timed out after 5000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.1.2:27017, type=UNKNOWN, state=CONNECTING}]
Note that the Mac host IP address is 192.168.1.2. And ping from Windows VM to Mac works fine. Also disabled the firewall in Windows.
C:\Windows\system32>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time<1ms TTL=64
Reply from 192.168.1.2: bytes=32 time<1ms TTL=64
Reply from 192.168.1.2: bytes=32 time<1ms TTL=64
Reply from 192.168.1.2: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\Windows\system32>
How to resolve this error?

In the parallels software network configuration, selected "Shared Network (Recommended)" and it worked fine.

Related

Flutter WebRTC server is not letting me connect

I recently started using flutter to create an app that has video and audio calling, so I thought of using WebRTC to accomplish this. However, when I tried to create a local WebRTC server from the WebRTC Github it doesn't let me connect to it. When I run the server from the command prompt it tells me that the server is listening at the given local IP, but when I try to connect to it, it says the site can't be reached. Also when I ping the url it says the ping request could not find the host. Any kind of help would really be appreciated.
WebRTC server: https://github.com/flutter-webrtc/flutter-webrtc-server
Starting server in command prompt
netstat when server running
pinging server
The IP 0.0.0.0 is not the IP address the server is binding/listening too.
It is a common way that servers allow configurion 0.0.0.0 to express binding to all IPv4 the host has (see https://en.wikipedia.org/wiki/0.0.0.0 ). To acually reach your server use whatever IP you have on the host (if you are starting the server on your workstation 127.0.0.1 ought to work)
Ping on Windows is only ICMP if I am not mistaken, this means a TCP port number is not part of it's expected input. Eg. "0.0.0.0:8086" is not a valid target for that command (see https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping )
>ping 0.0.0.0:8086
Ping request could not find host 0.0.0.0:8086. Please check the name and try again.
>ping 0.0.0.0
Pinging 0.0.0.0 with 32 bytes of data:
PING: transmit failed. General failure.
PING: transmit failed. General failure.
Ping statistics for 0.0.0.0:
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss),
Control-C
^C
>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
^C
Since what you are trying to connect to is a webserver you could use something like curl instead to try to verify your connection. Should be available without any further install if you are on Windows 10 1803 or newer.
>curl https://0.0.0.0:8086
curl: (7) Failed to connect to 0.0.0.0 port 8086: Address not available
>curl https://127.0.0.1:8086
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
Some browsers might support https://0.0.0.0:8086 in a similar way server do but I wouldn't rely on it. Go with https://127.0.0.1:8086 or a non localhost IP address of the host.

Cannot connect to remote kafka broker even after configuring advertised listeners

I have a vm created in GCP and I setup kafka in it. I had changed the advertised listeners to the external public ip of the vm.
But when ever I try to connect from the local laptop I keep getting this error.
I checked the connectivity to machine from ping and I am getting response
PING 34.69.37.118 (34.69.37.118): 56 data bytes
64 bytes from 34.69.37.118: icmp_seq=0 ttl=54 time=266.223 ms
64 bytes from 34.69.37.118: icmp_seq=1 ttl=54 time=290.133 ms
64 bytes from 34.69.37.118: icmp_seq=2 ttl=54 time=264.678 ms
64 bytes from 34.69.37.118: icmp_seq=3 ttl=54 time=263.067 ms
^C
--- 34.69.37.118 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 263.067/271.025/290.133/11.088 ms
If your client (Kafka Producer) it is outside of the VM, you need to expose the following:
listeners=INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092
listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
advertised.listeners=INTERNAL://vm-address:19092,EXTERNAL://host-address:9092
inter.broker.listener.name=INTERNAL
Now your producer should use 19092

Multi connection of BLE 6LoWPAN Border Router

I am struggling to make BLE connetion with raspberry pi 3.
When I make 1:1 connection, it works fine.
root#raspberrypi:~# hciconfig hci0 leadv
root#raspberrypi_SLAVE:~# echo "connect B8:27:EB:5D:C6:1E 1" > /sys/kernel/debug/bluetooth/6lowpan_control
root#raspberrypi:~# hcitool con
Connections:
< LE B8:27:EB:5D:C6:1E handle 64 state 1 lm MASTER
root#raspberrypi:~# ping -6 -I bt0 2005::b827:ebff:fe5c:b7a0
PING 2005::b827:ebff:fe5c:b7a0(2005::b827:ebff:fe5c:b7a0) from 2005::1 bt0: 56 data bytes
64 bytes from 2005::b827:ebff:fe5c:b7a0: icmp_seq=1 ttl=64 time=164 ms
64 bytes from 2005::b827:ebff:fe5c:b7a0: icmp_seq=2 ttl=64 time=89.1 ms
64 bytes from 2005::b827:ebff:fe5c:b7a0: icmp_seq=3 ttl=64 time=62.9 ms
64 bytes from 2005::b827:ebff:fe5c:b7a0: icmp_seq=4 ttl=64 time=85.6 ms
64 bytes from 2005::b827:ebff:fe5c:b7a0: icmp_seq=5 ttl=64 time=58.9 ms
--- 2005::b827:ebff:fe5c:b7a0 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 58.958/92.193/164.287/37.976 ms
But when I connect 2 or more devices, It does not work!!
root#raspberrypi:~# hciconfig hci0 leadv
root#raspberrypi_SLAVE2:~# echo "connect B8:27:EB:5D:C6:1E 1" > /sys/kernel/debug/bluetooth/6lowpan_control
root#raspberrypi:~# hcitool con
Connections:
> LE B8:27:EB:C2:60:83 handle 65 state 1 lm SLAVE
> LE B8:27:EB:5C:B7:A0 handle 64 state 1 lm SLAVE
root#raspberrypi:~# ping -6 -I bt0 2005::b827:ebff:fe5c:b7a0
PING 2005::b827:ebff:fe5c:b7a0(2005::b827:ebff:fe5c:b7a0) from 2005::1 bt0: 56 data bytes
^C
--- 2005::b827:ebff:fe5c:b7a0 ping statistics ---
28 packets transmitted, 0 received, 100% packet loss, time 28097ms
Can anyone tell me how to connect multiple devices with a BLE 6LoWPAN Border Router.
I solved this problem.
The problem was newest Laspbian kernel, version 4.14.y.
After rebuild 4.9.80-v7+, it works fine.
This post is almost 2 years old but it helped me a lot!
Had exactly the same error on my Raspberry Pis 4 running with Raspbian.
Looking at my kernel version with
uname -a
showed that it had the version 4.19.97-v7l+.
I found it a bit strange that downgrading to 4.9.80-v7+ should solve the issue so instead I upgraded to the newest kernel 5.4.40-v7l+ simply with
sudo rpi-update
and my BLE 6loWPAN connections worked just fine!
So it seems that kernel-versions between 4.14 and 4.19 have some issues with 6lowPAN over BLE. Couldn't find the reason for this on Google but updating fixed it!

Ubuntu can't use node to run mongod database

ubuntu#ip-172-31-45-35:~/cse303.p2$ node qloader.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [52.33.215.205:27017]
at null.<anonymous> (/home/ubuntu/cse303.p2/node_modules/mongoose/node_modules/mongodb/lib/mong odb/connection/server.js:556:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (/home/ubuntu/cse303.p2/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (/home/ubuntu/cse303.p2/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
above is the error message i got when trying to do 'node' to run my database.
I have set all my security group to 'all traffic', I suppose it's not a problem with my security group.
When I ping that ip address it can connect, this is what is shows.
ubuntu#ip-172-31-45-35:~/cse303.p2$ ping 52.33.215.205
PING 52.33.215.205 (52.33.215.205) 56(84) bytes of data.
64 bytes from 52.33.215.205: icmp_seq=1 ttl=63 time=1.37 ms
64 bytes from 52.33.215.205: icmp_seq=2 ttl=63 time=1.27 ms
64 bytes from 52.33.215.205: icmp_seq=3 ttl=63 time=1.21 ms
64 bytes from 52.33.215.205: icmp_seq=4 ttl=63 time=1.25 ms
^C
--- 52.33.215.205 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.218/1.281/1.376/0.072 ms
So it can connect to that address, but when i add that port 27017, it does't work.
ubuntu#ip-172-31-45-35:~/cse303.p2$ ping 52.33.215.205:27017
ping: unknown host 52.33.215.205:27017
I am not sure whether my mongod is running properly, this is what i got.
ubuntu#ip-172-31-22-135:~$ sudo service mongodb start
mongodb start/running, process 1382
You can't ping a port. Ping is ICMP and not TCP or UDP. The line mongodb start/running, process 1382 indicates that MongoDB is running.
It is likely that MongoDB's bind IP is set to 127.0.0.1. In the MongoDB configuration, check the value of bind_ip. It is likely set to localhost (127.0.0.1) and thus will only accept connections from the local VM.
There are many guides out there that can help, such as this or this.

connecting to remote mongo server results in exception connect failed

Running this command in the mongodb installation file from mongodb.org
./mongo ds045907.mongolab.com:45907/database -u user -p password
I changed Database, user, and password for anonymity.
results in this
Error: couldn't connect to server ds045907.mongolab.com:45907 src/mongo/shell/mongo.js:93
exception: connect failed
Maybe i'm being blocked by a server firewall? I have no problem using git or brew or pip...
Here are a few things you can try, but you can always feel free to contact us at support#mongolab.com. I'm sure we can get to the bottom of this.
Anonymous mongo shell connection
Mongo will let you connect without authenticating. You can do very little with an unauthenticated connection, but you can use it as a test to separate a connectivity problem from a credentials problem.
% mongo ds045907.mongolab.com:45907
MongoDB shell version: 2.0.7
connecting to: ds045907.mongolab.com:45907/test
> db.version()
2.2.2
> db.runCommand({ping:1})
{ "ok" : 1 }
> exit
bye
If you can connect without authenticating and run the commands as shown above, but trying to connect with authentication fails, then you have a problem with the credentials. If, however, connecting doesn't work even without supplying credentials then you have a connectivity problem.
ping
That server does allow ICMP traffic, so make sure it's reachable from wherever you are.
% ping ds045907.mongolab.com
PING ec2-107-20-85-188.compute-1.amazonaws.com (107.20.85.188): 56 data bytes
64 bytes from 107.20.85.188: icmp_seq=0 ttl=41 time=99.744 ms
64 bytes from 107.20.85.188: icmp_seq=1 ttl=41 time=99.475 ms
64 bytes from 107.20.85.188: icmp_seq=2 ttl=41 time=99.930 ms
^C
--- ec2-107-20-85-188.compute-1.amazonaws.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 99.475/99.716/99.930/0.187 ms
traceroute
If ping fails, use traceroute (or tracert on Windows) to try to figure out where the problem is. Once the trace reaches AWS, however, it will trail off. That's normal. AWS prevents traces from seeing too far into their networks. Make sure that the last IP on your list is owned by Amazon using some kind of IP reverse lookup tool (many on the Web).
% traceroute ds045907.mongolab.com
traceroute to ec2-107-20-85-188.compute-1.amazonaws.com (107.20.85.188), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 1.092 ms 0.865 ms 1.047 ms
2 192.168.27.1 (192.168.27.1) 1.414 ms 1.330 ms 1.224 ms
... snipped to protect the innocent ...
14 72.21.220.83 (72.21.220.83) 87.777 ms
72.21.220.75 (72.21.220.75) 87.406 ms
205.251.229.55 (205.251.229.55) 99.363 ms
15 72.21.222.145 (72.21.222.145) 87.703 ms
178.236.3.24 (178.236.3.24) 98.662 ms
72.21.220.75 (72.21.220.75) 87.708 ms
16 216.182.224.55 (216.182.224.55) 87.312 ms 86.791 ms 89.005 ms
17 * 216.182.224.55 (216.182.224.55) 91.373 ms *
18 216.182.224.55 (216.182.224.55) 121.754 ms * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
It's a connection problem at your side. I tried it but got a login failure message:
MongoDB shell version: 1.6.5
connecting to: ds045907.mongolab.com:45907/database
Mon Dec 24 01:12:31 uncaught exception: login failed
exception: login failed