How to reconnect agents to moved server?

I moved my Rancher server and the MySQL data to a new node. I’m now wondering how I can properly reconnect the agents to the new node (if even possible)?

I already tried re-using the intial agent run command. But it just created the agent a second time in the UI (and didn’t recognize the network already running).

1 Like

Can you provide more details on how you moved your Rancher server to a new node?

Is the MySQL data inside the container or an external container?

I have MySQL data as external volume mount of /opt/rancher_data:/var/lib/mysql. So the steps I did:

  • Stop Rancher server container.
  • Move /opt/rancher_data to new host.
  • Start Rancher server container on new host with volume /opt/rancher_data:/var/lib/mysql.
  • Verify Rancher server is responding to UI 9everything looks good except disconnected agents).
  • Stop agent on another server and start it with the same command line only substituting the new server URL.

After I started the agent on the new URL, it showed up in the UI as a new agent (the name was same but the ID in the URL was new). Is there a better way I could have handled this and preserved the agent information better?

I’m thinking this would be useful information for a data and Rancher server recovery scenario.

Okay, I believe that you should just re-run the add agent command without stopping the old one. It’s how we handle what happens if your IP changes to get the agent working with the server again. But I’ve never tried with what happens if you move Rancher server.

I’m assuming the IP of Rancher server changed?

@denise
I’m having similar issue. I have a basic single host rancher running.
I want to upgrade rancher version and move it to another host. Also start using external DB instead of in-container one to provide backups policy.
So I’ve created an sql dump from inside rancher container, and moved it to a new host.
Restored that dump in mysql and started new rancher pointing to that db behind nginx proxy with SSL. All the services were in the UI, but hosts were in disconnected state. I tried to lift agent containers on these hosts with new URL and token, but they were continually restarting with connection issues.
It feels like there’s Rancher server IP somewhere in DB, and it’s not being changed, or some other issue with networking.

Can you provide a hint on how to move properly rancher server to another ip or domain and behind nginx proxy with https.

Thank you, I’m really enjoying using rancher, this is a first time I wasn’t able to resolve issue fast, usually docs just work good.

@youanswer Were you able to resolve this?

I believe you would need to update your host registration before trying to re-register your agents.