You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a guide on how to backup and restore your database using an Infrahub command line tool.
10
-
Please [see this topic](../topics/database-backup.mdx) for the requirements for using the tool and an explanation of how it works.
11
-
12
-
This guide assumes that you cloned the Infrahub repository to your machine, but you can also copy the content of [this tool's Python file](https://github.com/opsmill/infrahub/tree/stable/utilities/db_backup/__main__.py) into a local Python file and run it that way.
13
-
14
-
An alternative to avoid cloning the Infrahub repository is to directly run it through the Infrahub Docker image:
9
+
`infrahubops` is a simple to use tool that allows you to backup and restore an Infrahub instance following the process described [here](#full-backup-and-restore-procedure).
15
10
16
-
```python
17
-
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock registry.opsmill.io/opsmill/infrahub python -m utilities.db_backup
In this example, the "remote" Infrahub database is accessible at `172.28.64.1` and I want to store the generated backup files in the `/infrahub_backups` directory.
29
-
Since the tool starts a helper container, the database may not be directly accessible from Docker depending on your network. You can try using the `--host-network` option:
In this example, I am running the backup command on the same machine that is running the Infrahub Docker containers. In this case, port `12345` must also have been set using the `NEO4J_server_backup_listen__address` environment variable in the Infrahub database container.
In this example, I am restoring `.backup` files that exist in the `/infrahub_backups` directory and my Infrahub database container uses a non-standard port for cypher access: `9876` instead of `7687`.
5. Restarting Infrahub (API servers, then task workers)
81
59
82
-
# Cluster Database backup and restore examples
60
+
##Cluster Database backup and restore examples
83
61
84
62
<EnterpriseBadge />
85
63
86
-
## Cluster topology
64
+
###Cluster topology
87
65
88
66
| Node | Role |
89
67
|------------------|----------|
90
68
|`database`| Leader |
91
69
|`database-core2`| Follower |
92
70
|`database-core3`| Follower |
93
71
94
-
## Context
72
+
###Context
95
73
96
74
We are going to back up the Neo4j database from `database-core2` and restore it on `database-core3`, after having dropped the Neo4j database cluster-wide.
97
75
98
76
:::caution Important
99
77
Always run backup/restore commands as the `neo4j` user inside the container to avoid permission issues with the data files.
All nodes should eventually show the Neo4j database as online.
236
214
237
-
## 📝 Notes
215
+
###📝 Notes
238
216
239
217
- If any node shows as **dirty** or **offline**, check the logs and ensure that the file `/data/databases/neo4j/neostore` exists.
240
218
- Restoring the database on a single node does **not** automatically register it with the cluster.
241
219
You **must** run the `CREATE DATABASE ... OPTIONS { existingData: 'use' }` command to register the restored data properly.
242
220
243
-
# Restore a database cluster backup on a standalone instance (for debug)
221
+
##Restore a database cluster backup on a standalone instance (for debug)
244
222
245
-
## Context
223
+
###Context
246
224
247
225
We are taking a backup from a Neo4j cluster and restoring it on a standalone local Neo4j instance (non-clustered), for the purpose of debugging and data analysis in a safe, isolated environment.
248
226
249
-
## Step 1: Backup from a cluster node <EnterpriseBadge />
227
+
###Step 1: Backup from a cluster node <EnterpriseBadge />
250
228
251
229
The backup was created from a cluster node (either follower or leader) using:
- This process *restores only data* — not cluster roles, replication, or configuration.
312
+
313
+
## Old database backup tool usage guide
314
+
315
+
This is a guide on how to backup and restore your database using an Infrahub command line tool.
316
+
Please [see this topic](../topics/database-backup) for the requirements for using the tool and an explanation of how it works.
317
+
318
+
This guide assumes that you cloned the Infrahub repository to your machine, but you can also copy the content of [this tool's Python file](https://github.com/opsmill/infrahub/tree/stable/utilities/db_backup/__main__.py) into a local Python file and run it that way.
319
+
320
+
An alternative to avoid cloning the Infrahub repository is to directly run it through the Infrahub Docker image:
321
+
322
+
```python
323
+
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock registry.opsmill.io/opsmill/infrahub python -m utilities.db_backup
In this example, the "remote" Infrahub database is accessible at `172.28.64.1` and I want to store the generated backup files in the `/infrahub_backups` directory.
333
+
Since the tool starts a helper container, the database may not be directly accessible from Docker depending on your network. You can try using the `--host-network` option:
In this example, I am running the backup command on the same machine that is running the Infrahub Docker containers. In this case, port `12345` must also have been set using the `NEO4J_server_backup_listen__address` environment variable in the Infrahub database container.
In this example, I am restoring `.backup` files that exist in the `/infrahub_backups` directory and my Infrahub database container uses a non-standard port for cypher access: `9876` instead of `7687`.
Copy file name to clipboardExpand all lines: docs/docs/topics/database-backup.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,11 @@ title: Database backup and restore
4
4
5
5
# Database backup and restore command line interface
6
6
7
+
:::warning
8
+
This topic is about the old backup and restore tool for Infrahub.
9
+
Please refer to the [backup and restore guide](../guides/database-backup) for more information about the new `infrahubops` tool.
10
+
:::
11
+
7
12
Infrahub provides a command-line interface tool to help backup and restore a full Neo4j database. It is designed to be run from almost any host machine and has a much smaller set of requirements than running the full Infrahub application. We use Docker containers to run commands against the Neo4j database to make this tool easier to install.
8
13
9
14
Please see [this guide](../guides/database-backup.mdx) for concrete examples of running backup and restore commands.
0 commit comments