Page MenuHomePhabricator

Cluster documentation leads you slightly awry about "read only mode"
Closed, ResolvedPublic

Description

The database clustering doc prescribes a replica data export method by which you:

  • Turn off the daemons.
  • Turn on read only mode
  • ./bin/storage dump --for-replica
  • Bring stuff back online.

When I ran ./bin/storage dump i got a message that told me I couldn't do that because my database was in read only mode. I might have had a different setup than what you were expecting, and did something not explicitly documented, although I assumed "correct".

  • Turn off daemons
  • Run ./bin/config set cluster.read-only true on both of the machines that were in my setup, I assumed that I should be setting the "read only" flag on all of my phabricator clones (one db node, one web node) since the idea of having two different configs made my spidey sense tingle
  • ./bin/storage dump --for-replica throws an exception

I just turned off the flag on the db node and everything went swimmingly, I'm not sure if this would also manifest itself in a single-node setup.

Event Timeline

epriestley triaged this task as Normal priority.
epriestley added a project: Clusters.

I think I didn't actually do these things, I did a different and more horrible set of things and then wrote these great instructions to avoid all the msitakes I made. I'll attempt to let dump pierce through read-only, or find some other solution if that isn't straightforward.

I was kind of expecting that 'cluster.read-only' would be a database configuration value, not a local configuration value. Otherwise you need to update all nodes in the cluster instead of just setting the flag in the DB. My expectation when the cluster DB is read-only is that only the following operations work:

  • bin/storage related tasks, and
  • bin/config set cluster.read-only false

Prior to D15987, the easiest fix for this was to add --force:

$ ./bin/storage dump ...
Usage Exception: Phabricator is currently in read-only mode. Use --force to override this mode.

However, that's scary and there's no need for us to be scary here. After D15987, we won't prompt/warn when running read-only storage operations (databases, dump, probe, renamespace, shell, status).

You can still run storage write operations in read-only mode with --force.