MicroticaMicrotica

Database administration

Copy the n8n SQLite database to your machine and connect to the Postgres database locally using kubectl, so you can inspect and manage n8n data.

This guide shows you how to copy the n8n SQLite database to your local machine and connect to the Postgres database from your local environment using kubectl.

Copy the SQLite database locally

To copy the n8n SQLite database from the cloud to your local environment, first set up local access to your Kubernetes cluster.

Next, run the following commands in your terminal:

Terminal
# List all pods in 'microtica' namespace. Replace the namespace if you deployed the service in namespace other then the default 'microtica' namespace.
kubectl get pods -n microtica

# Copy SQLite database locally
kubectl cp microtica/<pod name>:/home/node/.n8n/database.sqlite ~/database.sqlite

This copies the SQLite database locally to ~/database.sqlite.

Connect to the Postgres database

For the n8n application, the Postgres database runs in a separate container.

To connect to the database locally, first identify the pod running the Postgres database:

Terminal
kubectl get pods -n microtica

Next, establish a proxy to the n8n pod running the Postgres database:

Terminal
# Change <pod name> to the name of the Pod
# Use different local port if 5432 is already in use. E.g. 5444:5432
kubectl port-forward pods/<pod name> 5432:5432 -n microtica

Now you can access the database with your preferred client on localhost:5432.

Next steps

On this page