Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 修改PD配置报错:tiup ctl:v6.5.0 pd config placement save --in=rules.json
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[tidb@bgtest001 ~]$ tiup ctl:v6.5.0 pd config placement save --in=rules.json
Starting component ctl
: /home/tidb/.tiup/components/ctl/v6.5.0/ctl pd config placement save --in=rules.json
json: cannot unmarshal object into Go value of type *placement.RuleOp
rules.json file configuration:
{
“group_id”: “pd”,
“id”: “default”,
“start_key”: “”,
“end_key”: “”,
“role”: “voter”,
“is_witness”: false,
“count”: 3,
“location_labels”: [
“host”
]
}
Thank you for helping to check
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
Are you trying to set up the placement rule feature here?
Yes, yes, but now setting the PD information will result in an error.
Can Da Fei Ge repair the PD configuration using this method with tiup ctl:v6.5.0 pd config?
It is recommended to use SQL to set placement rules, which greatly reduces the difficulty and complexity, providing a good user experience.
I suggest you check the content of placement rule in SQL on the official website.
There is a problem with the rules, remove the rules first.
Sure, you can do it interactively. You can also do it straightforwardly by following the documentation.
Is it because the last isolation_level is missing?
{
"group_id": "pd",
"id": "default",
"start_key": "",
"end_key": "",
"role": "voter",
"count": 3,
"location_labels": ["zone", "rack", "host"],
"isolation_level": ""
}
No, it looks like there is an issue with the GO environment.
Does it still not work after adding it?
This error is not due to an issue with the GO environment, but rather an incorrect JSON format. First, check what the current default rule is, and then see how it should be modified.
pd-ctl config placement-rules show --group=pd --id=default