# Neo4j admin import functionality

**URL:** <https://community.neo4j.com/t/neo4j-admin-import-functionality/50691>\
**Category:** Import / Export\
**Tags:** import\
**Created:** [January 19, 2022, 7:12am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691 "2022-01-19T07:12:52Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 19, 2022, 7:12am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/1 "2022-01-19T07:12:52Z")

</div>

I am currently using Neo4j Community version 4.3.4.  
I am using apoc.import.json api to import the bulk data to the neo4j database. However, due to performance issues, I am trying to use neo4j admin import which is said to be very performance efficient.

I am using the command as below:  
bin/neo4j-admin import --database=neo4j --nodes=data/WithoutHASHeader.csv,data/nodes.csv --relationships=data/WithHASHeader.csv,data/relation.csv  
I have ensured to place all the required csv files inside data folder and the command works fine and I could see the response as successful.  
However, when i check the neo4j browser, I do not see any nodes or relationships added.  
And when i restart the neo4j, then, neo4j database becomes unavailable and its no longer accessible.  
As the command works only on a newly created database, i am ensuring to delete all the database related files and then execute the command so that the command is working successfully.

As per the explaination given here:

> [@Neo4j-admin import command for community edition](https://community.neo4j.com/t/neo4j-admin-import-command-for-community-edition/38617/2):
>
> @neocsbee Per [Cloud & Self-Hosted Graph Database Platform Pricing | Neo4j Pricing](https://neo4j.com/subscriptions/) , Community Edition is only allowed 1 database and to which the default is named neo4j. It should also be noted that one can only run neo4j-admin import into a empty/new database, as well as the database should not be online. Given Community, one would stop all of Neo4j and then run neo4j-admin import and import into the database named neo4j

It seems like, the command is partially available only for community version. As after executing the command, the CREATE database command is to be issued which is not available in Community version.

Hence my query is,

1. Whether neo4j admin command is fully available in community version?
2. How can the nodes and relationships be seen in the neo4j database after executing the command?

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 19, 2022, 9:22am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/2 "2022-01-19T09:22:18Z")

</div>

If it helps:  
I tried to perform the same example as explained in [Neo4j-admin import - Operations Manual](https://neo4j.com/docs/operations-manual/current/tutorial/neo4j-admin-import/).  
With this, the command exits with the below success message:  
IMPORT DONE in 1s 410ms.  
Imported:  
6 nodes  
9 relationships  
24 properties  
Peak memory usage: 1.004GiB

After that, on restarting the neo4j database, in the neo4j browser, the neo4j database is not selected by default as it always will be.  
and when tried to select neo4j database using the command ":use neo4j", the below error is observed.  
"Database "neo4j" is unavailable, its status is "offline"."

The result of the command - "show databases" is as below:

| name | address | role | requestedStatus | currentStatus | error | default | home |
| --- | --- | --- | --- | --- | --- | --- | --- |
| neo4j | localhost:7687 | standalone | online | offline | An error occurred! Unable to start `DatabaseId{ff89d9fc[neo4j]}`. | true | true |
| system | localhost:7687 | standalone | online | online | | false | false |

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [January 19, 2022, 1:26pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/3 "2022-01-19T13:26:11Z")

</div>

@sumagowrishan

does your logs/debug.log provide details of why the database failed to come online?

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 20, 2022, 8:15am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/4 "2022-01-20T08:15:10Z")

</div>

I did not check the logs. I will check it and update the results.  
However, my doubt is will admin-import work fine on community version?  
I am not able to stop the database or start it using STOP/START DATABASE neo4j command.  
This results in unauthorized admin command error.  
So my doubt is, will the command work fine without stopping the database?

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 20, 2022, 8:59am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/5 "2022-01-20T08:59:42Z")

</div>

[debug.txt](https://community.neo4j.com/uploads/short-url/9g7to7ARlaywJgqWv0BzKGcChU5.txt) (268.4 KB)  
Here is the log file.  
In case if it helps:  
As the import command does not work on a running database, and currently I am using the community edition, I am not able to stop the database using STOP Command. Hence I am deleting the neo4j database content using rm -rf data/database/neo4j/\* command.  
After this, I am executing the admin import command.  
I am not sure if the above rm -rf command is causing the issue.

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [January 20, 2022, 12:28pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/6 "2022-01-20T12:28:55Z")

</div>

@sumagowrishan  
not related to the failure so far, but the debg.log you attach includes

```auto
2022-01-20 05:00:19.335+0000 WARN [o.n.k.i.JvmChecker] The max heap memory has not been configured. It is recommended that it is always explicitly configured, to ensure the system has a balanced configuration. Until then, a JVM computed heuristic of 6643777536 bytes is used instead. If you are running neo4j server, you need to configure dbms.memory.heap.max_size in neo4j.conf. If you are running neo4j embedded, you have to launch the JVM with -Xmx set to a value. You can run neo4j-admin memrec for memory configuration suggestions.
2022-01-20 05:00:19.338+0000 WARN [o.n.k.i.JvmChecker] The initial heap memory has not been configured. It is recommended that it is always explicitly configured, to ensure the system has a balanced configuration. Until then, a JVM computed heuristic of 415236096 bytes is used instead. If you are running neo4j server, you need to configure dbms.memory.heap.initial_size in neo4j.conf. If you are running neo4j embedded, you have to launch the JVM with -Xms set to a value. You can run neo4j-admin memrec for memory configuration suggestions.

```

are there plans to address these warning?

Per [Import - Operations Manual](https://neo4j.com/docs/operations-manual/4.3/tools/neo4j-admin/neo4j-admin-import/)

```auto
However, using the import command of neo4j-admin is generally faster since it is run against a stopped and empty database. This section describes the neo4j-admin import option. For information on LOAD CSV, see the Cypher Manual → LOAD CSV.

```

and the key pieces of above is  
a. the database must be empty  
b. the database must be stopped

You cant simply `rm data/databases/<database>` files.  
Your debg.log reports

```auto
2022-01-20 08:30:50.579+0000 ERROR [o.n.d.d.DefaultDatabaseManager] Failed to start DatabaseId{d16d0e34[neo4j]}
org.neo4j.dbms.api.DatabaseManagementException: An error occurred! Unable to start `DatabaseId{d16d0e34[neo4j]}`.
	at org.neo4j.dbms.database.AbstractDatabaseManager.startDatabase(AbstractDatabaseManager.java:192) ~[neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.dbms.database.DefaultDatabaseManager.startDatabase(DefaultDatabaseManager.java:156) ~[neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.dbms.database.DefaultDatabaseManager.initialiseDefaultDatabase(DefaultDatabaseManager.java:67) ~[neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.dbms.database.DefaultDatabaseInitializer.start0(DefaultDatabaseInitializer.java:39) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.lifecycle.SafeLifecycle.transition(SafeLifecycle.java:124) [neo4j-common-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.lifecycle.SafeLifecycle.start(SafeLifecycle.java:138) [neo4j-common-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:442) [neo4j-common-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:110) [neo4j-common-4.3.4.jar:4.3.4]
	at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:205) [neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:170) [neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:36) [neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:134) [neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:90) [neo4j-4.3.4.jar:4.3.4]
	at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:34) [neo4j-4.3.4.jar:4.3.4]
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Mismatching store id. Store StoreId: StoreId{creationTime=1642667351318, randomId=-1614129228406106886, storeVersion=3471768636287762695, upgradeTime=1642667351318, upgradeTxId=1}. Transaction log StoreId: StoreId{creationTime=1642592237908, randomId=-2040892648800860919, storeVersion=3471768636287762695, upgradeTime=1642592237908, upgradeTxId=1}
	at org.neo4j.kernel.database.Database.handleStartupFailure(Database.java:626) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.database.Database.start(Database.java:523) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.dbms.database.AbstractDatabaseManager.startDatabase(AbstractDatabaseManager.java:188) ~[neo4j-4.3.4.jar:4.3.4]
	... 13 more
Caused by: java.lang.RuntimeException: Mismatching store id. Store StoreId: StoreId{creationTime=1642667351318, randomId=-1614129228406106886, storeVersion=3471768636287762695, upgradeTime=1642667351318, upgradeTxId=1}. Transaction log StoreId: StoreId{creationTime=1642592237908, randomId=-2040892648800860919, storeVersion=3471768636287762695, upgradeTime=1642592237908, upgradeTxId=1}
	at org.neo4j.kernel.recovery.Recovery.validateStoreId(Recovery.java:408) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.database.Database.checkStoreId(Database.java:633) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.database.Database.validateStoreAndTxLogs(Database.java:596) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.kernel.database.Database.start(Database.java:417) ~[neo4j-kernel-4.3.4.jar:4.3.4]
	at org.neo4j.dbms.database.AbstractDatabaseManager.startDatabase(AbstractDatabaseManager.java:188) ~[neo4j-4.3.4.jar:4.3.4]
	... 13 more
2022-01-20 08:30:50.618+0000 INFO [o.n.b.BoltServer] Bolt enabled on 0.0.0.0:7687.

```

suggesting there is issue wth the transactions logs.

To rerun `neo4j-admin import` and use an existing database please rerun `neo4j-admn import` and include argument `--force=true` for which the help text reports

```auto

      --force[=<true/false>] Force will delete any existing database files
                               prior to the import.
                               Default: false

```

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 20, 2022, 3:03pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/7 "2022-01-20T15:03:57Z")

</div>

Thank you very much for the detailed response.  
Regarding two of the above mentioned items:

1. the database must be stopped: This condition can not be met as I am currently using Neo4j Community edition and in this, execution of STOP DATABASE neo4j results in unauthorized command errror.
2. Regarding the --force command, I observed this suggestion in couple of sites and I tried to use the same. However, I get an error saying no such flag.  
 ![--Force flag not found](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/8/a/8af900497fa91c2772127e3216457a6118211e46.jpeg)

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [January 20, 2022, 3:36pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/8 "2022-01-20T15:36:10Z")

</div>

@sumagowrishan

regarding

```auto
the database must be stopped: This condition can not be met as I am currently using Neo4j Community edition and in this, execution of STOP DATABASE neo4j results in unauthorized command errror.

```

as Community edition only allows one 'user' database. Simply stop the entire Neo4j process similar to `bin/neo4j stop`

and with reference to

`--force=true` is a valid argument for `neo4j-admin import`.

I'm confused as initially you reported

> > I am using the command as below:  
> > bin/neo4j-admin import --database=neo4j --nodes=data/WithoutHASHeader.csv,data/nodes.csv --relationships=data/WithHASHeader.csv,data/relation.csv

bur from you screenshot your are now using `neo4j-admin load` ?

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 20, 2022, 3:44pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/9 "2022-01-20T15:44:28Z")

</div>

I am extremely sorry for the wrong image explaining the command flag usage.

 ![--Force flag not found in import](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/2/6/269f38dfdbcfc8abc529c871e321a4b003932388.jpeg)

root@3995e74e1666:/var/lib/neo4j# bin/neo4j-admin import --nodes data/movies.csv --nodes data/actors.csv --relationships data/roles.csv --force=true  
Selecting JVM - Version:11.0.13, Name:OpenJDK 64-Bit Server VM, Vendor:Oracle Corporation  
Unknown option: '--force=true'

USAGE

neo4j-admin import [--expand-commands] [--verbose] [--cache-on-heap  
[=\<true/false\>]] [--high-io[=\<true/false\>]]  
[--ignore-empty-strings[=\<true/false\>]]  
[--ignore-extra-columns[=\<true/false\>]]  
[--legacy-style-quoting[=\<true/false\>]] [--multiline-fields  
[=\<true/false\>]] [--normalize-types[=\<true/false\>]]  
[--skip-bad-entries-logging[=\<true/false\>]]  
[--skip-bad-relationships[=\<true/false\>]]  
[--skip-duplicate-nodes[=\<true/false\>]] [--trim-strings  
[=\<true/false\>]] [--additional-config=]  
[--array-delimiter=] [--bad-tolerance=]  
[--database=] [--delimiter=]  
[--id-type=\<STRING|INTEGER|ACTUAL\>]  
[--input-encoding=] [--max-memory=]  
[--processors=] [--quote=]  
[--read-buffer-size=] [--report-file=] --nodes=  
[[:]...=]... [--nodes=[[:  
]...=]...]... [--relationships=[=]  
...]...

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [January 20, 2022, 3:53pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/10 "2022-01-20T15:53:42Z")

</div>

@sumagowrishan

apologies as `--force=true` was added in 4.3.8 [Neo4j 4.3 changelog · neo4j/neo4j Wiki · GitHub](https://github.com/neo4j/neo4j/wiki/Neo4j-4.3-changelog#438)

your options are either  
a. upgrade to 4.3.8 or later  
or  
b. stop Neo4j

```auto
        rm -rf data/databases/<databaseName>
        rm -rf data/transactions/<databaseName>

```

replacing `<databaseName>` with the actual name of the database

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [January 24, 2022, 9:28am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/11 "2022-01-24T09:28:01Z")

</div>

Thank you @dana_canzano .  
With the above set of commands, I am able to successfully import the data.  
Once again thank you for all the information provided.

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [February 15, 2022, 9:58am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/12 "2022-02-15T09:58:42Z")

</div>

@dana_canzano ,  
I have one follow up query here.  
I am able to import successfully with this. However, I am not able to see the nodes or relationships.  
Could you please let me know if I am missing something in this steps.

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [February 15, 2022, 12:30pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/13 "2022-02-15T12:30:22Z")

</div>

@sumagowrishan

are you able to connect to the database? and upon connecting its simply empty?

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [February 15, 2022, 3:44pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/14 "2022-02-15T15:44:40Z")

</div>

Yes, exactly...  
I am performing below operations:

```auto
echo "neo4j operations"
cd /var/lib/neo4j
bin/neo4j stop
rm -rf data/databases/neo4j/
rm -rf data/transactions/neo4j/
bin/neo4j-admin import --database=neo4j --nodes=/data/nodeheader.csv,/data/nodes.csv --relationships=/data/relationheader.csv,/data/relationships.csv > import.log
tail -6 import.log

```

and then restarting the neo4j process as below:

```auto
echo "Import is done"
NEO4JPID=$(ps -ef | awk '$8=="/jdk/bin/java" {print $2}')

if [-z $NEO4JPID]
then
    echo "No neo4j process"
else
	echo "$NEO4JPID is the neo4j pid"
	kill $NEO4JPID
	sleep 10
	echo "after sleep of ten restarting neo4j"
fi

/neo4j-entrypoint.sh > neo4jLog &

```

And content of neo4j\_entrypoint.sh is as below:

```auto
#!/bin/bash
cd /var/lib/neo4j

#bin/neo4j console
bin/neo4j start

```

After all these, when i refresh the neo4j browser, i am not seeing any data.

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [February 15, 2022, 4:43pm UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/15 "2022-02-15T16:43:07Z")

</div>

@sumagowrishan

1. rather than

```auto
bin/neo4j stop
rm -rf data/databases/neo4j/
rm -rf data/transactions/neo4j/

```

why not simply run cypher statement

```auto
drop database neo4j;

```

and then

```auto
neo4j stop

```

and then post

```auto
neo4j-admin import .... .....
neo4j start

```

and then cypher command

```auto
create database neo4j;

```

---

<div class="post-metadata">

**Author:** ![sumagowrishan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sumagowrishan/32/20993_2.png) [@sumagowrishan](https://community.neo4j.com/u/sumagowrishan)\
**Post date:** [February 16, 2022, 3:11am UTC](https://community.neo4j.com/t/neo4j-admin-import-functionality/50691/16 "2022-02-16T03:11:52Z")

</div>

Drop and Create are not supported as I am using Community Edition.
