Hub.db.type usage

Hello, members.

Could someone tell me about hub.db.type database feature?

  1. What pod uses this database?
  • This database is used by the pod hub-XXXX only. Correct?
  1. Q2: User preferences.
  • Does this database save user preference? (i.e: User’s Terminal Themes)
  • Does this database can refresh(reinitialize) by helm update? If a user saves Terminal Themes and then the database crashes this database, Is the preference lost?
  1. sqlite-pvc, MySQL, or PostgreSQL.
  • Can I use sqlite-pvc for many user J2ZH environments(around 100-200 users.), Or Should I use MySQL or PostgreSQL?
  1. Reclaim policy.
  • Should I use the StorageClass reclaimPolicy: retain for this database If I use sqlite-pvc?

Best regards.

The JupyterHub database exclusively stores information about:

  • user names, group membership, and permissions
  • API tokens
  • running servers

That’s it. Nothing about user preferences or directories live there.

Completely losing the hub database, generally has the consequences:

  • losing any runtime changes to users (e.g. users and groups changed via the admin panel)
  • invalidating all user sessions, forcing relogin
  • invalidating all API tokens (if any tokens are issued manually, they will need to be replaced)
  • losing track of running servers, forcing manual cleanup of running user pods, if any (user volumes should not be affected).

So assuming you don’t manually add/remove/edit users and all servers are stopped, for most JupyterHub deployments there are approximately no user-visible consequences of completely erasing the JupyterHub database and starting fresh other than needing to login again.

yes, this is only the hub state, it is not involved in any user sessions.

No, it is only the hub’s internal state. Nothing related to jupyterlab or anything running in the single-user session is in the database. That would all be in the user’s persisted home directory volume.

Not generally. There may be a database schema upgrade when there is a major jupyterhub version bump, but that’s it.

sqlite-pvc is usually fine. ‘real’ databases provide nicer backups and monitoring, but jupyterhub’s db use isn’t particularly intense.

That would be sensible if you want to make extra sure things don’t get lost, but unlikely to come up. In most cases, when you delete the pvc it’s because you are uninstalling jupyterhub. See above for the consequences of losing the hub database, which isn’t usually a big deal.

Hello, @minrk. Thank you for your comment. I figured it out.