How to Change the node_exporter_port Port

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 要如何修改node_exporter_port端口

| username: haoshuaili

By using edit config to check the current configuration, it looks like this:
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
deploy_dir: /data/tidb/deploy
data_dir: /data/tidb/deploy/data
log_dir: /data/tidb/deploy/log
Now, I need to change the node_exporter_port because one physical machine needs to deploy TiKV nodes for two clusters. It seems that directly modifying the port through edit-config does not take effect.

| username: Kongdom | Original post link

Refer to this and take a look:

| username: TiDBer_QYr0vohO | Original post link

Go to this directory /data/deploy/monitor-9100/scripts and modify the run_node_exporter.sh shell script.

| username: yytest | Original post link

  • Locate the TiDB cluster configuration file meta.yaml, which is usually found at the path .tiup/storage/cluster/clusters/{cluster_name}.
  • Open the meta.yaml file, find the node_exporter_port configuration item, and change it to the new port number you want to set.
  • Save the changes to the meta.yaml file.
  • Next, you need to update the system’s service startup script. Locate the node_exporter service script, usually found in the /etc/systemd/system/ directory, and the file name should include the new port number you just set.
  • Open the service script and replace all occurrences of the old port number with the new port number.
  • Save the changes to the service script.
  • Reload the system’s unit configuration files so that the system can recognize the new configuration:
    sudo systemctl daemon-reload
    
  • Finally, restart the TiDB cluster to apply the new configuration:
    tiup cluster restart {cluster_name}
    
| username: Kongdom | Original post link

To correct, tiup cluster restart will not distribute the configuration, it will only load the local configuration.