Welcome to Knowage Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote
1 view

Goal

Create a MongoDB data source on a new installation of Knowage for evaluation. 

I'm really hoping to evauate Knowage for an important project, but I've been stuck for a couple of days and need some help.

Problem

When testing the MongoDB data source I get the following error:
  • com.mongodb.MongoSocketException: mongodb://localhost:27017: Name or service not known

Configuration

Server output

knowage_1        | 07-Apr-2022 12:59:56.247 INFO [http-nio-8080-exec-5] com.mongodb.diagnostics.logging.JULLogger.log Cluster created with settings {hosts=[mongodb://localhost:27017:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}

knowage_1        | 07-Apr-2022 12:59:56.250 INFO [http-nio-8080-exec-5] com.mongodb.diagnostics.logging.JULLogger.log No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=mongodb://localhost:27017:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out

knowage_1        | 07-Apr-2022 12:59:56.254 INFO [cluster-ClusterId{value='624ee04c0e8e3d0001772cfc', description='null'}-mongodb://localhost:27017:27017] com.mongodb.diagnostics.logging.JULLogger.log Exception in monitor thread while connecting to server mongodb://localhost:27017:27017

knowage_1        |      com.mongodb.MongoSocketException: mongodb://localhost:27017: Name or service not known
knowage_1        |              at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188)
knowage_1        |              at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:59)
knowage_1        |              at com.mongodb.connection.SocketStream.open(SocketStream.java:57)
knowage_1        |              at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:107)
knowage_1        |              at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:111)
knowage_1        |              at java.lang.Thread.run(Thread.java:748)
knowage_1        |      Caused by: java.net.UnknownHostException: mongodb://localhost:27017: Name or service not known
knowage_1        |              at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
knowage_1        |              at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
knowage_1        |              at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
knowage_1        |              at java.net.InetAddress.getAllByName0(InetAddress.java:1277)
knowage_1        |              at java.net.InetAddress.getAllByName(InetAddress.java:1193)
knowage_1        |              at java.net.InetAddress.getAllByName(InetAddress.java:1127)
knowage_1        |              at java.net.InetAddress.getByName(InetAddress.java:1077)
knowage_1        |              at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:186)
knowage_1        |              ... 5 more
knowagepython_1  | [2022-04-07 12:59:56 +0000] [34] [DEBUG] HEAD /dataset/libraries
knowagepython_1  | 127.0.0.1 - - [07/Apr/2022:12:59:56 +0000] "HEAD /dataset/libraries HTTP/1.1" 200 0 "-" "Wget/1.20.1 (linux-gnu)"
knowager_1       |  chr [1:29, 1:16] "base" "boot" "class" "cluster" "codetools" "compiler" ...
knowager_1       |  - attr(*, "dimnames")=List of 2
knowager_1       |   ..$ : chr [1:29] "base" "boot" "class" "cluster" ...
knowager_1       |   ..$ : chr [1:16] "Package" "LibPath" "Version" "Priority" ...
knowage_1        | 07-Apr-2022 12:59:56.755 INFO [cluster-ClusterId{value='624ee04c0e8e3d0001772cfc', description='null'}-mongodb://localhost:27017:27017] com.mongodb.diagnostics.logging.JULLogger.log Exception in monitor thread while connecting to server mongodb://localhost:27017:27017
knowage_1        |      com.mongodb.MongoSocketException: mongodb://localhost:27017
knowage_1        |              at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188)

Environment 8.1.0-SNAPSHOT, Docker, Edge, MongoDB 5.2.1
in Docker by (130 points)

1 Answer

0 votes

I have the same issue using docker-compose. I'd like to connect MongoDB with knowage, but get the same error message as described here (MongoSocketException / Unknown host exception).

Parameters Knowage UI

- Dialect: MongoDB

- Read Only: Yes

- Type: JDBC

- no username / password required

- URL: mongodb://172.18.1.4:27017/orion (container ip) or mongodb://localhost:27017/orion (localhost) or mongodb://mongodb:27017/orion (container name)

- Driver: mongo

Troubleshooting

I can exec container Knowage and ping MongoDB container by name and ip. Other way round I can also exec MongoDB container and ping Knowage container. But when I try to connect the data source using Knowage UI I get the issue above.

Ping from mongo

root@mongodb:/# ping fiware_knowage_1
PING fiware_knowage_1 (172.18.1.8) 56(84) bytes of data.
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=1 ttl=64 time=0.117 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=2 ttl=64 time=0.064 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=3 ttl=64 time=0.081 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=4 ttl=64 time=0.106 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=5 ttl=64 time=0.142 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=6 ttl=64 time=0.140 ms
^C
--- fiware_knowage_1 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5114ms
rtt min/avg/max/mdev = 0.064/0.108/0.142/0.028 ms

ping from knowage

root@mongodb:/# ping fiware_knowage_1
PING fiware_knowage_1 (172.18.1.8) 56(84) bytes of data.
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=1 ttl=64 time=0.117 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=2 ttl=64 time=0.064 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=3 ttl=64 time=0.081 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=4 ttl=64 time=0.106 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=5 ttl=64 time=0.142 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=6 ttl=64 time=0.140 ms
^C
--- fiware_knowage_1 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5114ms
rtt min/avg/max/mdev = 0.064/0.108/0.142/0.028 ms

Question

Why can't I connect to Mongo-DB even I am able to ping the other container using containername or ip address? I don't really understand com.mongodb.MongoSocketException / UnknownHostException here either

by (210 points)
...