how to connect to bolt with cypher-shell not on localhost - neo4j

Really want to connect to bolt from an spark slave also but figured if I can get it working with cypher-shell the rest will fall into place. So I can do this:
cypher-shell -a localhost
Connects fine
if I do this on the box which is the actual ip:
cypher-shell -a 172.20.0.71:7687
Get a connection refused, I thought all I had to do was in the conf do:
dbms.connector.bolt.address=0.0.0.0:7687
That didn't seem to work is there something else I am missing?
(Or at least the above didn't seem to work I did restart my neo4j instance so it should of picked up the changes to conf). Connecting just with defaults on cypher-shell does give this still though:
Connected to Neo4j 3.3.0 at bolt://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
So maybe it didn't fully restart and pick up the changes to the neo4j.conf ? Or more likely I am missing something else to get this to work as I think it should. Where I can connect from another ip or locally to bolt via the actual ip address?

You need to uncomment this in your neo4j.conf :
dbms.connectors.default_listen_address=0.0.0.0
Restart the server, and then with cypher-shell :
cypher-shell -a bolt://172.20.0.71:7687

Related

How to connect to Neo4j from a web browser

I am just getting started with Neo4j and when I try to run a command that connects to the database I get an error. For example, if I try to run the first CREATE command from the sample movie database, or if I run CALL dbms.procedures().
The error is as follows: BoltConnectionError: No connection found, did you connect to Neo4j?
In the left panel of the browser page, under the 'Connected As' heading, it has my username and role (Admin). FYI, I followed the setup procedure from Larave's Homestead to install Neo4j in the first instance. On my first visit to the URL (port 7474), it asked for (and accepted) my username and password.
Additional Info:
Neo4j database is version 3.3.5 and runs on a Ubuntu VM
Neo4j browser is ver 3.1.7 and runs on the mac host
When I run :server connect it tells me I am connected via bolt://mydomain:7687
When I run lsof -i :7474 on the Ubuntu machine it tells me that Java is listening to the port, and that user is neo4j
First
:server disconnect
And then connect again
:server connect
If it doesn't work, change your browser.

How to deal with "Starting neo4j failed: Address localhost:7687 is already in use"?

I am using Neo4j Community Edition 3.1.1 on Mac OS X Sierra. Whenever I try to start Neo4j locally via
neo4j start
I get the following:
Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#a8ba98d' was successfully initialized, but failed to start.
Please see attached cause exception.
with the following exception at the tail of /usr/local/Cellar/neo4j/3.1.1/libexec/logs/neo4j.log
Caused by: org.neo4j.helpers.PortBindException: Address localhost:7687 is already in use, cannot bind to it.
I tried running
lsof -i -n -P | grep 7687
but it came back empty.
Please advise.
Note: I'd leave this as a comment, but don't have the required rep.
Are you sure that you have only one version of Neo4j installed?
Is your installation clean, without any traces of previous installations?
Is your JDK version >= 8?
Have you made other changes to your conf file?
Do you have the desktop app installed? des it work without issues?
Your lsof could be returning an empty value as some pids are only visible to root. Try:
sudo netstat -antlp
This should return all open ports, check if anything corresponds to 7687.
Also try running neo4j as a service. I believe it's launchctl on Mac (I use systemctl on Linux) and check if the error persists.
Cheers
I had the same exact issue, notice how neo4js is trying to get to localhost:7687?
I checked my /etc/hosts file and sure enough, I had a bogus entry for localhost (from previous testing).
I changed /etc/hosts entry back to
localhost 127.0.0.1
Saved, then ran again.
Neo4j started up fine after that.

Neo4j 3.0 setup issues

With neo4j 2.3.x community edition I use to set the ip address to local host and change the port to allow multiple instances for development.
#org.neo4j.server.webserver.address=0.0.0.0
org.neo4j.server.webserver.port=7384
Upon starting the instance, I use to have a confirmation message with ip and port.
Starting Neo4j Server...WARNING: not changing user
process [28531]... waiting for server to be ready........ OK.
http://localhost:7384/ is ready.
I would then upload data using a shell script and cypher commands.
$neo/bin/neo4j-shell -path $neo/data/graph.db -file upload.cypher
With neo4j 3.0, the server setup slightly changed. I turned on HTTP connection, CSV import, and shell connection.
dbms.connector.http.enabled=true
dbms.connector.http.address=localhost:7384
dbms.shell.enabled=true
# dbms.shell.host=127.0.0.1
dbms.shell.port=1387
When I start the instance, I get the following message in which the port is not correct.
Starting Neo4j.
Started neo4j (pid 28718). By default, it is available at http://localhost:7474/
There may be a short delay until the server is ready.
Uploading data with the same shell script as for neo4j-2.3.x works well, no error message and I can see the data using neo4j-shell.
./neo4j-3.0.0/bin/neo4j-shell -path neo4j-3.0.0/data/graph.db
However, when I connect using host and port instead, I see no data. Furthermore, when I connect using the web interface, I see no data either.
./neo4j-3.0.0/bin/neo4j-shell -host localhost -port 1387
Is there anything wrong in my database setup?
Thanks!
In 3.0 the location of the datastore has changed. 2.x used data/graph.db, in 3.0 it's by default in data/databases/graph.db. So you want to change your setup script to:
./neo4j-3.0.0/bin/neo4j-shell -path neo4j-3.0.0/data/databases/graph.db

neo4j backup error when backing up from ha cluster

I'm trying to setup backup for a Neo4j cluster with 3 instances. Neo4j is embedded.
If I run:
./neo4j-backup -from ha://10.106.4.80:5001,10.106.4.203:5001,10.106.14.164:5001 -to /tmp/neobak2/
from a host outside the 10.106.4.0 network, I get this error:
Could not find backup server in cluster neo4j.ha at 10.106.4.80:5001,10.106.4.203:5001,10.106.14.164:5001, operation timed out.
If I run it from a cluster member it works just fine. Also if I run the backup script with single instead of ha works fine from anywhere.
Below the basic cluster config I'm using:
ha.server_id: 1
ha.initial_hosts:10.106.4.80:5001,10.106.4.203:5001,10.106.14.164:5001
ha.tx_push_factor: 2
I already checked for firewall issues, there aren't any. Neo4j version used is 1.9.5.
The webadmin interface shows the cluster has online backup enabled and listening to the default port.
Any help will be appreciated.
According to RFC 5735 IP Adresses 10.0.0.0/8 are private. So I assume they're not routed from an external host.

Cassandra Cluster Setup getting JMX error

I m trying setup a cassandra cluster as a test bed but gave the JMX remote connection error. I seem to found the answer for my error from cassandra FAQ page
Nodetool says "Connection refused to host: 127.0.1.1" for any remote host. What gives?
Nodetool relies on JMX, which in turn relies on RMI, which in turn sets up it's own listeners and connectors as needed on each end of the exchange. Normally all of this happens behind the scenes transparently, but incorrect name resolution for either the host connecting, or the one being connected to, can result in crossed wires and confusing exceptions.
If you are not using DNS, then make sure that your /etc/hosts files are accurate on both ends. If that fails try passing the -Djava.rmi.server.hostname=$IP option to the JVM at startup (where $IP is the address of the interface you can reach from the remote machine).
But can somebody help me on how to do -Djava.rmi.server.hostname=$IP
Or what to add is hosts file, i know that in hosts normally we add "IP Alias", but whose ip and alias.
I dont know much java or either linux
I m currently working on ubuntu v10.04 and cassandra v0.74
Sudesh
For JMX you need to enable JMX-remoting:
java -Dcom.sun.management.jmxremote
Depending on from where you want to access the jmx-server, you also need to specify a port:
-Dcom.sun.management.jmxremote.port=12345
and set or disable passwords.
Have a look at http://download.oracle.com/javase/1.5.0/docs/guide/management/agent.html for more details.

Resources