vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.53k stars 2.09k forks source link

Some errors while restore #10709

Open Kean9527 opened 2 years ago

Kean9527 commented 2 years ago

When vttablet restore from a backup, I get the error as below: E0716 02:48:00.814471 2520 main.go:42] rpc error: code = Unknown desc = tablet zone1-0000000512 ResetReplication failed (either fix it, or Scrap it): rpc error: code = DeadlineExceeded desc = context deadline exceeded;tablet zone1-0000000511 ResetReplication failed (either fix it, or Scrap it): rpc error: code = DeadlineExceeded desc = context deadline exceeded Then I open Vitess Control Panel web page, I see the tablets with one of types: replica, restore,restore. When I use mysql to query data, I got errors as below: ERROR 1105 (HY000): target: landhall.-80.primary: primary is not serving, there is a reparent operation in progress target: landhall.80-90.primary: primary is not serving, there is a reparent operation in progress target: landhall.90-.primary: primary is not serving, there is a reparent operation in progress How can I fix this? Thanks!

The start script like this: ` tablet_type=replica if [[ "${uid: -1}" -gt 1 ]]; then tablet_type=rdonly fi vttablet \ $TOPOLOGY_FLAGS \ --log_dir /data/log \ --log_queries_to_file $VTDATAROOT/tmp/$tablet_logfile \ --tablet-path $alias \ --tablet_hostname "$tablet_hostname" \ --mycnf_socket_file "$VTDATAROOT/$tablet_dir/mysql.sock" \ --init_keyspace $keyspace \ --init_shard $shard \ --init_tablet_type $tablet_type \ --db_charset utf8mb4 \ --health_check_interval 5s \ --enable_semi_sync \ --enable_replication_reporter \ --backup_storage_implementation file \ --file_backup_storage_root /data/backup \ --backup_engine_implementation=xtrabackup \ --xtrabackup_user="root" \ --restore_from_backup \ --port $port \ --grpc_port $grpc_port \ --service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \ --pid_file $VTDATAROOT/$tablet_dir/vttablet.pid \ --vtctld_addr http://$vtctldhost:$vtctld_web_port/ \

$VTDATAROOT/$tablet_dir/vttablet.out 2>&1 &`

After it started I use command to primary node: vtctldclient InitShardPrimary --force ${KEYSPACE_NAME}/$SHARD $CELL-$START

Kean9527 commented 2 years ago

I use PlannedReparentShard and the problem solved!