Neo4j Desktop is running, but `neo4j status` still says that the server is not running?

In my understanding, opening Neo4j Desktop is equivalent to starting a server. However, when I check this with invoke-neo4j status it says Neo4j is not running. Do you know why is that?

This is the verbose output:

PS D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\bin> invoke-neo4j status -verbose
VERBOSE: Server command specified
VERBOSE: Java detected at 'C:\Program Files\Java\jdk-11\bin\java.exe'
VERBOSE: Invoking "C:\Program Files\Java\jdk-11\bin\java.exe" -version 2>&1
VERBOSE: Command returned with exit code 0
VERBOSE: Java version response: openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
VERBOSE: Java Version detected as 11
VERBOSE: Starting neo4j utility using command line C:\Program Files\Java\jdk-11\bin\java.exe -cp
"D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5/lib/*"
-Dbasedir="D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5" org.neo4j.server.startup.Neo4jCommand
"status"
Neo4j is not running.
3

My goal is to autostart a database and use Cypher in terminal.

BTW, is there any difference between a server and a service?

Hi @Ooker ,

Neo4j Desktop manages locally provisioned Neo4j DBMSes and remote connections. However, at the moment, starting Desktop does not automatically start a DBMS.

There has been some thought about restarting the most recently active DBMS. Is that the behavior you'd like to see?

Regarding a "server" vs a "service" running Neo4j, the difference is:

  • a "server" is the Neo4j DBMS process itself which hosts graph databases
  • a "service" is a process management which can start/stop/restart the server, often as part of an operating system lifecycle

Does that help?

Best,
ABK

If possible, can you confirm which of these is a service or a server:

  • Neo4j Desktop?
  • Invoke-Neo4j console?

I would say Invoke-Neo4j console starts a server, because in the output it says it starts Neo4j 4.3.5, which is a community server. And so, Invoke-Neo4j console is a service. Am I correct?

Also, in the original question, I also have a database running via Desktop. So both the server and the service should already be running as well? But Invoke-Neo4j console still says that the server is not running. Why is that?

Also, when I run cypher-shell.bat, which username I should put in? I suppose the default one is neo4j, but where are the usernames listed?

Neo4j Desktop is an application which manages servers. You can install, start, stop Neo4j DBMS servers using Neo4j Desktop.

Invoke-Neo4j console is a powershell command for starting a Neo4j DBMS server (not a service). The console means that the DBMS will use a terminal window for writing operational information. It also means that closing the terminal window will stop the DBMS.

To run a Neo4j DBMS as a service on Windows, you would use bin\neo4j install-service as described in Windows installation - Operations Manual .

I would not recommend mixing each of these methods for running the database, as they're not suited for working together. You should pick one of:

  1. Neo4j Desktop
  2. Neo4j with PowerShell
  3. Neo4j as a windows service
  4. Neo4j with Docker
  5. Neo4j Aura :slight_smile:

Regarding usernames, the neo4j username is the only name that always exists. It is the root user, or dbms administrator account. Listing other usernames is only possible after logging in. For details about user management, take a look at Managing users - Cypher Manual .

Hope that helps.

Best,
ABK

I have two directories of Neo4j, one is from Neo4j Desktop (folder A), and one I download from community server (folder B). The shell and the service running the those folder will be respectively called as shell A and service A, shell B and service B.

  1. It seems that services don't run globally? I open shell A and start service A, and in shell B it says Neo4j is not running. It's the same if I stop service A and start service B: shell A says Neo4j is not running.

  2. Nevertheless, if I start service A not service B, in shell B running cypher-shell can still ask for the username and password. The reverse is the same: if I start service B not service A, in shell A running cypher-shell can still ask for the username and password. Why is that?

  3. Now if I open Desktop, then start service B, then it only runs for a moment before stopping. I suppose this is an expected behavior to avoid clashing. However, service A doesn't stop. I wonder why is that?

Two more questions regarding the versions of Neo4j:

  1. If creating and starting database are Enterprise Edition features, then how I can import sample databases?
  2. What is the difference between Neo4j with PowerShell and Neo4j as a service? Surely both will need to be run in a shell, right?

Pardon me if I ask too many questions. It's quite confusing to me.

Hello, do you still have an interest in this topic?

I ask the first three questions in new post: What happens if you have two directories of Neo4j?

Hi @Ooker ,

  1. On the server-side: Each mechanism for launching Neo4j is only aware of itself. There is no global state through which the DBMSes can check with each other.

  2. On the client-side: cypher-shell makes assumptions about the default hostname and port for a neo4j database. It will connect to whatever DBMS server is running at the hostname and port, regardless of how that server was launched.

  3. Neo4j Desktop attempts to manage port conflicts. It monitors a DBMS when you click "start" to ensure that it is running, and to look for port conflicts as one reason the DBMS may fail to start. When that is a problem Desktop will offer to start Neo4j on a different port by rewriting the neo4j.conf file. You can see this behavior by first starting a DBMS manually from the command line, and then starting a DBMS from within Desktop.
    Conversely, a manually started Neo4j DBMS will only use the ports that are specified within the neo4j.conf file. Neo4j DBMS itself will realize there is a port conflict but will not attempt to change ports. It only uses the port specified. The result is that a port conflict will prevent Neo4j DBMS from starting.

Hope that helps!

Best,
ABK

Thanks for your answer. I understand now.

@andrew_bowman also answer this question, and I will copy here for anyone interested:

  1. I assume you were using neo4j status to check if Neo4j is running. When Neo4j is launched via neo4j start , it creates a file with the pid of the launched process (this file is removed when neo4j stops), and neo4j status looks for that file for that specific instance, and if it finds it, double-checks that it's running, and at that point it knows that its neo4j is running. If neo4j status is run on a different instance, since neo4j was not started for that instance, it has no file to reference with the pid, so it believes neo4j is not running. If you are starting neo4j from a service or systemd or similar, then you should not use neo4j status , and should use the service instead to determine if neo4j is running.
  2. cypher-shell doesn't look for any pid files. It is only looking to make a bolt connection to the given address when invoked (or if not provided, it will default to look for a bolt connection to localhost:7687). So it doesn't matter which neo4j you start, if both are configured for bolt on 7687 on your local machine, cypher-shell will connect.
  3. By default Neo4j, on desktop or standalone, will run on your local machine and will listen for bolt connections on port 7687. If you launch another Neo4j instance that is trying to bind to ports already bound to another running Neo4j instance, that will fail and neo4j will stop. If you want to run two Neo4j instances simultaneously on the same machine, at least one of those instances needs to have its configuration changed so the ports used do not conflict.

As for the difference between Neo4j with PowerShell and Neo4j as a service, checking the Windows installation - Operations Manual I take that by Neo4j with PowerShell you mean the Neo4j PowerShell module. From the conversation with @Mathias R. Jessen in Stack Overflow, I think that besides Invoke-Neo4j console which can start a DBSM server, the rest of the commands from the module (e.g. Invoke-Neo4j start, Invoke-Neo4j status, Invoke-Neo4j install-service, etc) are to work with the service and are the same with the commands from neo4j.bat (e.g. neo4j start, neo4j status, neo4j install-service, etc). I think this mix of commands is to make it convenient to work with one thing, and is also my source of confusion.

Great, I'm glad @andrew_bowman was able to help on that other thread. He is a rockstar.

I agree with your observation about the confusion created by having too many options. We have tended to try to make everything possible, but haven't done a good job of clarifying the best place to start. It is the The Paradox of Choice - Wikipedia .

Best,
ABK

I would add that the output "Neo4j is running" is also ambiguous. You may want to clarify it's Neo4j server, Neo4j service or Neo4j database in next version.

If possible, can you explain why do we need to have the PowerShell module when we already have neo4j.bat? Just to be able to run the server in the console? If so, and if we can install the service in the module as well, then why didn't we remove neo4j.bat?