How to Cleanly shutdown database in neo4j - neo4j

I want to import some database at my neo4j local server. I unpacked data from archive do data/databases change active.db and allow_format_migration had changed to true.
But now when I use bin/neo4j start I had error in log/neo4j. There are many lines but I think problem is with it:
Please see the attached cause exception "The database is not cleanly shutdown. The database needs recovery, in order to recover the database, please run the old version of the database on this store.".
What I did wrong?

I've read ton's of information and found the answer.
Just need to delete transaction files inside your database folder and run neo4j.

Related

Using Informix's onpladm command to backup and restore

I have created a script, with your help to backup and restore an Informix database HERE. As I'm new to Informix, I used dbimport and dbexport.
Now I found out about the onpladm command and I found that it can be used to create, load, or unload all tables in a database.
Can anyone explain how it works and what are the benefits of using it instead of dbimport/dbexport?

Neo4j import tool (Bulk) - Why is the restart required?

This question came up on our team a few times.I don't know the real answer.
Can someone point out in the right direction to better understand why restart is needed after bulk importing CSV files?
Or is there an option to tell neo4j to silently point to new DB folder and no restart?
Cheers!
The import utility creates a previously non-existent database. Offline (that's the whole point), so Neo4j can not be running on that database and the resulting folder can not exist beforehand. So even if you use the default folder name (graph.db) you have to start Neo4j after the import. Or change neo4j.conf to point to the newly created folder and then start Neo4j. Either way you have to start/restart Neo4j ... changes to the configuration are not picked up by the software.
Hope this helps,
Regards,
Tom

How do I recover from TransactionFailureException?

Something went wrong with the application in the middle of a transaction (the thread was killed, which resulted in a ThreadDeath etc.), so the transaction failed, but no new transaction could be started after:
org.neo4j.kernel.api.exceptions.TransactionFailureException:
Kernel has encountered some problem, please perform neccesary action (tx recovery/restart)
What are the actions I should undertake to deal with this issue?
Update: I forgot to mention that I have encountered this type of error before and managed to (at least temporarily) fix it by deleting transaction log files. But now, apparently, there aren't any *nioneo* (IIRC) files in the neo4j data directory at all! Did the location or names of log files change? Or am I missing something? There are neostore.transaction.db.x files, which, upon grepping seem to contain chunks of my data. I did start the fresh instance of the application (fortunately that was a test), so I can't check it now, but if I deleted them, would I be able to restart an app from the previous state?
One of the improvements in Neo4j 2.2 was the unification of transaction logs, those are now in neostore.transaction.db.x.
In case the db does not start any more you can try to remove them (but be sure to keep a backup copy) and restart the database. However try a restart with these files in place beforehand. If the presence of transaction logs causes the database not to start up I would consider this being a bug.

neo4j cluster: No such log version

I try use neo4j HA cluster (neo4j 2.0.1), but I got error "No such log version: ..." after database copied from master.
I deleted all *.log files, but it was not help for me.
Can you help me with this problem?
TIA.
"Log" in Neo4j refers to the write-ahead-log that the database uses to ensure durability and consistency. It is stored in files named something like nioneo_logical_log.vX, where X is a number. You should never delete these files manually, even if the database is turned off, this may lead to data loss. If you wish to limit the amount of disk space used by neo for logs, use this configuration:
keep_logical_logs=128M
The error you are seeing means that the database copied cannot perform an incremental update to catch up with the master, because the log files have been deleted. This may happen normally, if the copy is very old, or if you have keep_logical_logs set to false.
What you need to do to resolve this is to set keep_logical_logs to some value that makes sense to you, perhaps "keep_logical_logs=2 days" to keep logs up to two days old around. Once you've done that, you need to do a new full store copy on your slave, which can be triggered by shutting the slave off, deleting the database folder (data/graph.db), and starting the slave back up again.
Newer versions of Neo will do this automatically.

Scheduling a Rails task to safely backup the database file

I have a Rails application on a Windows Server 2008 machine. The application uses a sqlite database, and I need to backup it once a day. The backup should be done by coping the database file to a mirrored folder, and a mirror-backup service will take it from there.
There is one problem. I would like to avoid copying the database file while the application uses it. If I copy the file in the middle of an action, I'll get a corrupted and\or locked database file in the backup - and restoring such a file is too much trouble, if it's even possible.
Now, is there a make the scheduled task wait until the database is not in use? Or to prevent the rest of the application from using the database while the backup task is running?
As for the scheduling, I've seen several solutions, but I haven't committed to a scheduling solution yet, so it's possible for me to depend on a scheduling-solution feature to solve the backup problem.
I would suggest using the SQLite Command Line Shell:
sqlite3 /path/to/live.db '.backup /backup/path.db'
This will allow you to backup without causing regular DB operations to fail. From the documentation:
The copy operation may be done incrementally, in which case the source
database does not need to be locked for the duration of the copy, only
for the brief periods of time when it is actually being read from.

Resources