Using the Neo4j Shell with Embedded Neo4j

· 1 min read

Our earlier blog post talked about using the Neo4j web browser along with embedded Neo4j. The WrappingNeoServerBootstrapper which was employed to do this has been deprecated for a while and it raises questions about the alternative.

Testing server extensions is now possible (see Testing your extension) but there is still another use case for wanting to connect to an embedded graph - troubleshooting.

Perhaps you have a web application running in production with Neo4j in embedded mode and you’ve got to troubleshoot an issue which requires access to the graph - how do you do this against a live graph?

Well, there is another option which won’t give you access to the pretty browser, but it will allow you to run queries via the shell.

Enable the remote shell


    GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(DB_DIR)
                    .setConfig(ShellSettings.remote_shell_enabled, "true")
                    .setConfig(ShellSettings.remote_shell_port, "5555")
                    .newGraphDatabase();

Now we have the shell enabled, connect to your graph using

    neo4j-shell -port 5555

Don’t want to modify data by mistake? Start the shell in read only mode with


    .setConfig(ShellSettings.remote_shell_read_only, "true")

Of course, make sure that access to the shell is controlled. By default, the shell listens only on the loopback interface but it can be configured to listen on another IP by setting the value of ShellSettings.remote_shell_host

Luanne Misquitta

Engineering | Neo4j certification

Luanne Misquitta is an engineering leader with over 20 years of experience in start-ups and enterprises, both consulting and product oriented. She is widely recognised as one of the world's most experienced Neo4j consultants, having successfully implemented numerous projects in the field. Luanne has a track record of growing customer-focused, high-performing engineering teams and believes in lean principles driving engineering excellence.