This is a temporary solution till we have a proper means of setup:
Using :sysinfo
command, check the roles for the cluster nodes.
For a 3-node Core cluster, one node is LEADER
and 2 nodes are FOLLOWER
s.
Only LEADER
has read/write access, whereas FOLLOWER
has read-only access.
Choose appropriate node instead of neo4j-neo4j-core-0 based on intent.
- On your developer machine, to
/etc/hosts
file, addneo4j
entry pointing tolocalhost
.
Your /etc/hosts
should have this line.
127.0.0.1 localhost neo4j
127.0.0.1 neo4j-neo4j-core-0.neo4j-neo4j.neo4j.svc.cluster.local
# 127.0.0.1 neo4j-neo4j-core-1.neo4j-neo4j.neo4j.svc.cluster.local
# 127.0.0.1 neo4j-neo4j-core-2.neo4j-neo4j.neo4j.svc.cluster.local
This is assuming neo4j-neo4j-core-0
is LEADER
in Neo4j Casual Cluster.
- Set your
kubectl config
to point to correct kubernetes cluster.
Check your current cluster.
kubectl config get-contexts
change kubectl config
to the cluster where neo4j is deployed.
kubectl config use-context $(kubectl config get-contexts --output name | grep ostelco)
Assuming neo4j
is running in neo4j
k8s namespace,
kubectl get pods -n neo4j
Choose one of the neo4j pod from the list.
kubectl port-forward -n neo4j neo4j-neo4j-core-0 7474:7474 7687:7687
Here, neo4j browser
web-app is exposed over port 7474
.
The client-side/in-browser web-app then tries to connect to neo4j database over bolt protocol
, exposed over port 7687
.
In the browser, goto http://localhost:7474
.
Use connection URL as: bolt://neo4j:7687
.
User name and password will be ignored.
The database will expects connections only for hostname neo4j
, and hence the setup in /etc/hosts
.
Once logged in , use this cypher query to fetch entire graph.
MATCH (n) RETURN n;
The current setup for Neo4j is a 3 node casual cluster
.
In this setup, there is only one instance which does read + write
whereas other 2 instances are read only
.
In the Neo4j browser web-app, you may check this using command :sysinfo
.
The cluster members with role as Leader
will have read + write
access, and those with the role Follower
will
have read only
access.
neo4j
has following tools:
- cypher-shell
- neo4j-admin
- neo4j-import
- neo4j-shell
They can be installed individually on developer machine, or they can accessed directly from inside a docker container.
docker run --rm neo4j ls -l /var/lib/neo4j/bin/
docker run --rm -v $(pwd):/var/workspace/ neo4j \
/var/lib/neo4j/bin/neo4j-admin backup --from=neo4j --backup-dir=/var/workspace/ --name=graph.db --pagecache=4G
Reference: https://neo4j.com/docs/operations-manual/current/backup/perform-backup/