Giriş
vtctd poduna bash açılır. Şöyledir
kubectl exec -it adv-vitess-cluster-az1-vtctld-a22f4b1a-7c5c697f69-ggng2 -- /bin/bash
Ya da alias tanımlayarak şöyle yaparız
alias vc='kubectl exec -it $(kubectl get pod -l "planetscale.com/component=vtctld" -o jsonpath="{.items[0].metadata.name}" -n rlwy-08) -n rlwy-08 -- /vt/bin/vtctlclient \ --server $(kubectl get svc -l "planetscale.com/component=vtctld" -o jsonpath="{.items[0].metadata.name}" -n rlwy-08):15999' vc ListBackups ope/-
ListBackups seçeneği
En son backup dosyası en altta listelenir
1. Tableti Primary Yapmak
Önce tabletlere bakalım
$/vt/bin/vtctlclient --server :15999 listalltablets
Şöyle yaparız. Burada tablet önce master yapılıyor. Daha sonra BackupShard ve ListBackups yapılıyor
$ /vt/bin/vtctlclient --server :15999 InitShardPrimary --force adv/- az1-0066013393 ... W0905 10:00:48.749063 233 main.go:94] W0905 10:00:48.748394 server.go:1781] primary-elect tablet az1-0066013393 is not the shard primary, proceeding anyway as -force was used W0905 10:00:48.749106 233 main.go:94] W0905 10:00:48.748431 server.go:1787] primary-elect tablet az1-0066013393 is not a primary in the shard, proceeding anyway as -force was used vitess@adv-vitess-cluster-az1-vtctld-a22f4b1a-7cd44588fd-5cjr6:/$ $ /vt/bin/vtctlclient --server :15999 BackupShard adv/- $ /vt/bin/vtctlclient --server :15999 ListBackups adv/- 2022-09-05.085540.vtbackup-1311431053 2022-09-05.100424.az1-4018497418
Örnek - Hatalı Durum
Şöyledir
$ /vt/bin/vtctlclient --server :15999 BackupShard ADV/- BackupShard Error: rpc error: code = Unknown desc = ReplicationStatus(az1-1330809953) failed: rpc error: code = Unknown desc = TabletManager.ReplicationStatus on az1-1330809953 error: no replication status (errno 100) (sqlstate HY000): no replication status (errno 100) (sqlstate HY000) E0901 13:07:25.732743 153 main.go:103] remote error: rpc error: code = Unknown desc = ReplicationStatus(az1-1330809953) failed: rpc error: code = Unknown desc = TabletManager.ReplicationStatus on az1-1330809953 error: no replication status (errno 100) (sqlstate HY000): no replication status (errno 100) (sqlstate HY000)
Örnek
Shard kullanmıyorsak şöyle yaparız.
#vtctdlye e bash açkubectl exec -it -n rlwy-07 adv-vitess-cluster-az1-vtctld-a22f4b1a- -- /bin/bash $ /vt/bin/vtctlclient --server :15999 ListBackups ADV/- 2022-09-01.115828.vtbackup-0196944669
Örnek
Şöyle yaparız
# Do backupvc --logtostderr BackupShard ope/-# List backupsvc ListBackups ope/-# create ope-restore keyspace of SNAPSHOT typevc CreateKeyspace ----keyspace_type=SNAPSHOT--base_keyspace=ope--snapshot_time=2022-08-25T07:25:00Z ope-restore# get ope-restore keyspacevc getKeyspace ope-restore
Restore seçeneği
Örnek
Şöyle yaparız
$ vc ListAllTablets region1-1159134015 ope - primary 172.17.0.24:15000 172.17.0.24:3306 [] 2022-08-04T18:16:30Z region1-1626475909 ope - replica 172.17.0.27:15000 172.17.0.27:3306 [] <null> region1-3903730772 ope - replica 172.17.0.25:15000 172.17.0.25:3306 [] <null> $ vc ListBackups ope/- 2022-08-04.181606.vtbackup-4216616067 2022-08-04.182648.region1-3903730772 # run manual restore of replica tablet region1-3903730772: $ vc --logtostderr RestoreFromBackup region1-3903730772
Hiç yorum yok:
Yorum Gönder