22 Kasım 2021 Pazartesi

Vitess vtctld komutu - Reshard, Failover vs Yani Topology İçindir

Giriş
İki tane kavram var
1. vtctld sunucusu
2. vtctld  komutu

vtctld Sunucusu
 Açıklaması şöyle. Yani topology sunucusuna Http arayüzü açılır. Ekranlar için Vitess Topology Server Ekranları yazısına bakabilirsiniz
vtctld is an HTTP server that lets you browse the information stored in the Topology Service. It is useful for troubleshooting or for getting a high-level overview of the servers and their current states.

vtctld also acts as the server for vtctlclient connections.
vtctld Komutu
Bir başka açıklama şöyle.
- Controls the topology
- Runs ad hoc operations
- API server
- Reads/writes topo
- Uses locks
- Operates on tables
Örnek
Şöyle yaparız
#!/bin/bash

VTDATAROOT="${VTDATAROOT:-${PWD}/vtdataroot}" #???

# Aliases
alias vtctlclient="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp -alsologtostderr"

mkdir -p vtdataroot/tmp

echo "Starting vtctld...."
vtctld \
  -topo_implementation zk2 \
  -topo_global_server_address 'localhost:21811,localhost:21812,localhost:21813' \
  -topo_global_root /vitess/global \
  -log_dir=${VTDATAROOT}/tmp \
  -port=15000 \
  -grpc_port=15999 \
  -service_map='grpc-vtctl' \
  -pid_file $VTDATAROOT/tmp/vtctld.pid \
Topology Server Hataları
Örnek
Şöyle yaparız. Burada 3 tane tablet Topology Server'a bağlanıyor. Ancak sanırım Topology Server bu tabletlerin sağlıklı olduğunu düşünmüyor
$ kubectl logs adv-vitess-cluster-az1-vtctld-a22f4b1a-85b49c8546-f8254 -n rlwy-08 | more
ERROR: logging before flag.Parse: E0902 18:00:47.342808       1 syslogger.go:149] can't connect to syslog
I0902 18:00:47.377930       1 servenv.go:100] Version: 14.0.1 (Git revision 4c118cbe48a33fab1cfdbb21574debeb23e5bcec branch 'HEAD') built on Tue Jul 26 23:14:06 UTC 2022 by vitess@b321e9084996 using go1.18.4 l
inux/amd64
I0902 18:00:47.388983       1 healthcheck.go:281] loading tablets for cells: az1
I0902 18:00:47.389072       1 healthcheck.go:301] Setting up healthcheck for cell: az1
I0902 18:00:47.389331       1 long_polling.go:221] workflow Manager listening to web traffic at /api/workflow/{create,poll,delete}
I0902 18:00:47.389370       1 websocket.go:36] workflow Manager listening to websocket traffic at /api/workflow
I0902 18:00:47.389431       1 grpc_server.go:161] Setting grpc max message size to 16777216
I0902 18:00:47.389450       1 grpc_server.go:340] Building interceptors with 0 unary interceptors and 0 stream interceptors
I0902 18:00:47.389502       1 service_map.go:64] Registering vtctld for grpc, disable it with -grpc-vtctld service_map parameter
I0902 18:00:47.389515       1 service_map.go:64] Registering vtctl for grpc, disable it with -grpc-vtctl service_map parameter
I0902 18:00:47.392611       1 grpc_server.go:242] Listening for gRPC calls on port 15999
I0902 18:00:47.392920       1 unix_socket.go:36] Not listening on socket file
I0902 18:00:47.405388       1 healthcheck.go:343] Adding tablet to healthcheck: alias:{cell:"az1" uid:1330809953} hostname:"10.129.4.27" port_map:{key:"grpc" value:15999} port_map:{key:"vt" value:15000} keyspa
ce:"ADV" shard:"-" key_range:{} type:REPLICA db_name_override:"vt_ADV" mysql_hostname:"10.129.4.27" mysql_port:3306 db_server_version:"8.0.23" default_conn_collation:45
I0902 18:00:47.408594       1 tablet_health_check.go:111] HealthCheckUpdate(Serving State): tablet: az1-1330809953 (10.129.4.27) serving false => false for ADV/- (REPLICA) reason: healthCheck update error: vtt
ablet error: tabletserver uninitialized
I0902 18:01:47.396059       1 healthcheck.go:343] Adding tablet to healthcheck: alias:{cell:"az1" uid:4135592426} hostname:"10.128.2.21" port_map:{key:"grpc" value:15999} port_map:{key:"vt" value:15000} keyspa
ce:"ADV" shard:"-" key_range:{} type:RDONLY db_name_override:"vt_ADV" mysql_hostname:"10.128.2.21" mysql_port:3306 db_server_version:"8.0.23" default_conn_collation:45
I0902 18:01:47.396174       1 healthcheck.go:343] Adding tablet to healthcheck: alias:{cell:"az1" uid:3415112598} hostname:"10.129.2.27" port_map:{key:"grpc" value:15999} port_map:{key:"vt" value:15000} keyspa
ce:"ADV" shard:"-" key_range:{} type:REPLICA db_name_override:"vt_ADV" mysql_hostname:"10.129.2.27" mysql_port:3306 db_server_version:"8.0.23" default_conn_collation:45
I0902 18:01:47.402283       1 tablet_health_check.go:111] HealthCheckUpdate(Serving State): tablet: az1-3415112598 (10.129.2.27) serving false => false for ADV/- (REPLICA) reason: healthCheck update error: vtt
ablet error: no replication status (errno 100) (sqlstate HY000)
I0902 18:01:47.402931       1 tablet_health_check.go:111] HealthCheckUpdate(Serving State): tablet: az1-4135592426 (10.128.2.21) serving false => false for ADV/- (RDONLY) reason: healthCheck update error: vtta
blet error: no replication status (errno 100) (sqlstate HY000)



Hiç yorum yok:

Yorum Gönder

CREATE EVENT - Scheduled Task İçindir

Örnek Şöyle yaparız CREATE EVENT myevent     ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR     DO       UPDATE myschema.mytable SET myc...