|
| 1 | + |
| 2 | +!!! warning "注意" |
| 3 | + |
| 4 | + 由于 V2 版本较 V1 版本有比较大的架构变动,目前不支持从 V1 版本直接在线升级至 V2 版本。 |
| 5 | + |
| 6 | + 为确保迁移顺利、安全,请务必在执行前仔细阅读本文档的[升级说明](v1_migrate.md)。 |
| 7 | + |
| 8 | +## 1. 安装 1panel-migrator |
| 9 | + |
| 10 | +### 1.1 安装包获取 |
| 11 | + |
| 12 | +请访问 Gitee 发布页,手动下载适用于您服务器架构的安装包,并将其放置到 `/tmp` 目录: |
| 13 | + |
| 14 | +> 🔗 https://gitee.com/fit2cloud-feizhiyun/1panel-migrator/releases/ |
| 15 | +
|
| 16 | +每个版本会提供以下架构的安装包(文件名示例): |
| 17 | + |
| 18 | +- `1panel-migrator-linux-amd64` |
| 19 | +- `1panel-migrator-linux-arm64` |
| 20 | +- `1panel-migrator-linux-arm` |
| 21 | +- `1panel-migrator-linux-ppc64le` |
| 22 | +- `1panel-migrator-linux-s390x` |
| 23 | + |
| 24 | +### 1.2 安装步骤(以 amd64 架构为例) |
| 25 | + |
| 26 | +```bash |
| 27 | +# 1. 进入临时目录 |
| 28 | +cd /tmp |
| 29 | + |
| 30 | +# 2. 添加执行权限 |
| 31 | +chmod +x 1panel-migrator-linux-amd64 |
| 32 | + |
| 33 | +# 3. 移动至系统 PATH 中并重命名 |
| 34 | +mv 1panel-migrator-linux-amd64 /usr/local/bin/1panel-migrator |
| 35 | +``` |
| 36 | + |
| 37 | +## 2. 升级说明 |
| 38 | + |
| 39 | +升级过程分为两步:**升级服务** 和 **升级网站**。 |
| 40 | + |
| 41 | +> 请务必先完成服务升级,再进行网站升级。 |
| 42 | +
|
| 43 | +服务升级分为两种角色: |
| 44 | + |
| 45 | +- **主节点**:包含 `1panel-core` 和 `1panel-agent` 两个服务,开放对外端口,支持通过浏览器访问; |
| 46 | +- **从节点**:仅包含 `1panel-agent` 服务,不开放对外端口,需要通过主节点的 ``节点管理`` 页面添加并管理。 |
| 47 | + |
| 48 | +### 2.1 升级为主节点 |
| 49 | + |
| 50 | +#### 2.1.1 升级服务 |
| 51 | + |
| 52 | +```bash |
| 53 | +1panel-migrator upgrade core |
| 54 | +``` |
| 55 | + |
| 56 | +#### 2.1.2 升级网站 |
| 57 | + |
| 58 | +> 注意:请确保 V2 服务启动成功后再执行该命令。 |
| 59 | +
|
| 60 | +```bash |
| 61 | +1panel-migrator upgrade website |
| 62 | +``` |
| 63 | + |
| 64 | +### 2.2 升级为从节点 |
| 65 | + |
| 66 | +#### 2.2.1 升级服务 |
| 67 | + |
| 68 | +```bash |
| 69 | +1panel-migrator upgrade agent |
| 70 | +``` |
| 71 | + |
| 72 | +#### 2.2.2 在主节点添加从节点 |
| 73 | + |
| 74 | +前往主节点 **节点管理** 页面,添加该从节点。系统会自动识别并处理 V1 的历史数据。 |
| 75 | + |
| 76 | +#### 2.2.3 升级网站 |
| 77 | + |
| 78 | +> 注意:添加完成后,请在从节点服务器上执行网站升级命令。 |
| 79 | +
|
| 80 | +```bash |
| 81 | +1panel-migrator upgrade website |
| 82 | +``` |
| 83 | + |
| 84 | +## 3. 回滚说明 |
| 85 | + |
| 86 | +!!! note "" |
| 87 | + |
| 88 | + 当升级过程出现问题时,可以使用回滚操作恢复到之前的 1Panel V1 版本。 |
| 89 | + |
| 90 | +回滚过程也分为两步:**回滚 1Panel 服务** 和 **回滚网站**。 |
| 91 | + |
| 92 | +!!! warning "注意" |
| 93 | + |
| 94 | + 请务必先完成服务的回滚,再进行网站回滚。 |
| 95 | + |
| 96 | +### 3.1 服务回滚 |
| 97 | + |
| 98 | +不区分主从节点,直接在目标服务器执行以下命令: |
| 99 | + |
| 100 | +```bash |
| 101 | +1panel-migrator rollback service |
| 102 | +``` |
| 103 | + |
| 104 | +### 3.2 网站回滚 |
| 105 | + |
| 106 | +同样在目标服务器执行以下命令: |
| 107 | + |
| 108 | +> 注意:请确保 V1 服务启动成功后再执行该命令。 |
| 109 | +
|
| 110 | +```bash |
| 111 | +1panel-migrator rollback website |
| 112 | +``` |
0 commit comments