TheHiveDocs icon indicating copy to clipboard operation
TheHiveDocs copied to clipboard

Backup The Hive 4 Cassandra database and transfer to new The Hive 4 server

Open trinksie opened this issue 3 years ago • 4 comments

Hello! I have been reading through the current Backup/Restore procedure [1] which clearly states that this "[...] has only been tested on single node Cassandra server". What, however, if you want/need to backup the Cassandra database (i.e. create a snapshot) of an existing The Hive 4 server, transfer it to a newly deployed (vanilla) The Hive 4 server and restore it there? Or picture the scenario that you have created backups (snapshots) on your existing The Hive 4 server and that server (bare metal/vm) crashes and needs to be re-deployed from scratch?

I have tested the current Backup/Restore procedure [1] as per backing up on existing The Hive 4 server and attempting to restore on newly deployed The Hive 4 server (identical setup/configuration as existing/working The Hive 4 server to import from) and as expected it fails, with all sorts of schema issues and scalligraph errors when trying to start The Hive 4 on the newly deployed The Hive 4 server.

Do you have a suggested and verified approach how to export/snapshot a The Hive 4 Cassandra database on an existing/working server and transfer/restore it on a newly deployed The Hive 4 server? Any suggestions welcome...

Thank you.

[1] https://github.com/TheHive-Project/TheHiveDocs/blob/master/TheHive4/Administration/Backup_Restore.md

trinksie avatar Mar 25 '21 06:03 trinksie

Having the same exact issue.

samsplunks avatar May 06 '21 14:05 samsplunks

We have improved the procedure, did you try it ? http://docs.thehive-project.org/thehive/operations/backup-restore/

jeromeleonard avatar Feb 10 '22 19:02 jeromeleonard

backup db not worked. i am trying to repeat https://docs.thehive-project.org/thehive/operations/backup-restore/. Moreover, without the contents of the vol/thehive/index/global directory the TheHive initializes a new schema for the database, does not see what was. Also, тoday, i am trying:

  1. get all /data - from Cassandra
  2. deploy new instance TheHive, but use as index - elasticsearch. Not worked. Thus, any attempt to restore a new instance based on existing data from cassandra without indexes(Lucene, Elasticsearch) does not work.

JohnEskimSmith avatar Feb 11 '22 11:02 JohnEskimSmith

We have improved the procedure, did you try it ? http://docs.thehive-project.org/thehive/operations/backup-restore/

I have the same use case mentioned at the beginning of this post. Furthermore the procedure mentioned in the link above seems to be wrong anyway. When you go to the ''restore'' part it says to extract the archive tar jxf /PATH/TO/backup.tbz -C /tmp/cassandra_backup the destination folder is cassandr_backup but the next commands just refer to a folder named cassandra, so it will fail. this for I in ls /tmp/cassandra/var/lib/**cassandra**/data/<KEYSPACE> ; do [...snip...] should be ls /tmp/cassandra/var/lib/**cassandra_backup**/data/<KEYSPACE> same for the remaining part of the procedure and the example script provided where for istance this line seems to be wrong

Restore keyspace

cqlsh -u cassandra -p ${CASSANDRA_PASSWORD} cassandra --file schema_${SNAPSHOT}_${SNAPSHOT_INDEX}.cql

as it contain an extra ''cassandra'' text, after the password variable.

So is there any way to create a snapshot from a live server and restore it to a different one (to keep dB cases aligned in case primary server fail) ? Thanks

ivityc avatar Mar 10 '22 13:03 ivityc