rolling update faild while check current PD leader
Please answer these questions before submitting your issue. Thanks!
- What did you do? I am updating tidb using ansible. from V1.0.6,to v2.0.4 Following this guide: https://www.pingcap.com/docs-cn/op-guide/tidb-v2-upgrade-guide/
ansible-playbook rolling_update.yml
-
What did you expect to see? Update success. We have success update tidb from 1.0.6 to v2.0.3 in the TEST ENV before。
-
What did you see instead? we have 3 pds, the 1st and 2nd update with no error. the 3rd pd report error:
Ansible FAILED! => playbook: rolling_update.yml; TASK: check current PD leader; message: {"msg": "The conditional check 'pd_leader_info.json.name is defined and pd_leader_info.json.name != pd_name' failed. The error was: error while evaluating conditional (pd_leader_info.json.name is defined and pd_leader_info.json.name != pd_name): 'dict object' has no attribute 'json'"}
- What version of TiDB are you using (
tidb-server -Vor runselect tidb_version();on TiDB)? v1.0.6-1
ps: When check the rolling_update.yml: https://github.com/pingcap/tidb-ansible/blob/master/rolling_update.yml
curl http://xxxxxx.139:2379/pd/api/v1/leader
{ "name": "pd3", "member_id": 6795350017215450226, "peer_urls": [ "http://xxxxx.139:2380" ], "client_urls": [ "http://xxxxx.139:2379" ] }
I make a post as the rolling_update.yml does.
[root]# curl -X POST http://xxxxx.139:2379/pd/api/v1/leader/resign null [root]# curl -X POST http://xxxx.139::2379/pd/api/v1/leader/resign no leader
then i check it
[root]# curl http://1xxx.139:2379/pd/api/v1/leader no leader [root]# curl http://1xxxx.139:2379/pd/api/v1/leader no leader [root]# curl http://1xxxx.139:2379/pd/api/v1/leader { "name": "pd3", "member_id": 6795350017215450226, "peer_urls": [ "http://xxxxx.139:2380" ], "client_urls": [ "http://xxx.139:2379" ] }
It seems PD3 can not transfer to another PD server
pdctl member leader transfer pd2
and got log at pd2:
2018/06/22 09:21:29.241 leader.go:95: [info] leader is name:"pd3" member_id:6795350017215450226 peer_urls:"http://10.155.111.139:2380" client_urls:"http://10.155.111.139:2379" , watch it 2018/06/22 09:24:15.675 leader.go:312: [info] leader is deleted 2018/06/22 09:24:15.675 leader.go:97: [info] leader changed, try to campaign leader 2018/06/22 09:24:15.675 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:15.876 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:16.077 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:16.278 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:26.325 leader.go:95: [info] leader is name:"pd3" member_id:6795350017215450226 peer_urls:"http://10.155.111.139:2380" client_urls:"http://10.155.111.139:2379" , watch it
@calmzealA Please provide more log information for PD3.
@ciscoxll 谢谢 已经处理好了。
主要的问题在于每次选举leader都是pd3,可能跟pd1,pd2已经升级到2.0.4,pd3还是1.0.6有关。 然后我们采用下面的方法绕过了:
- 手动停掉 pd3。 这时候leader能切换到pd1。
- 修改inventory.ini,在PD list 配置里面,将PD3 放在第一个。(否则,再次执行rolling update,还是会从pd1,pd2开始升级,这样会将leader再切到pd3.)
- 执行升级。
Related issue: https://github.com/pingcap/tidb/issues/11240