Phriction Welcome Phacility Cluster Documentation Migrating Repository Shards History Version 2 vs 4
Version 2 vs 4
Version 2 vs 4
Edits
Edits
- Edit by epriestley, Version 4
- Dec 8 2021 9:39 PM
- Edit by epriestley, Version 2
- Sep 28 2019 2:59 PM
Edit Older Version 2... | Edit Current Version 4... |
Content Changes
Content Changes
- Create the new shard (`repo123.phacility.net`) and service (`repox123.phacility.net`) following [[ phacility_cluster/adding_hardware/ ]].
- Add the new service (`repox123.phacility.net`) to the instance.
- Disable allocations on the old service (`repox000.phacility.net`).
```
admin/ $ PHABRICATOR_INSTANCE=admin /core/lib/instances/bin/instances set-service-property \
--instance turtle --service repox000.phacility.net --key disable-allocations --value true
```
- Review service configuration in web UI.
- Sync services.
The instance is now running with two repository service shards, and only the new shard accepts new allocations. This is a stable state. From here, we'd like to migrate existing repositories to the new shard.
For each repository (from `bin/repository list`), save the state:
```
src/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services save-repository \
--repository rXYZ --maintenance <message>
```
...then load it on the destination shard:
```
dst/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services load-repository \
--repository rXYZ --file <phid> --activate-device repo123.phacility.net
```
Once this is finished:
- Disable daemons on the old shard.
```
admin/ $ PHABRICATOR_INSTANCE=admin /core/lib/instances/bin/instances set-service-property \
--instance turtle --service repox000.phacility.net --key disable-daemons --value true
```
- Synchronize services.
---
For historical context, see T13393.
High-Level Method
====
```
core/ $ PHABRICATOR_INSTANCE=admin ./lib/instances/bin/instances move \
--instance turtle \
--to repox-abcd1234.phacility.net
```
See also T13630. This script wraps the low-level steps below.
NOTE: This will move **all** instance repositories and disable **all** old repository services.
Low-Level Method
====
- Create the new shard (`repo123.phacility.net`) and service (`repox123.phacility.net`) following [[ phacility_cluster/adding_hardware/ ]].
- Add the new service (`repox123.phacility.net`) to the instance.
- Disable allocations on the old service (`repox000.phacility.net`).
```
admin/ $ PHABRICATOR_INSTANCE=admin /core/lib/instances/bin/instances set-service-property \
--instance turtle --service repox000.phacility.net --key disable-allocations --value true
```
- Review service configuration in web UI.
- Sync services.
The instance is now running with two repository service shards, and only the new shard accepts new allocations. This is a stable state. From here, we'd like to migrate existing repositories to the new shard.
Migrate Repositories (General)
------
Each repository should be migrated individually. There is a general workflow (here) which can migrate any repository, and a simplified workflow (below) which can only migrate observed repositories.
To use the general workflow: for each repository (from `bin/repository list`), save the state:
```
src/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services save-repository \
--repository rXYZ --maintenance <message>
```
...then load it on the destination shard:
```
dst/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services load-repository \
--repository rXYZ --file <phid> --activate-device repo123.phacility.net
```
Migrating Repositories (Observed)
------
In the specific case where a repository is observed (rather than hosted), it can be migrated more simply, by running a single command on the destination host:
```
dst/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services load-repository \
--repository rXYZ --observe --activate-device repo123.phacility.net
```
This will fetch the local working copy from the remote instead of uploading and downloading it.
Finishing Up
------
Once this is finished:
- Disable daemons on the old shard.
```
admin/ $ PHABRICATOR_INSTANCE=admin /core/lib/instances/bin/instances set-service-property \
--instance turtle --service repox000.phacility.net --key disable-daemons --value true
```
- Synchronize services.
---
For historical context, see T13393.
For improvements to observed repositories, see T13600.
High-Level Method
====
```
core/ $ PHABRICATOR_INSTANCE=admin ./lib/instances/bin/instances move \
--instance turtle \
--to repox-abcd1234.phacility.net
```
See also T13630. This script wraps the low-level steps below.
NOTE: This will move **all** instance repositories and disable **all** old repository services.
Low-Level Method
====
- Create the new shard (`repo123.phacility.net`) and service (`repox123.phacility.net`) following [[ phacility_cluster/adding_hardware/ ]].
- Add the new service (`repox123.phacility.net`) to the instance.
- Disable allocations on the old service (`repox000.phacility.net`).
```
admin/ $ PHABRICATOR_INSTANCE=admin /core/lib/instances/bin/instances set-service-property \
--instance turtle --service repox000.phacility.net --key disable-allocations --value true
```
- Review service configuration in web UI.
- Sync services.
The instance is now running with two repository service shards, and only the new shard accepts new allocations. This is a stable state. From here, we'd like to migrate existing repositories to the new shard.
FMigrate Repositories (General)
------
Each repository should be migrated individually. There is a general workflow (here) which can migrate any repository, and a simplified workflow (below) which can only migrate observed repositories.
To use the general workflow: for each repository (from `bin/repository list`), save the state:
```
src/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services save-repository \
--repository rXYZ --maintenance <message>
```
...then load it on the destination shard:
```
dst/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services load-repository \
--repository rXYZ --file <phid> --activate-device repo123.phacility.net
```
Migrating Repositories (Observed)
------
In the specific case where a repository is observed (rather than hosted), it can be migrated more simply, by running a single command on the destination host:
```
dst/ $ PHABRICATOR_INSTANCE=turtle /core/lib/services/bin/services load-repository \
--repository rXYZ --observe --activate-device repo123.phacility.net
```
This will fetch the local working copy from the remote instead of uploading and downloading it.
Finishing Up
------
Once this is finished:
- Disable daemons on the old shard.
```
admin/ $ PHABRICATOR_INSTANCE=admin /core/lib/instances/bin/instances set-service-property \
--instance turtle --service repox000.phacility.net --key disable-daemons --value true
```
- Synchronize services.
---
For historical context, see T13393.
For improvements to observed repositories, see T13600.