A typical scenario is when a user sets up ZK with a chroot /solr, runs Solr and then restarts Solr without specifying the chroot. In the default legacyCloud mode, Solr will happily start and create all ZK nodes as well as collections found on the local cores.
I've been bit many times by this and so have more than a few Solr users. In a private discussion, Hoss gave the following idea:
- We add a command to bin/solr to "prepare" ZooKeeper that accepts the zk host string
- The command creates the chroot if it does not exist
- Touches /my-chroot/solr.key file
- Writes the complete zk host in the solr.in.sh or solr.in.cmd file
Once we do this, Solr will complain and fail fast if the solr.key file is not found in the given chroot. We could also write a fixed string in the /my-chroot instead of creating a /my-chroot/solr.key file.
We can do these things automatically when using embedded ZooKeeper.