How I can import db(archive) neo4j - neo4j

I have archive(tar.gz) which was dumped from production neo4j server. Now I want to get this db locally in my computer. I did it in several steps:
I was maked this command: neo4j-admin load --from=<archive-path> --database=<database> [--force](I did it correct, set path to my archive and gave name for database)
2.When I maked previous command then folder in data/databases appeared, that's cool, I thought
Next I was change active db I changed this value:
dbms.active_database=graph.db.test
And when all must work I typed "./neo4j console" it started in localhost:7474 I see that db is my,for example "test" db but all was empty. No node labels, no relations and when I used simple command "MATCH(n) RETURN n" there are no records. But I totally sure that it's must to be not empty.
Question:
What I did incorrect and what I need to do to make it works?

I believe that you are having problems with the param database and the value of dbms.active_database property.
Try using the same value for both:
bin/neo4j-admin load --from=/backups/graph.db/2016-10-02.dump --database=graph.test.db --force
and
dbms.active_database=graph.test.db
after it, restart Neo4j.

You may try refreshing and re-entering your credentials. Also, it may be the case that your file might not be unzipped properly.

Related

Is there any way to load dump files in Neo4j Desktop 5.1.0 in Windows 11?

I have tried all possible ways to load the pole.dump file into Neo4J :
I have been doing the following for past 3 days now:
Opened the Neo4J Desktop and Using the Add Drop-Down Menu , I have added the pole.dump into the Neo4J Desktop.
Then I have selected the Import dump into existing DBMS -> which is my Graph3 Database.
Then I am going to Neo4J Desktop and from the Database Information, I selected the pole database but I am getting this error
Database "pole" is unavailable, its status is "offline".
I also tried this: https://community.neo4j.com/t5/graphacademy-discussions/cannot-create-new-database-from-dump-file/td-p/39914
i. Database-->Open Folder-->DBMS. Here you will see data/dumps folder
ii. Copy pole.dump file to data/dumps folder (Although there is no folder called dumps in the data folder)
iii. Close the browser. Click on ... and select Terminal.
iv. Terminal window shows up. Enter this command:
bin/neo4j-admin load --from=data/dumps/pole.dump --database=pole --force
v. If successful, close the Terminal window and open the db in browser.
vi. Click on the database icon on top left to see the databases from the dropdown box.
Here you will not see pole db.
vii. Select 'system' database. On the right pane run this Cypher:
CREATE DATABASE pole and execute the Cypher.
viii. Run SHOW DATABASES and you should see pole and check the status. Status should be 'online'.
ix. Select pole from the dropdown list. Once selected you should see all the nodes,
relationships on the left. Now you can start playing with it!!
But I could not pass after point iv as it says in the neo4j terminal if I open it from the Neo4J Desktop , that it could not load - in fact it says there is a parsing error.
I did check with the following:
C:\Users\Chirantan\.Neo4jDesktop\relate-data\dbmss\dbms-11aabb23-daca-4d35-9043-6c039d133a34\bin>neo4j-import Graph3 load --from=data/dumps/pole.dump
'neo4j-import' is not recognized as an internal or external command,
operable program or batch file.
I am coming to this platform because I have tried everything available:
https://neo4j.com/docs/operations-manual/current/tools/neo4j-admin/
'neo4j-admin' is not recognized as an internal or external command, operable program or batch file
https://www.youtube.com/watch?v=HPwPh5FUvAk
But could not get any luck.
After step 3, which is:
Then I am going to Neo4J Desktop and from the Database Information, I selected the pole database but I am getting this error
Did you try to start the database with the following command?
START DATABASE pole;
I have already solved the problem. The issue was existent even after I followed the steps provided in the OP. What I did was: I created random texts for all records for names of criminals/victims, friends of victims, friends of criminals, generated random phone numbers, generated random nhs numbers, also generated random addresses using :
https://fossbytes.com/tools/random-name-generator
https://www.randomlists.com/london-addresses?qty=699
Using this code I generated random nhs ids :
import string
import random
# initializing size of string
N = 7
list_str= []
for i in range(699):
# using random.choices()
# generating random strings
res = ''.join(random.choices(string.ascii_uppercase +
string.digits, k=N))
list_str.append(res)
Random Phone Number generated using:
https://fakenumber.in/united-kingdom
There is a better answer.
Go to this url : https://neo4j.com/sandbox/
Then Select the Pre-Installed Databases that come with sandbox- Crime Investigation being one of them with the POLE Database pre-installed.
You will be prompted to open the HOME from there with the POLE Database pre-installed.
You Finally open the Neo4J Browser from here using the drop down menu by pressing the Open Button and access the Neo4J Browser and voila! You can access POLE database using Neo4J

Cannot alias database connection string in conf/neo4j.conf when using apoc.load.jdbc()

I have neo4j installed using docker-compose and successfully enabled apoc plug-in.
I'm able to use call
apoc.load.jdbc("hard-coded-db-connection-string", "my-table")
to retrieve data from my database which is good.
Of course, this is not convenient, so I tried to alias the connection string by adding below to the conf/neo4j.conf.
apoc.jdbc.mydb.url=jdbc:postgresql://"hard-coded-db-connection-string
and then restarted the container. However i can't call the apoc using the alias and I see a message in the log:
Unrecognized setting. No declared setting with name: apoc.jdbc.mydb.url
I also tried to run below to check the settings in the conf/neo4j.conf file, but the results don't show the alias line i just added.
CALL dbms.listConfig()
YIELD name, value
WHERE name STARTS WITH 'apoc.'
RETURN name, value
ORDER BY name
;
Wondering can someone help me troubleshooting this? Is this because I was working on the wrong conf file? Thx!
Please try to use an apoc.conf file instead.
Since 4.x neo4j got more restrictive with variable settings In neo4j.conf

Neo4j browser.post_connect_cmd does not work

I run neo4j Version: 3.3.2 in a docker container and tried to configure a default style as described above.
Grass file is accessible via HTTP (http://somedomain.com/resources/style.grass)
CORS rules are set
Command added to config: browser.post_connect_cmd=style http://somedomain.com/resources/style.grass
When i start my container with this config and run match (n) return n i see nothing.
Then i run :style http://somedomain.com/resources/style.grass and it works... Why?
That leads me to conclude that the grass file ifself (content) and the accessible of this file are not the problem.
It seems that there is an error with the default style configuration.
Do you have any tips to debug this? The logs are clean.
I found the problem. We added this property at the end of the neo4j.conf. After startup neo4j reorder the properties, put it at the 2nd place and accidentally add the 3rd property at the end of the 2nd, so that it’s not valid. We put it manually at the 2nd place and now it works.

Error running command oninit -i for Informix on Ubuntu Server

When I call oninit -i command in an Ubuntu server terminal, it shows an error like this:
INFORMIXSERVER does not match DBSERVERNAME or any of the DBSERVERALIASES.FAILED
Can anyone give me a solution for this problem?
What is the setting of $INFORMIXSERVER in your environment, and what values are set for DBSERVERNAME and DBSERVERALIASES in the $ONCONFIG file? It seems that you've set $INFORMIXSERVER to a value that isn't present in the $ONCONFIG file that is in use. Maybe you didn't set $ONCONFIG at all, or maybe you set $INFORMIXSERVER incorrectly, or maybe the names in the $ONCONFIG file are incorrect.
If you don't set $ONCONFIG, it defaults to onconfig (and maybe even falls back to onconfig.std). But you should normally set $ONCONFIG to a known value. I usually use onconfig.<servername> where the <servername> is the value of DBSERVERNAME in the file. However, nothing enforces that convention.
http://www.ibm.com/developerworks/data/library/techarticle/dm-0606bombardier/ is a good tutorial for setting up informix DB, I came up with same issue since my rootdbs file was owned by 'root', not by 'informix', make sure all file that are mentioned in the above tutorial to be owned by user 'informix' are correctly owned.

Simple storage not persisting data between sessions

I'm trying to use the simplestorage from my extension, but I can't retrieve values between browser sessions. Here's the thing: From my main code, I created a value this way:
var ss = require("sdk/simple-storage");
ss.storage.foo = [{id:"bar1", properties:{a:"aaa", b:"bbb"}}]
console.log(ss.storage.foo);
This is ok, I coud see the object through the log. But then I closed the browser, commented the "foo definition" (line 2) and the console log was "undefined".
I know cfx run by default uses a fresh profile each time it runs, so simple storage won't persist from one run to the next. But I'm using
cfx -b firefox run --profiledir=$HOME/.mozilla/firefox/nightly.ext-dev
So I'm sure I'm using the same profile everytime.
What could be happening? What am I missing? Any idea is welcome! Thanks in advance!
Thanks to the answer of Notidart, I could discover that the problem was the file is saved when you close Firefox in the right way. When you just kill it through console, it's not persisting data.
This is how simple storage works. It creates a folder in your ProfD folder which is your profile directory: https://github.com/mozilla/addon-sdk/blob/master/lib/sdk/simple-storage.js#L188
let storeFile = Cc["#mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
get("ProfD", Ci.nsIFile);
storeFile.append(JETPACK_DIR_BASENAME);
storeFile.append(jpSelf.id);
storeFile.append("simple-storage");
file.mkpath(storeFile.path);
storeFile.append("store.json");
return storeFile.path;
The exact location of the file made is in a your profile folder, in a folder named jetpack then your addon id, then a folder called simple-storage, then in a file in that folder called store.json. Example path:
ProfD/jetpack/addon-id/simple-storage/store.json
It then writes data to that file. Every time your profile folder is recreated (due to the nature of temp profile, due to jpm / cfx), your data is erased.
You should just use OS.File to create your own file to save data. OS.File is better way then nsIFile which is what simple-storage does. Save it outside that ProfD folder, so but make sure to remove it on uninstall of your addon otherwise you pollute your users computers
Just in case someone else finds this question while using jpm, note that --profiledir is removed from jpm, so to make jpm run using the same profile directory (and thereby the same simple-storage data), you have to run it with the --profile option pointing at the profile path - not the profile name.
jpm run --profile path/to/profile
For future readers, an alternative to #Noitidart's recommendation of using OS.File, is to use the Low-Level API io/file
You can create a file using fileIO.open(path). If the file doesn't exist, it will be created. You can read and write by including the second argument fileIO.open(path, mode).
The mode can be:
r - Read-only mode
w - Write-only Mode
b - Binary mode
It defaults to r. You can use this to read and write to a file (obviously the file cannot be in the ProfD folder or it will get removed each time jpm / cfx is run)

Resources