I try to remote access my Blazegraph server, which is running on a Ubuntu VM on Azure. So I want to access the server with its public IP address, e.g. 51.123.45.234:9999. I changed the firewall settings in Azure to allow incoming traffic to port 9999, but currently I can only access the server with:
curl 127.0.0.1:9999
or
curl localhost:9999
from the ssh shell when I connect to the server. I can't even connect with the server when I try the IP of the server on the connected ssh shell.
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0d:3a:28:cd:60
inet addr:10.0.0.4 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::20d:3aff:fe28:cd60/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:208531 errors:0 dropped:328 overruns:0 frame:0
TX packets:178597 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:170613969 (170.6 MB) TX bytes:28500224 (28.5 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:6387 errors:0 dropped:0 overruns:0 frame:0
TX packets:6387 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:565256 (565.2 KB) TX bytes:565256 (565.2 KB)
The IP is the one of the virtual network the VM is in and not the public one. And if I try:
curl 10.0.0.4:9999
I get:
curl: (7) Failed to connect to 10.0.0.4 port 9999: Connection refused
I set up up my server following the instructions here. I also changed my .ssh/config to:
Host queryserver
LocalForward localhost:9999 127.0.0.1:9999
I also ran netstat to check if the server is listening:
netstat -ln | grep 9999
tcp6 0 0 127.0.0.1:9999 :::* LISTEN
My iptables shouldn't be the problem:
sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
How can I solve this problem?
Wikidata-query-rdf starts jetty servlet container and installs blazegraph-service-*.war, note that it specifies --host $HOST, which defaults to 'localhost' in runBlazegraph.sh script.
According to Jetty configuration, if --host specified, it defines the interface to listen on, so by default Blazegraph run by Wikidata-query-rdf listens only to localhost interface.
Specify -h your_ip while running runBlazegraph.sh :
./runBlazegraph.sh -h 10.0.0.4
If that does not resolve the issue, you might need to use 0.0.0.0 host name to listen on all interfaces and enable preferred IPv4 stack for java):
./runBlazegraph.sh -h 0.0.0.0 -o -Djava.net.preferIPv4Stack=true