There are two more components we are going to introduce as part of this architecture diagram. They are the vtctlclient and the vtctld server. These two components are simply a pair that forms an HTTP client and HTTP server that enables reads and updates to the topology service.Here we see that customers use the vtctlclient to make calls to the vtctld server. This client-server pair is how users can impact change in the cluster and read state in the cluster. Here are a few examples of what a user would do with vtctlclient- Trigger a reparenting so that a different node is the leader for a shard.- Read metadata regarding the tablets in a shard.- Look up which node is the leader for a shard.- Trigger a resharding workflow.- Mark a node as read only.
AddCellInfo seçeneği
Şöyle yaparız
vtctlclient AddCellInfo \ -root /vitess/cell1 \ -server_address 'localhost:21811,localhost:21812,localhost:21813' \ cell1
ApplyVSchema seçeneği
Örnek
Şöyle yaparız
vtctlclient ApplyVSchema -vschema="{\"sharded\": false,\"tables\": { \"sbtest1\": { }}}" commerce
Örnek - -sql-file
Veri tabanına schema verilir. Yani tablolar yaratılır. En son verilen parametre keyspace ismi
# create the schema
vtctlclient ApplySchema -sql-file create_commerce_schema.sql commerce
Örnek - -vschema_file
vschema yaratılır. En son verilen parametre keyspace ismi
# create the vschema
vtctlclient ApplyVSchema -vschema_file vschema_commerce_initial.json commerce
Backup seçeneği
Şöyle yaparız
vtctlclient Backup zone1 ...
InitShardMaster seçeneği
Belirtilen vttablet'i master yapar. Şöyle yaparız.
vtctlclient InitShardMaster -force commerce/0 zone1-100
InitShardPrimary Seçeneği
Örnek
Belirtilen isme sahip vttableti primary yapar
# set one of the replicas to primary
vtctlclient InitShardPrimary --force commerce/0 zone1-100
Örnek
Şöyle yaparız. Tablet ismine listalltablets ile bakarız/vt/bin/vtctlclient --server :15999 InitShardPrimary --force adv/- az1-0066013393 W0905 10:00:48.721286 233 flag.go:123] Detected a dashed argument after a positional argument. Currently these are treated as posargs that may be parsed by a subcommand, but in the next version of Vitess they will be parsed as top-level flags, which may not be defined, causing errors. To preserve existing behavior, please update your invocation to include a "--" after all top-level flags to continue treating --force as a positional argument. 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
listalltablets seçeneği
Örnek
Şöyle yaparız
# vtctlclient listalltablets zone1-1817996704 newsbtest - primary 10.244.3.235:15000 10.244.3.235:3306 [] 2021-11-18T12:27:19Z zone1-3154448388 newsbtest - replica 10.244.1.6:15000 10.244.1.6:3306 [] <null> zone1-3896337564 newsbtest - replica 10.244.2.195:15000 10.244.2.195:3306 [] <null>
TabletExternallyReparented seçeneği
Belirtilen vttablet'i master yapar. Şöyle yaparız
$ vtctlclient TabletExternallyReparented zone1-401
Hiç yorum yok:
Yorum Gönder