Unbind

Databases

Create and manage databases next to your services.

Unbind creates and runs databases for you. Open the command panel, pick Database and choose one:

DatabaseVersionsDefault
PostgreSQL14, 15, 16, 17, 1818
MySQL8.0, 8.48.4
Redis8.4, 8.6, 8.8, 8.108.10
MongoDB7.0, 8.0, 8.2, 8.3, 9.09.0
ClickHouse24.12, 25.5, 26.3, 26.5, 26.7, 26.8, 26.926.8

Pick the version and the storage size, then press Deploy. Storage starts at 1 GB. You can grow it later, but not shrink it.

Connect a service to it

A database publishes its connection details as variables that other services can reference. You never copy a password by hand.

On the service that needs the database, add a variable, type $ in the value and pick the database's URL from the list:

DATABASE_URL=${Postgres.UNBIND_DATABASE_URL_PRIVATE}

Use the private URL. It works only from inside your Unbind instance and never leaves it. See Variables for how references work.

The username, password and default database name are managed by Unbind. They show up on the database service as protected variables, and they cannot be edited or deleted.

Reach it from outside

Databases are private by default. To connect from your laptop or an outside tool, open the database's settings and set Network Access to Public. The database then also gets a public address and a public URL variable.

Public means public

Anyone on the internet can try to connect. Only the password protects the data. Switch back to Private when you are done.

Public connections are encrypted

A public database serves TLS with a self-signed certificate, so the password and the data never cross the internet in plain text. The public URL already asks for encryption without verifying the certificate. The private URL stays plain text: it never leaves your Unbind instance.

DatabasePublic URLNotes
PostgreSQLsslmode=require
MySQLunchangedMySQL clients negotiate TLS on their own. The server always offers it.
Redisrediss://Most Redis clients verify certificates. Tell yours to skip verification, for example redis-cli --tls --insecure.
MongoDBtls=true&tlsAllowInvalidCertificates=true
ClickHousesecure=true&skip_verify=true, https:// for HTTPcurl needs -k.

Redis, MongoDB and ClickHouse start their TLS listener when you set Network Access to Public, which restarts the database once. Switching back to Private restarts it again. PostgreSQL and MySQL always have TLS on and do not restart.

Backups

Backups go to an S3 compatible bucket. First add a bucket to the team. Then, in the database's settings under Backups:

  • Backup Bucket: where backups are stored.
  • Backup Schedule: every hour, every 6 or 12 hours, daily, weekly, or a custom cron expression like 0 3 * * *.
  • Backup Retention: how many backups to keep. Older ones are deleted.

Backups are available for every database.

Restoring

There is no restore button in the UI yet. The backups are standard files in your bucket, written by the backup tools of each database. Test a restore before you need one.

Restore Redis

Redis backups are snapshot files in the bucket, at <service id>/backups/<name>/<time>.rdb, named by the UTC time they were taken. Writes made after a backup ran are not in it.

To put one back on its Redis, you need access to the server.

  1. Download the backup from your bucket to the server as backup.rdb.

  2. Copy it onto the Redis volume. <name> is the folder name from the bucket path. The first command shows the <namespace>.

    sudo kubectl get pods -A | grep <name>-0
    sudo kubectl cp backup.rdb <namespace>/<name>-0:/data/restore.rdb -c redis
  3. Swap it in and restart Redis:

    sudo kubectl exec -n <namespace> <name>-0 -c redis -- sh -c '
      export REDISCLI_AUTH=$REDIS_PASSWORD
      redis-cli CONFIG SET appendonly no
      redis-cli CONFIG SET save ""
      rm -rf /data/appendonlydir
      mv /data/restore.rdb /data/dump.rdb'
    sudo kubectl delete pod -n <namespace> <name>-0

Redis starts with the data from the backup, and the Append-Only File setting applies again. Everything in Redis before the restore is replaced, including writes that arrive during these steps.

PostgreSQL replication settings

PostgreSQL has a Database section in its settings with WAL Level. Leave it on replica unless a tool asks for logical replication, such as change data capture. With logical you can also set Replication Slots, WAL Senders and Slot WAL keep size.

Slot WAL keep size limits how much WAL a replication slot can keep when its subscriber falls behind. Without a limit, one idle subscriber can fill the volume and stop the database. Leave it empty to use Auto, a quarter of the volume, which grows when you expand the volume. You can set it anywhere from 64 MB to half of the volume. If a subscriber falls further behind than the limit, PostgreSQL drops its slot and the subscriber has to sync again. Clear the field to go back to Auto.

Redis persistence

Redis keeps its data in memory and writes it to the volume. Its Database section has an Append-Only File toggle. With it on, Redis logs every write and syncs the log once a second, so a crash loses at most about a second of writes. With it off, Redis only saves snapshots: one when at least 10000 keys changed in a minute, 100 in five minutes or 1 in an hour. A crash then loses everything since the last snapshot.

New Redis databases have it on. Redis databases created before the setting keep snapshots only until you turn it on. Turn it on for anything that keeps state you cannot rebuild, such as job queues or balances.

Changing it restarts the database. Before Redis starts, Unbind converts the data on the volume to the new format, so nothing is lost either way. A large dataset takes longer to start while it converts.

The append-only file protects against a crash, not against losing the volume. For an off-site copy, turn on backups.

On this page