Skip to content

Jiva CLI

Kiran Mova edited this page Jan 31, 2020 · 1 revision

Start replica on host network

docker run -d -it --network="host" -P --expose 9502-9504 -v /mnt/stor1:/stor1 <openebs/jiva:ImageTag> launch replica --frontendIP <frontendIP> --listen <ReplicaIp>:9502 --size <size> /stor1

/mnt/stor1 -- Storage for replica

Start controller on public network with one replica

docker run -d --network="host" -P --expose 3260 --expose 9502-9504 --expose 9501 <openebs/jiva:ImageTag> launch controller --frontend gotgt --frontendIP <frontendIP> --replica tcp://<Replica IP>:9502 <vol-name>

Start controller on public network with multiple replicas

docker run -d --network="host" -P --expose 3260 --expose 9502-9504 --expose 9501 <openebs/jiva:ImageTag> launch controller --frontend gotgt --frontendIP <frontendIP> --replica tcp://<Replica1 IP>:9502 --replica tcp://<Replica2 IP>:9502 <vol-name>

Add a replica from the controller (Not needed any more, replicas automatically register themselves at controller)

docker exec -it <Controller's Container ID> longhorn add-replica tcp://<Replica IP>:9502

List replicas

docker exec -it <Controller's Container ID> longhorn replica ls

Remove a replica to the controller

docker exec -it <Controller's Container ID> longhorn rm-replica tcp://<Replica IP>:9502

Create snapshot

docker exec -it <Controller's Container ID> longhorn snapshot create <snapshot name> 

List snapshots

docker exec -it <Controller's Container ID> longhorn snapshot ls

Revert to snapshot

docker exec -it <Controller's Container ID> longhorn snapshot revert <snapshot name>

Backup a snapshot to S3

All the replica containers should be updated with aws credentials for the backup and restore to work.

https://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html

docker exec -it <Controller's Container ID> longhorn backup create <snapshot name> --dest s3://backup-bucket@us-west-2/

Keep a note of the destination URL returned while running the above command.

Restore a snapshot from S3

docker exec -it <Controller's Container ID> longhorn backup restore <S3 URL>

In the above command replace the '&' in S3 URL with its unicode equivalent '\u0026'

For Example, Destination Used

s3://backup-bucket@us-west-2/demonew/

URL Returned

s3://backup-bucket@s-west-2/demonew?backup=backup-32eb9a0de5624d1a&volume=demostore

S3 URL to be used for restore

s3://backup-bucket@s-west-2/demonew?backup=backup-32eb9a0de5624d1a\u0026volume=demostore