How Can I stop neo4j community edition in kubernetes?

3/21/2019

I have put neo4j community edition(v3.2.2) into kubernetes. But the community edition do not support hot backup so I have to shut it down for backup/restore data.

I tried:

kubectl exec neo4j-0 /var/lib/neo4j/bin/neo4j stop

but it shows:

Neo4j not running

also tried:

kubectl exec -it neo4j-0 bash
/var/lib/neo4j/bin/neo4j stop

but still can't stop the neo4j in container

Neo4j not running

Does any body have a solution?

-- Miko
containers
docker
kubernetes
neo4j

1 Answer

3/22/2019

You can not stop the main process inside a container, otherwise it will be considered as dead and Kubernetes will terminate this pod and schedule a new healthy one.

Also Kubernetes does not support suspending pods. It's cheaper to stop/start pods.

So, in your case, I'd recommend to down scale you deployment to zero replicas during backup

kubectl scale --replicas=0 deployment/neo4j

and up scale back to required replicas once backup is completed

kubectl scale --replicas=1 deployment/neo4j
-- A_Suh
Source: StackOverflow