Switching Servers with TiUP

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

Original topic: tiup切换服务器

| username: TiDBer_djgos04V

[TiDB Usage Environment] Production Environment
There is an issue with the server where tiup is installed, and now this server needs to be shut down. Will shutting down tiup affect TiDB? Is there a way to transfer tiup to another server?

| username: tidb菜鸟一只 | Original post link

Sure, you can install tiup on the new control machine, then directly copy the files from the .tiup directory of the old control machine to the new one. This will not affect the normal operation of the TiDB cluster, but you need to ensure that there are no other components of the TiDB cluster deployed on your control machine.

| username: xingzhenxiang | Original post link

Just copy the directory directly.

| username: TiDBer_djgos04V | Original post link

So if there are other components in the TiDB cluster, what issues might arise, or is it just a matter of scaling and switching component nodes?

| username: 普罗米修斯 | Original post link

Copy the .tiup directory to the new server, establish passwordless SSH between the new server and each component, and it can be used.

| username: 普罗米修斯 | Original post link

Other components scale in and out to decommission node services.

| username: tidb菜鸟一只 | Original post link

If there are other components, you need to first scale out on other machines, and then scale in the nodes on the old control machine.

| username: zhanggame1 | Original post link

You can cut directly. Once tiup is installed, you can copy the original over, or use the built-in backup and restore feature.

| username: Fly-bird | Original post link

Passwordless SSH login is a key point.

| username: 像风一样的男子 | Original post link

  1. Backup the /root/.tiup directory: tar czvf tiup.tar.gz .tiup, and copy tiup.tar.gz to the /root directory of the target machine.
  2. Execute tar xzvf tiup.tar.gz on the target machine.
  3. Add the .tiup directory to the PATH environment variable.
    If using bash and the user is tidb, add export PATH=/root/.tiup/bin:$PATH to ~.bashrc and then execute source ~.bashrc. Adjust accordingly based on the shell and user being used.
| username: TiDBer_小阿飞 | Original post link

Snapshot directly applied… Haha!

| username: Kongdom | Original post link

After tiup is stopped, it does not affect the TiDB cluster. Tiup is just a management tool.

| username: xingzhenxiang | Original post link

This is the official documentation recommendation
(使用 TiUP 部署运维 TiDB 线上集群 | PingCAP 文档中心)

| username: TiDBer_djgos04V | Original post link

So how should some monitoring components be migrated? Should it be done according to the scaling operations of nodes, or are other operations required?

| username: Kongdom | Original post link

:thinking: Detection components? Can you first clarify which components are on this server? Or use display to check if there are any components of the cluster on this server.

| username: TiDBer_djgos04V | Original post link

These components are monitoring_servers, grafana_servers, and alertmanager_servers.

| username: Kongdom | Original post link

This requires scaling in and out for migration.

| username: TiDBer_djgos04V | Original post link

Okay, thank you :kissing_smiling_eyes:

| username: ajin0514 | Original post link

You can refer to the official recommendation documentation.

| username: TiDBer_小阿飞 | Original post link

Just COPY it to the new control machine, the module won’t be affected.