Changing name of nodes in cluster

LogicalUnit

New Member
Nov 18, 2023
14
0
1
Hello, I have a little Proxmox cluster of two servers in my homelab. I would like to rename these nodes (currently "proxmox" and "joanine"). What is the correct way of doing this?

2023-11-18 15_25_07-proxmox - Proxmox Virtual Environment.png
 
I would like to rename these nodes (currently "proxmox" and "joanine"). What is the correct way of doing this?
Remove one from the cluster, then wipe it and reinstall a clean Proxmox with the new name and new IP-address, and add it to the cluster. Do the same for the other node. Please note that a two-node cluster does work when one of the nodes is missing if there is no Q-device (or third vote).
 
Thanks, it sounds like I cannot keep my current VMs/containers if I want to rename the host. Is that correct (must be "empty")?
 
Thanks, it sounds like I cannot keep my current VMs/containers if I want to rename the host. Is that correct (must be "empty")?
I don't fully understand the question. Nodes should be empty when adding to a cluster, but can't you migrate the VMs/CTs between the current nodes? And if you rename in-place, I don't see why. It's always wise to make backups of the VMs/CTs before making changed to the cluster (which you can restore later).
 
I should have attached a better image. I have two physical machines (nodes?) running Proxmox. They are already set up and have VMs/containers running on them. I would just like to change the names of the physical machines.
2023-11-20 21_17_46-proxmox - Proxmox Virtual Environment.png
 
I would just like to change the names of the physical machines.
See the wiki linked above:
This must be done on a empty node.
If your node is in a cluster, where it is not recommended changing its name
So you then have to remove all the VMs/LXCs on the node you want to rename.

I've also got a node where I would like to change the name but for me, it's not worth the hassle...so I just stick with the existing name.
 
Last edited:
What's all with the fuss changing name of a node in a cluster? I did not the first time and everything is working with no issue. Or am i missing something here? Would be happy to learn my mistake. So here is what i did:

My setup: 2 node cluster with a qdevice.

1. I migrated all the vm and lxc out of the node I want to rename (no backup no mercy)
2. ssh into the node i want to rename
3 updated /etc/hosts and /etc/hostname
4. updated /etc/pve/corosync.conf (do not foget to increment the version)
5. went to /etc/pve/nodes and deleted the old node name
6. updated ssh key pub
7. rebooted

I do not see any errors and cluster is fine. Mirgration works and everything.

NOTE: If you have replication setup the replication does not work anymore as it cannot find the old node anymore. So you have to recreate the replication with the new node name. In case you have replication setup, the old replication does not get deleted automatically (at least in my case). But you can delete it manually from /etc/pve/replication.cfg
 
Sounds great and easy. I also found the hidden .members file in /etc/pve. Should this file also be modified?

And what in detail do you mean with step 6 "update ssh key pub"

Thanks
 
What's all with the fuss changing name of a node in a cluster? I did not the first time and everything is working with no issue. Or am i missing something here? Would be happy to learn my mistake. So here is what i did:

My setup: 2 node cluster with a qdevice.

1. I migrated all the vm and lxc out of the node I want to rename (no backup no mercy)
2. ssh into the node i want to rename
3 updated /etc/hosts and /etc/hostname
4. updated /etc/pve/corosync.conf (do not foget to increment the version)
5. went to /etc/pve/nodes and deleted the old node name
6. updated ssh key pub
7. rebooted

I do not see any errors and cluster is fine. Mirgration works and everything.

NOTE: If you have replication setup the replication does not work anymore as it cannot find the old node anymore. So you have to recreate the replication with the new node name. In case you have replication setup, the old replication does not get deleted automatically (at least in my case). But you can delete it manually from /etc/pve/replication.cfg
@

homelabenthusiast



I want to rename hostname one of my node name in a cluster where I have total 3 nodes; testnode, prox2, prox3; I want to change testnode name to prox1, but it had some VMs, I have migrated them to other nodes

I just wanted to understand, what did you mean by

4. updated /etc/pve/corosync.conf (do not foget to increment the version) [an example?]
6. updated ssh key pub [how to do that?]
 
@

homelabenthusiast



I want to rename hostname one of my node name in a cluster where I have total 3 nodes; testnode, prox2, prox3; I want to change testnode name to prox1, but it had some VMs, I have migrated them to other nodes

I just wanted to understand, what did you mean by

4. updated /etc/pve/corosync.conf (do not foget to increment the version) [an example?]
6. updated ssh key pub [how to do that?]
6. I'm not completely sure, but i think it may be this steps:
0. go to one of the nodes under /root/.ssh
1. mv id_rsa id_rsa-old
2. mv id_rsa.pub id_rsa.pub-old
3. ssh-keygen -t rsa <ENTER> ...
4. take the new id_rsa.pub content and update your authorized_keys with the new id_rsa.pub key for the changed host. (they all linked to the PVE folders)
 
Last edited:
Thanks @microreal , special thanks to @homelabenthusiast

These are the steps I took to change a hostname of a node which is a member of a cluster already, and have some VMs as well. Now I don't really understand if all of these commands are necessary, I just collected some resources and made a list of my own which I thought will help, and it did work.

  • Stopped all VMs [ Also Moved all important VM to another Node for my peace of mind]
  • From the node terminal which I want to rename, I ran these and made changes for new_hostname
  • cp -r /etc/pve /root/pve_backup
  • nano /etc/hosts
  • nano /etc/hostname
  • nano /etc/mailname
  • nano /etc/postfix/main.cf
  • hostnamectl set-hostname new_hostname
  • nano /etc/pve/corosync.conf (increased the config_version from 3 to 4, the version maybe different from user to user)
  • pvecm updatecerts
  • systemctl restart pveproxy
  • systemctl restart pvedaemon
  • cd /etc/pve/nodes
  • cp -r /etc/pve/nodes/old_hosname/ /root/oldconfig
  • cp /etc/pve/nodes/old_hosname/lxc/* /etc/pve/nodes/new_hostname/lxc
  • cp /etc/pve/nodes/old_hosname/qemu-server/* /etc/pve/nodes/new_hostname/qemu-server
  • rm -rf /etc/pve/nodes/old_hosname
  • cd /var/lib/rrdcached/db/pve2-node/
  • cp -r old_hosname new_hostname
  • cd /var/lib/rrdcached/db/pve2-storage/
  • cp -r old_hosname new_hostname
  • reboot
  • After restart I also changed my storage settings as well
  • nano /etc/pve/storage.cfg
 
These are the steps I took to change a hostname of a node which is a member of a cluster already, and have some VMs as well
Why does it matter if there are VMs on it? Just move them to another node. That is the whole point of having a cluster, at least what a cluster in PVE is about.
 
  • Like
Reactions: fnrfarid
Thanks @microreal , special thanks to @homelabenthusiast

These are the steps I took to change a hostname of a node which is a member of a cluster already, and have some VMs as well. Now I don't really understand if all of these commands are necessary, I just collected some resources and made a list of my own which I thought will help, and it did work.

  • Stopped all VMs [ Also Moved all important VM to another Node for my peace of mind]
  • From the node terminal which I want to rename, I ran these and made changes for new_hostname
  • cp -r /etc/pve /root/pve_backup
  • nano /etc/hosts
  • nano /etc/hostname
  • nano /etc/mailname
  • nano /etc/postfix/main.cf
  • hostnamectl set-hostname new_hostname
  • nano /etc/pve/corosync.conf (increased the config_version from 3 to 4, the version maybe different from user to user)
  • pvecm updatecerts
  • systemctl restart pveproxy
  • systemctl restart pvedaemon
  • cd /etc/pve/nodes
  • cp -r /etc/pve/nodes/old_hosname/ /root/oldconfig
  • cp /etc/pve/nodes/old_hosname/lxc/* /etc/pve/nodes/new_hostname/lxc
  • cp /etc/pve/nodes/old_hosname/qemu-server/* /etc/pve/nodes/new_hostname/qemu-server
  • rm -rf /etc/pve/nodes/old_hosname
  • cd /var/lib/rrdcached/db/pve2-node/
  • cp -r old_hosname new_hostname
  • cd /var/lib/rrdcached/db/pve2-storage/
  • cp -r old_hosname new_hostname
  • reboot
  • After restart I also changed my storage settings as well
  • nano /etc/pve/storage.cfg
Thanks this worked perfectly!

Just FYI for others in the future do not do what I did and get "version" and "config_version" mixed up. :rolleyes: Changing version will break the cluster once the corosync.conf syncs. I had to manually unlock and manually update all nodes corosync.conf to fix version number back to 2, ensure they are 100% matching/correct and then reboot.
 
Last edited:
Thanks @microreal , special thanks to @homelabenthusiast

These are the steps I took to change a hostname of a node which is a member of a cluster already, and have some VMs as well. Now I don't really understand if all of these commands are necessary, I just collected some resources and made a list of my own which I thought will help, and it did work.

  • Stopped all VMs [ Also Moved all important VM to another Node for my peace of mind]
  • From the node terminal which I want to rename, I ran these and made changes for new_hostname
  • cp -r /etc/pve /root/pve_backup
  • nano /etc/hosts
  • nano /etc/hostname
  • nano /etc/mailname
  • nano /etc/postfix/main.cf
  • hostnamectl set-hostname new_hostname
  • nano /etc/pve/corosync.conf (increased the config_version from 3 to 4, the version maybe different from user to user)
  • pvecm updatecerts
  • systemctl restart pveproxy
  • systemctl restart pvedaemon
  • cd /etc/pve/nodes
  • cp -r /etc/pve/nodes/old_hosname/ /root/oldconfig
  • cp /etc/pve/nodes/old_hosname/lxc/* /etc/pve/nodes/new_hostname/lxc
  • cp /etc/pve/nodes/old_hosname/qemu-server/* /etc/pve/nodes/new_hostname/qemu-server
  • rm -rf /etc/pve/nodes/old_hosname
  • cd /var/lib/rrdcached/db/pve2-node/
  • cp -r old_hosname new_hostname
  • cd /var/lib/rrdcached/db/pve2-storage/
  • cp -r old_hosname new_hostname
  • reboot
  • After restart I also changed my storage settings as well
  • nano /etc/pve/storage.cfg
Anyone know if this works if ceph is set up in the cluster as well? My main reason for wanting rename nodes rather than nuke and pave them is I don't want to have to rebuild my ceph cluster over and over with each node rename.