'Is it possible to connect to a Neo4J databse hosted in a virtual machine?

I have a VM that I access via SSH with credentials. I installed a neo4j database there, and I can access it when I am connected through SSH on a terminal. My question is, can I access it on my django app through the neo4j python driver on my native machine? I haven't found any information about how to connect to a neo4j database hosted on a ssh virtual machine.



Solution 1:[1]

For most intents and purposes, your VM(virtual machine) is just another machine as far as your Host(native machine) is concerned.

When you ssh from your Host to the VM, your host machine's SSH client is connects to your VM's SSH server.

Considering the above, while connecting from your python driver, use the same IP address you used for SSH.

Just replace 192.168.65.10 with your VM's IP address(used to SSH) in the below example:

graphDriver = neo4j.GraphDatabase.driver("neo4j://192.168.65.10",
auth=(<username>, <password>))

The default config of neo4j doesn't allow remote connections. You'll have to enable it by uncommenting the following line in neo4j.conf. The neo4j service has to be restarted for changes in the config file to be picked up.

dbms.default_listen_address=0.0.0.0

Reference

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1