Error modifying PD configuration: tiup ctl:v6.5.0 pd config placement save --in=rules.json

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

| username: 最强王者

[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]

| username: Jellybean | Original post link

Are you trying to set up the placement rule feature here?

| username: 大飞哥online | Original post link

Refer to this document: Placement Rules 使用文档 | PingCAP 文档中心

| username: 最强王者 | Original post link

Yes, yes, but now setting the PD information will result in an error.

| username: 最强王者 | Original post link

Can Da Fei Ge repair the PD configuration using this method with tiup ctl:v6.5.0 pd config?

| username: Jellybean | Original post link

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.

| username: Fly-bird | Original post link

There is a problem with the rules, remove the rules first.

| username: 大飞哥online | Original post link

Sure, you can do it interactively. You can also do it straightforwardly by following the documentation.

| username: 最强王者 | Original post link

Okay, received.

| username: Kongdom | Original post link

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": ""
}
| username: 最强王者 | Original post link

No, it looks like there is an issue with the GO environment.

| username: 最强王者 | Original post link

Still not resolved?

| username: Kongdom | Original post link

Does it still not work after adding it?

| username: dba-kit | Original post link

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