-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52dfeb1
commit 8fcc541
Showing
17 changed files
with
263 additions
and
102 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,86 @@ | ||
## opscli file command | ||
|
||
### `-i` 指定操作目标清单 | ||
### 主机 - 本地与对象存储互传文件 | ||
|
||
- 指定主机 | ||
|
||
`-i 1.1.1.1` | ||
|
||
通过 `--username` 指定用户名,`--password` 指定密码。 | ||
- 设置 AK\SK | ||
|
||
- 批量主机 | ||
```bash | ||
export ak= | ||
export sk= | ||
``` | ||
|
||
`-i hosts.txt` | ||
- 上传本地文件 `./tmp.log` 到对象存储 `s3://logs/tmp.log` | ||
|
||
```bash | ||
cat hosts.txt | ||
|
||
1.1.1.1 | ||
2.2.2.2 | ||
/usr/local/bin/opscli file --direction upload --localfile ./tmp.log --remotefile s3://logs/tmp.log --bucket obs-test | ||
``` | ||
|
||
opscli 会从每行中正则匹配 ip 地址,作为目标地址。 | ||
`--bucket` 为 S3 bucket 名称,`--region` 为 S3 bucket 所在区域,`--endpoint` 为 S3 bucket 的 endpoint,`--direction` 为上传方向,`--localfile` 为本地文件,`--remotefile` 为远程文件。 | ||
|
||
- 集群全部节点 | ||
- 下载 S3 `s3://logs/tmp.log` 到本地文件 `./tmp1.log` | ||
|
||
```bash | ||
-i ~/.kube/config --all | ||
/usr/local/bin/opscli file --direction download --localfile ./tmp1.log --remotefile s3://logs/tmp.log --bucket obs-test | ||
``` | ||
|
||
`-i` 默认值为 `~/.kube/config`。 | ||
|
||
- 集群指定节点 | ||
- 清理 AK\SK | ||
|
||
```bash | ||
-i ~/.kube/config --nodename node1 | ||
unset ak | ||
unset sk | ||
``` | ||
|
||
node1 为节点名称。 | ||
### 主机 - 本地与 API Server 互传文件 | ||
|
||
### 本地文件与对象存储文件互传 | ||
> 提供本地加解密,与服务器端进行文件传输 | ||
- 设置 AK\SK | ||
- 上传 | ||
|
||
```bash | ||
export ak= | ||
export sk= | ||
/usr/local/bin/opscli file --direction upload --api https://uploadapi.vinqi.com/api/v1/files --aeskey "" --localfile ./tmp.log | ||
|
||
Please use the following command to download the file: | ||
opscli file --api https://uploadapi.vinqi.com/api/v1/files --aeskey xxx --direction download --remotefile https://download_url_link.com.aes | ||
``` | ||
|
||
- 上传本地文件 `./tmp.log` 到对象存储 `s3://logs/tmp.log` | ||
这里的 api 提供上传服务,aeskey 为空字符串时自动生成一个随机秘钥,如果不设置 aeskey 默认为 unset 将不会进行文件加密。 | ||
|
||
- 下载 | ||
|
||
```bash | ||
/usr/local/bin/opscli file --direction upload --localfile ./tmp.log --remotefile s3://logs/tmp.log --bucket obs-test | ||
/usr/local/bin/opscli file --api https://uploadapi.vinqi.com/api/v1/files --aeskey xxx --direction download --remotefile https://download_url_link.com.aes | ||
``` | ||
|
||
`--bucket` 为 S3 bucket 名称,`--region` 为 S3 bucket 所在区域,`--endpoint` 为 S3 bucket 的 endpoint,`--direction` 为上传方向,`--localfile` 为本地文件,`--remotefile` 为远程文件。 | ||
### 集群 - 本地与 API Server 互传文件 | ||
|
||
- 下载 S3 `s3://logs/tmp.log` 到本地文件 `./tmp1.log` | ||
- 上传 | ||
|
||
```bash | ||
/usr/local/bin/opscli file --direction download --localfile ./tmp1.log --remotefile s3://logs/tmp.log --bucket obs-test | ||
/usr/local/bin/opscli file -i ~/.kube/config --nodename node1 --direction upload --api https://uploadapi.vinqi.com/api/v1/files --aeskey "" --localfile /root/tmp.log --runtimeimage shaowenchen/ops-cli | ||
``` | ||
|
||
- 清理 AK\SK | ||
- 下载 | ||
|
||
```bash | ||
unset ak | ||
unset sk | ||
/usr/local/bin/opscli file -i ~/.kube/config --nodename xxx --direction download --api https://uploadapi.vinqi.com/api/v1/files --aeskey xxx --localfile /root/tmp1.log --remotefile https://uploadapi.vinqi.com/uploadbases/cdn0/raw/1721621949-tmp.log.aes --runtimeimage shaowenchen/ops-cli | ||
``` | ||
|
||
### 本地文件分发到远程主机上 | ||
### 集群 - 本地与对象存储互传文件 | ||
|
||
- 上传本地文件 `./tmp.log` 到远程主机 `/tmp/tmp.log` | ||
- 上传 | ||
|
||
```bash | ||
/usr/local/bin/opscli file --direction upload --localfile ./tmp.log --remotefile /tmp/tmp.log -i 1.2.3.4 --port 2222 --username root | ||
/usr/local/bin/opscli file -i ~/.kube/config --nodename xxx --direction upload --ak xxx --sk xxx --region beijing --endpoint ks3-cn-beijing.ksyun.com --bucket multimodal --localfile /root/tmp.log --remotefile s3://logs/tmp.log --runtimeimage shaowenchen/ops-cli | ||
``` | ||
|
||
- 下载远程主机 `/tmp/tmp.log` 到本地文件 `./tmp1.log` | ||
- 下载 | ||
|
||
```bash | ||
/usr/local/bin/opscli file --direction download --localfile ./tmp1.log --remotefile /tmp/tmp.log -i 1.2.3.4 --port 2222 --username root | ||
/usr/local/bin/opscli file -i ~/.kube/config --nodename xxx --direction download --ak xxx --sk xxx --region beijing --endpoint ks3-cn-beijing.ksyun.com --bucket multimodal --localfile /root/tmp2.log --remotefile s3://logs/tmp.log --runtimeimage shaowenchen/ops-cli | ||
``` | ||
|
||
### 本地文件上传到 API Server,可加密 | ||
|
||
> 提供本地加解密,与服务器端进行文件传输 | ||
- 上传本地文件 `./tmp.log` 到 API Server | ||
### 集群 - 镜像文件拷贝到本地 | ||
|
||
```bash | ||
/usr/local/bin/opscli file --direction upload --api https://uploadapi.vinqi.com/api/v1/files --aeskey "" --localfile ./tmp.log | ||
|
||
Please use the following command to download the file: | ||
opscli file --api https://uploadapi.vinqi.com/api/v1/files --aeskey xxxxxxxxxxx --direction download --remotefile https://download_url_link.com.aes | ||
/usr/local/bin/opscli file -i ~/.kube/config --nodename xxx --direction download --localfile /root/opscli-copy --remotefile shaowenchen/ops-cli:latest:///usr/local/bin/opscli | ||
``` | ||
|
||
这里的 api 提供上传服务,aeskey 为空字符串时自动生成一个随机秘钥,如果不设置 aeskey 默认为 unset 将不会进行文件加密。 | ||
|
||
### 从镜像中提取文件到集群主机 |
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
Oops, something went wrong.