-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update TiUP offline deployment; rename tiup mirrors to tiup mirror #3425
Merged
sre-bot
merged 13 commits into
pingcap:master
from
lichunzhu:updateTiUPOfflineDeployment
Jun 2, 2020
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b96d143
update TiUP offline deployment
lichunzhu 7247a44
resolve conflicts
lichunzhu 28de28f
address comment
lichunzhu 3b262d6
update tiup mirror clone document
lichunzhu c94f9cd
Merge branch 'master' into updateTiUPOfflineDeployment
lichunzhu 02ee645
update obsolete links
lichunzhu fd3c234
Merge branch 'master' into updateTiUPOfflineDeployment
lichunzhu 4d37178
delete tiup package command
lichunzhu 48e9a04
Merge branch 'updateTiUPOfflineDeployment' of https://github.com/lich…
lichunzhu 02857a0
address comments
lichunzhu 580e82f
Merge branch 'master' into updateTiUPOfflineDeployment
lichunzhu 637b6e6
address comments again
lichunzhu 9c695f2
Merge branch 'updateTiUPOfflineDeployment' of https://github.com/lich…
lichunzhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
title: 搭建私有镜像 | ||
category: tools | ||
aliases: ['/docs-cn/dev/tiup/tiup-mirrors/','/docs-cn/dev/reference/tools/tiup/mirror/'] | ||
--- | ||
|
||
# 搭建私有镜像 | ||
|
||
在构建私有云时,通常会使用隔离的网络环境,此时无法访问 TiUP 的官方镜像。因此,我们提供了构建私有镜像的方案,它主要由 mirror 指令来实现,该方案也可用于离线部署。 | ||
|
||
## mirror 指令介绍 | ||
|
||
`mirror` 指令的帮助文档如下: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```bash | ||
tiup mirror --help | ||
``` | ||
|
||
``` | ||
The 'mirror' command is used to manage a component repository for TiUP, you can use | ||
it to create a private repository, or to add new component to an existing repository. | ||
The repository can be used either online or offline. | ||
It also provides some useful utilities to help managing keys, users and versions | ||
of components or the repository itself. | ||
|
||
Usage: | ||
tiup mirror <command> [flags] | ||
|
||
Available Commands: | ||
init Initialize an empty repository | ||
sign Add signatures to a manifest file | ||
genkey Generate a new key pair | ||
clone Clone a local mirror from remote mirror and download all selected components | ||
publish Publish a component | ||
|
||
Flags: | ||
-h, --help help for mirror | ||
--repo string Path to the repository | ||
|
||
Global Flags: | ||
--skip-version-check Skip the strict version check, by default a version must be a valid SemVer string | ||
|
||
Use "tiup mirror [command] --help" for more information about a command. | ||
``` | ||
|
||
构建本地镜像将会使用 `tiup mirror clone` 指令,其基本用法如下: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```bash | ||
tiup mirror clone <target-dir> [global-version] [flags] | ||
``` | ||
|
||
- `target-dir`:指需要把克隆下来的数据放到哪个目录里。 | ||
- `global-version`:用于为所有组件快速设置一个共同的版本。 | ||
|
||
`tiup mirror clone` 命令提供了很多可选参数,日后可能会提供更多。但这些参数其实可以分为四类: | ||
|
||
1. 克隆时是否使用前缀匹配方式匹配版本 | ||
|
||
如果指定了 `--prefix` 参数,则会才用前缀匹配方式匹配克隆的版本号。例:指定 `--prefex` 时填写版本 "v4.0.0" 将会匹配 "v4.0.0-rc.1", "v4.0.0-rc.2", "v4.0.0" | ||
|
||
2. 是否全量克隆 | ||
|
||
如果指定了 `--full` 参数,则会完整地克隆官方镜像。 | ||
|
||
> **注意:** | ||
> | ||
> 如果既不指定 `--full` 参数,又不指定 `global-version` 或克隆的 component 版本,那么 TiUP 就只会克隆一些元信息。 | ||
|
||
3. 限定只克隆特定平台的包 | ||
|
||
如果只想克隆某个平台的包,那么可以使用 `--os` 和 `--arch` 来限定: | ||
|
||
- 只想克隆 linux 平台的,则执行 `tiup mirror clone <target-dir> [global-version] --os=linux` | ||
- 只想克隆 amd64 架构的,则执行 `tiup mirror clone <target-dir> [global-version] --arch=amd64` | ||
- 只想克隆 linux/amd64 的,则执行 `tiup mirror clone <target-dir> [global-version] --os=linux --arch=amd64` | ||
|
||
4. 限定只克隆组件的特定版本 | ||
|
||
如果只想克隆某个组件的某一个版本而不是所有版本,则使用 `--<component>=<version>` 来限定,例如: | ||
|
||
- 只想克隆 TiDB 的 v4.0.0 版本,则执行 `tiup mirror clone <target-dir> --tidb v4.0.0` | ||
- 只想克隆 TiDB 的 v4.0.0 版本,以及 TiKV 的所有版本,则执行 `tiup mirror clone <target-dir> --tidb v4.0.0 --tikv all` | ||
- 克隆一个集群的所有组件的 v4.0.0 版本,则执行 `tiup mirror clone <target-dir> v4.0.0` | ||
|
||
## 使用示例 | ||
|
||
### 使用 TiUP 离线安装 TiDB 集群 | ||
yikeke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
参考[使用 TiUP 离线部署](/production-offline-deployment-using-tiup.md#方式二使用-tiup-mirror-clone-命令手动打包离线组件包)安装 TiUP 离线镜像,部署并启动 TiDB 集群。 | ||
|
||
### 构建私有镜像 | ||
|
||
构建私有镜像的方式和离线安装包的制作过程相同,只需要将 package 目录中的内容上传到 CDN 或者文件服务器即可,最简单的方式是: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```bash | ||
cd package | ||
python -m SimpleHTTPServer 8000 | ||
``` | ||
|
||
这样就在 <http://127.0.0.1:8000> 这个地址建立了私有镜像。 | ||
|
||
通过私有镜像安装 TiUP: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```bash | ||
export TIUP_MIRRORS=http://127.0.0.1:8000 | ||
curl $TIUP_MIRRORS/local_install.sh | sh | ||
``` | ||
|
||
导入 PATH 变量之后就可以正常使用 TiUP 了(需要保持 `TIUP_MIRRORS` 变量指向私有镜像)。 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者引导到官方下载页面直接下载离线包,可以给两个选项。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的