问题描述
我正在尝试 Vitess 我在一个键空间中创建了两个分片。为第二个分片启动 master 时抛出错误。
for keyspace in commerce; do
for shard in 0; do
for tabletCount in 0 1 2; do
CELL=$cell TABLET_UID=$tabletId ./scripts/MysqLctl-up.sh
CELL=$cell KEYSPACE=$keyspace SHARD=$shard TABLET_UID=$tabletId ./scripts/vttablet-up.sh
echo "Tablet id created $tabletId"
tabletId=`expr $tabletId + 1`
echo "Tablet id incremented $tabletId"
done
done
done
set +e
# set one of the replicas to master
vtctlclient InitShardMaster -force commerce/0 zone1-100
echo "Master 1 Initalized>>>>>>>>>>>>>>"
for keyspace in commerce; do
for shard in 1; do
for tabletCount in 0 1 2; do
CELL=$cell TABLET_UID=$tabletId ./scripts/MysqLctl-up.sh
CELL=$cell KEYSPACE=$keyspace SHARD=$shard TABLET_UID=$tabletId ./scripts/vttablet-up.sh
echo "Tablet id created $tabletId"
tabletId=`expr $tabletId + 1`
echo "Tablet id incremented $tabletId"
done
done
done
vtctlclient InitShardMaster -force commerce/1 zone1-103
echo "Master 2 Initalized>>>>>>>>>>>>>>"
这是我正在使用的 shell 脚本。
下面给出了 /vtdaTaroot/tmp 文件夹中文件之一的错误日志
Log file created at: 2021/02/26 12:19:52
Running on machine: QB-KRT-4001
Binary: Built with gc go1.15.7 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
E0226 12:19:52.277407 37081 backup.go:244] no backup to restore on BackupStorage for directory commerce/1. Starting up empty.
E0226 12:19:57.511745 37081 state_manager.go:276] Error transitioning to the desired state: RDONLY,Serving,will keep retrying: UnkNown database 'vt_commerce' (errno 1049) (sqlstate 42000)
E0226 12:19:57.511838 37081 tm_state.go:255] Cannot start query service: UnkNown database 'vt_commerce' (errno 1049) (sqlstate 42000)
E0226 12:20:25.727272 37081 engine.go:207] Error starting vreplication engine: error in connecting to MysqL db with connection <nil>,err UnkNown database 'vt_commerce' (errno 1049) (sqlstate 42000),will keep retrying.
E0226 12:20:55.802752 37081 query.go:83] ExecuteFetch(CREATE DATABASE IF NOT EXISTS _vt) Failed: context canceled
终端窗口输出如下,执行卡在最后一行
add /vitess/global
add /vitess/zone1
add zone1 CellInfo
etcd start done...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vtctld...current value of cell is zone1
vtctld... is UP and Running
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
MysqL port <<<<<17100>>>>>
Starting MysqL for tablet zone1-0000000100...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vttablet for zone1-0000000100...
HTTP/1.1 200 OK
Date: Fri,26 Feb 2021 06:48:36 GMT
Content-Type: text/html; charset=utf-8
Tablet id created 100
Tablet id incremented 101
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
MysqL port <<<<<17101>>>>>
Starting MysqL for tablet zone1-0000000101...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vttablet for zone1-0000000101...
HTTP/1.1 200 OK
Date: Fri,26 Feb 2021 06:49:08 GMT
Content-Type: text/html; charset=utf-8
Tablet id created 101
Tablet id incremented 102
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
MysqL port <<<<<17102>>>>>
Starting MysqL for tablet zone1-0000000102...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vttablet for zone1-0000000102...
HTTP/1.1 200 OK
Date: Fri,26 Feb 2021 06:49:27 GMT
Content-Type: text/html; charset=utf-8
Tablet id created 102
Tablet id incremented 103
W0226 12:19:27.189495 36454 main.go:67] W0226 06:49:27.187466 reparent.go:188] master-elect tablet zone1-0000000100 is not the shard master,proceeding anyway as -force was used
W0226 12:19:27.190628 36454 main.go:67] W0226 06:49:27.188475 reparent.go:194] master-elect tablet zone1-0000000100 is not a master in the shard,proceeding anyway as -force was used
I0226 12:19:27.190758 36454 main.go:67] I0226 06:49:27.188873 reparent.go:225] resetting replication on tablet zone1-0000000102
I0226 12:19:27.190800 36454 main.go:67] I0226 06:49:27.188912 reparent.go:225] resetting replication on tablet zone1-0000000100
I0226 12:19:27.190825 36454 main.go:67] I0226 06:49:27.188943 reparent.go:225] resetting replication on tablet zone1-0000000101
I0226 12:19:28.272644 36454 main.go:67] I0226 06:49:28.272235 reparent.go:244] initializing master on zone1-0000000100
I0226 12:19:28.317796 36454 main.go:67] I0226 06:49:28.317649 reparent.go:284] initializing replica zone1-0000000102
I0226 12:19:28.317824 36454 main.go:67] I0226 06:49:28.317678 reparent.go:277] populating reparent journal on new master zone1-0000000100
I0226 12:19:28.317935 36454 main.go:67] I0226 06:49:28.317683 reparent.go:284] initializing replica zone1-0000000101
Master 1 Initalized>>>>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
MysqL port <<<<<17103>>>>>
Starting MysqL for tablet zone1-0000000103...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vttablet for zone1-0000000103...
HTTP/1.1 200 OK
Date: Fri,26 Feb 2021 06:49:52 GMT
Content-Type: text/html; charset=utf-8
Tablet id created 103
Tablet id incremented 104
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
MysqL port <<<<<17104>>>>>
Starting MysqL for tablet zone1-0000000104...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vttablet for zone1-0000000104...
HTTP/1.1 200 OK
Date: Fri,26 Feb 2021 06:50:10 GMT
Content-Type: text/html; charset=utf-8
Tablet id created 104
Tablet id incremented 105
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
MysqL port <<<<<17105>>>>>
Starting MysqL for tablet zone1-0000000105...
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
<<<<<<<<<</home/qbuser/projects/vitess-sample/vtdaTaroot>>>>>>>>>>>
Starting vttablet for zone1-0000000105...
HTTP/1.1 200 OK
Date: Fri,26 Feb 2021 06:50:25 GMT
Content-Type: text/html; charset=utf-8
Tablet id created 105
Tablet id incremented 106
W0226 12:20:25.311206 38357 main.go:67] W0226 06:50:25.310160 reparent.go:188] master-elect tablet zone1-0000000103 is not the shard master,proceeding anyway as -force was used
W0226 12:20:25.312026 38357 main.go:67] W0226 06:50:25.310249 reparent.go:194] master-elect tablet zone1-0000000103 is not a master in the shard,proceeding anyway as -force was used
I0226 12:20:25.312078 38357 main.go:67] I0226 06:50:25.310341 reparent.go:225] resetting replication on tablet zone1-0000000105
I0226 12:20:25.312105 38357 main.go:67] I0226 06:50:25.310363 reparent.go:225] resetting replication on tablet zone1-0000000103
I0226 12:20:25.312126 38357 main.go:67] I0226 06:50:25.310378 reparent.go:225] resetting replication on tablet zone1-0000000104
I0226 12:20:25.575899 38357 main.go:67] I0226 06:50:25.575729 reparent.go:244] initializing master on zone1-0000000103
I0226 12:20:25.801760 38357 main.go:67] I0226 06:50:25.801370 reparent.go:277] populating reparent journal on new master zone1-0000000103
I0226 12:20:25.801962 38357 main.go:67] I0226 06:50:25.801421 reparent.go:284] initializing replica zone1-0000000105
I0226 12:20:25.802207 38357 main.go:67] I0226 06:50:25.801459 reparent.go:284] initializing replica zone1-0000000104
W0226 12:20:55.802060 38357 main.go:67] W0226 06:50:55.801559 reparent.go:298] master Failed to PopulateReparentJournal,canceling replicas
InitShardMaster Error: rpc error: code = UnkNown desc = Failed to PopulateReparentJournal on master: rpc error: code = DeadlineExceeded desc = context deadline exceeded
E0226 12:20:55.803908 38357 main.go:72] remote error: rpc error: code = UnkNown desc = Failed to PopulateReparentJournal on master: rpc error: code = DeadlineExceeded desc = context deadline exceeded
Master 2 Initalized>>>>>>>>>>>>>>
I0226 12:20:56.026845 38457 main.go:67] I0226 06:50:56.026485 tablet_executor.go:240] Received DDL request. strategy=direct
我不明白这里出了什么问题,当我只创建一个分片时,执行是成功的。 失败发生在我执行代码块以创建第二个分片时。
感谢任何帮助,提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)