Helm

简介: Helm

介绍

  • Helm是Kubernetes 应用的包管理工具,主要用来管理 Charts,类似Linux系统的yum。
  • Helm Chart 是用来封装 Kubernetes 原生应用程序的一系列 YAML 文件。可以在你部署应用的时候自定义应用程序的一些 Metadata,以便于应用程序的分发。
  • 对于应用发布者而言,可以通过 Helm 打包应用、管理应用依赖关系、管理应用版本并发布应用到软件仓库。
  • 对于使用者而言,使用 Helm 后不用需要编写复杂的应用部署文件,可以以简单的方式在 Kubernetes 上查找、安装、升级、回滚、卸载应用程序  


Helm安装

安装地址 PATH

下载包:helm-v3.11.1-linux-amd64.tar.gz

解压:  

[root@master ~]# tar -xf helm-v3.11.1-linux-amd64.tar.gz 
[root@master ~]# cd linux-amd64/ 
[root@master linux-amd64]# ll 
-rwxr-xr-x 1 1001 1002 46870528 2月 9 01:29 helm 
-rw-r--r-- 1 1001 1002 11373 2月 9 01:39 LICENSE 
-rw-r--r-- 1 1001 1002 3367 2月 9 01:39 README.md 
[root@master linux-amd64]# cp helm /usr/local/bin/
  • helm命令自动补齐:
[root@master linux-amd64]# yum -y install bash-completion
[root@master linux-amd64]# echo "source <(kubectl completion bash)" >> ~/.bashrc
[root@master linux-amd64]# helm completion bash > /etc/bash_completion.d/helm
[root@master linux-amd64]# helm completion bash -h
Generate the autocompletion script for Helm for the bash shell.
To load completions in your current shell session:
    source <(helm completion bash)
To load completions for every new session, execute once:
- Linux:
      helm completion bash > /etc/bash_completion.d/helm
- MacOS:
      helm completion bash > /usr/local/etc/bash_completion.d/helm
自动补齐命令安装后,因为.bashrc文件被修改,login输入端会变化为 -bash-4.2# 
  • 安装完成:
[root@master linux-amd64]# helm version
version.BuildInfo{Version:"v3.11.1", GitCommit:"293b50c65d4d56187cd4e2f390f0ada46b4c4737", GitTreeState:"clean", GoVersion:"go1.18.10"}  


Helm命令大全

[root@master linux-amd64]# helm --help
The Kubernetes package manager
Common actions for Helm:
- helm search:    search for charts
- helm pull:      download a chart to your local directory to view
- helm install:   upload the chart to Kubernetes
- helm list:      list releases of charts
Environment variables:
| Name                               | Description                                                                                       |
|------------------------------------|---------------------------------------------------------------------------------------------------|
| $HELM_CACHE_HOME                   | set an alternative location for storing cached files.                                             |
| $HELM_CONFIG_HOME                  | set an alternative location for storing Helm configuration.                                       |
| $HELM_DATA_HOME                    | set an alternative location for storing Helm data.                                                |
| $HELM_DEBUG                        | indicate whether or not Helm is running in Debug mode                                             |
| $HELM_DRIVER                       | set the backend storage driver. Values are: configmap, secret, memory, sql.                       |
| $HELM_DRIVER_SQL_CONNECTION_STRING | set the connection string the SQL storage driver should use.                                      |
| $HELM_MAX_HISTORY                  | set the maximum number of helm release history.                                                   |
| $HELM_NAMESPACE                    | set the namespace used for the helm operations.                                                   |
| $HELM_NO_PLUGINS                   | disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins.                                        |
| $HELM_PLUGINS                      | set the path to the plugins directory                                                             |
| $HELM_REGISTRY_CONFIG              | set the path to the registry config file.                                                         |
| $HELM_REPOSITORY_CACHE             | set the path to the repository cache directory                                                    |
| $HELM_REPOSITORY_CONFIG            | set the path to the repositories file.                                                            |
| $KUBECONFIG                        | set an alternative Kubernetes configuration file (default "~/.kube/config")                       |
| $HELM_KUBEAPISERVER                | set the Kubernetes API Server Endpoint for authentication                                         |
| $HELM_KUBECAFILE                   | set the Kubernetes certificate authority file.                                                    |
| $HELM_KUBEASGROUPS                 | set the Groups to use for impersonation using a comma-separated list.                             |
| $HELM_KUBEASUSER                   | set the Username to impersonate for the operation.                                                |
| $HELM_KUBECONTEXT                  | set the name of the kubeconfig context.                                                           |
| $HELM_KUBETOKEN                    | set the Bearer KubeToken used for authentication.                                                 |
| $HELM_KUBEINSECURE_SKIP_TLS_VERIFY | indicate if the Kubernetes API server's certificate validation should be skipped (insecure)       |
| $HELM_KUBETLS_SERVER_NAME          | set the server name used to validate the Kubernetes API server certificate                        |
| $HELM_BURST_LIMIT                  | set the default burst limit in the case the server contains many CRDs (default 100, -1 to disable)|
Helm stores cache, configuration, and data based on the following configuration order:
- If a HELM_*_HOME environment variable is set, it will be used
- Otherwise, on systems supporting the XDG base directory specification, the XDG variables will be used
- When no other location is set a default location will be used based on the operating system
By default, the default directories depend on the Operating System. The defaults are listed below:
| Operating System | Cache Path                | Configuration Path             | Data Path               |
|------------------|---------------------------|--------------------------------|-------------------------|
| Linux            | $HOME/.cache/helm         | $HOME/.config/helm             | $HOME/.local/share/helm |
| macOS            | $HOME/Library/Caches/helm | $HOME/Library/Preferences/helm | $HOME/Library/helm      |
| Windows          | %TEMP%\helm               | %APPDATA%\helm                 | %APPDATA%\helm          |
Usage:
  helm [command]
Available Commands:
  completion  generate autocompletion scripts for the specified shell
  create      create a new chart with the given name
  dependency  manage a chart's dependencies
  env         helm client environment information
  get         download extended information of a named release
  help        Help about any command
  history     fetch release history
  install     install a chart
  lint        examine a chart for possible issues
  list        list releases
  package     package a chart directory into a chart archive
  plugin      install, list, or uninstall Helm plugins
  pull        download a chart from a repository and (optionally) unpack it in local directory
  push        push a chart to remote
  registry    login to or logout from a registry
  repo        add, list, remove, update, and index chart repositories
  rollback    roll back a release to a previous revision
  search      search for a keyword in charts
  show        show information of a chart
  status      display the status of the named release
  template    locally render templates
  test        run tests for a release
  uninstall   uninstall a release
  upgrade     upgrade a release
  verify      verify that a chart at the given path has been signed and is valid
  version     print the client version information
Flags:
      --burst-limit int                 client-side default throttling limit (default 100)
      --debug                           enable verbose output
  -h, --help                            help for helm
      --kube-apiserver string           the address and the port for the Kubernetes API server
      --kube-as-group stringArray       group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --kube-as-user string             username to impersonate for the operation
      --kube-ca-file string             the certificate authority file for the Kubernetes API server connection
      --kube-context string             name of the kubeconfig context to use
      --kube-insecure-skip-tls-verify   if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kube-tls-server-name string     server name to use for Kubernetes API server certificate validation. If it is not provided, the hostname used to contact the server is used
      --kube-token string               bearer token used for authentication
      --kubeconfig string               path to the kubeconfig file
  -n, --namespace string                namespace scope for this request
      --registry-config string          path to the registry config file (default "/root/.config/helm/registry/config.json")
      --repository-cache string         path to the file containing cached repository indexes (default "/root/.cache/helm/repository")
      --repository-config string        path to the file containing repository names and URLs (default "/root/.config/helm/repositories.yaml")
Use "helm [command] --help" for more information about a command. 

completion

为指定的shell(bash或zsh)生成自动完成脚本。

helm completion bash -h 查看命令补全操作流程  


create

语法:helm create chartname

本地创建一个chart

[root@master helm]# helm create create firstchart
[root@master helm]# tree firstchart/
firstchart/
├── charts
├── Chart.yaml
├── templates
│   ├── deployment.yaml
│   ├── _helpers.tpl
│   ├── hpa.yaml
│   ├── ingress.yaml
│   ├── NOTES.txt
│   ├── serviceaccount.yaml
│   ├── service.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml 

firstchart目录下的templates目录中保存有部署的模板文件,values.yaml中定义了部署的变量,Chart.yaml文件包含有version(chart版本)和appVersion(包含应用的版本)


delete

从Kubernetes中删除指定名称的发布,它删除了与chart最后一个发布相关的所有资源。

使用--dry-run选项标记查看哪些发布将被删除,但并不会实际删除它们。

语法:helm delete [flags] RELEASE-NAME [...]

-bash-4.2# helm  list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mytomcat        default         2               2023-02-15 17:10:15.835263224 +0800 CST deployed        tomcat-0.4.3    7.0
-bash-4.2# helm delete mytomcat --dry-run
release "mytomcat" uninstalled
-bash-4.2# helm  list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mytomcat        default         2               2023-02-15 17:10:15.835263224 +0800 CST deployed        tomcat-0.4.3    7.0-bash-4.2# helm  list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mytomcat        default         2               2023-02-15 17:10:15.835263224 +0800 CST deployed        tomcat-0.4.3    7.0
-bash-4.2# helm delete mytomcat --dry-run
release "mytomcat" uninstalled
-bash-4.2# helm  list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mytomcat        default         2               2023-02-15 17:10:15.835263224 +0800 CST deployed        tomcat-0.4.3    7.0  

dependency

管理helm依赖

Helm chart将它们的依赖存储在charts/目录中。对于chart开发人员来说,管理一个声明所有依赖的依赖文件(requirements.yaml)通常更容易。

helm dependency命令对该文件进行操作,使得在所需的依赖和存储在charts/目录中的实际依赖项之间进行同步变得很容易。

requirements.yaml样例:

# requirements.yaml
dependencies:
- name: nginx
  version: "1.2.3"
  repository: "https://example.com/charts"
- name: memcached
  version: "3.2.1"
  repository: "https:///another.example.com/charts"

name是chart的名称,必须与chart的Chart.yaml中的名称匹配

version 声明版本

repository:url指向一个chart repo,后面的url也可以用别名代替,仅限于alias或者@,从2.2.0版本后支持file格式引用本地的chart。

样例:

# requirements.yaml
dependencies:
- name: nginx
  version: "1.2.3"
  repository: "file://../dependency-chart/nginx" 

helm dependency build:

语法:helm dependency build [flags] CHART

根据 requirements.lock文件重新构建charts/目录

如果没有找到 requirements.lock文件,helm dependency build将反映helm dependency update命令的行为,等同于update操作


helm dependency list:

语法:helm dependency list [flags] CHART

获取指定chart的依赖列表


helm dependency update:

语法:helm dependency update [flags] CHART

根据requirements.yaml文件内容更新charts目录


get

helm get hooks

语法:helm get hooks [flags] RELEASE-NAME

下载指定发布的所有钩子,钩子为YAML格式,并由YAML —\n分隔符分隔。

钩子样例:

pre-install: 在渲染模板之后,在 Kubernetes 中创建任何资源之前执行。 
post-install: 将所有资源加载到 Kubernetes 之后执行 
pre-delete: 在从 Kubernetes 删除任何资源之前执行 
post-delete: 删除所有 release 资源后执行 
pre-upgrade: 在渲染模板之后,但在任何资源加载到 Kubernetes 之前执行 
post-upgrade: 升级所有资源后执行 
pre-rollback: 在模板渲染后,回滚之前执行 
post-rollback: 回滚之后执行 
crd-install: 在运行任何其他检查之前添加 CRD 资源。这仅在 chart 中其他清单所使用的 CRD 定义上使用。 
test-success: 在运行 helm test,Pod 返回成功 (返回码 ==0) 执行 
test-failure: 在运行 helm test,Pod 返回失败 (返回码!=0) 执行  

helm get manifest

语法:helm get manifest [flags] RELEASE-NAME

获取为指定发布生成的清单,清单是由yaml编码的Kubernetes资源的表示,这些资源是由这个发布的chart生成的。如果一个chart依赖于其他chart,那么这些资源也将包括在清单中。

-bash-4.2# helm get manifest mytomcat
---
# Source: tomcat/templates/appsrv-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: mytomcat
  labels:
    app: tomcat
    chart: tomcat-0.4.3
    release: mytomcat
    heritage: Helm
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
      name: http
  selector:
    app: tomcat
    release: mytomcat

helm get notes

语法:helm get notes [flags] RELEASE-NAME

显示指定发布的chart提供的说明。

-bash-4.2# helm get notes mytomcat
NOTES:
1. Get the application URL by running these commands:
     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
           You can watch the status of by running 'kubectl get svc -w mytomcat'
  export SERVICE_IP=$(kubectl get svc --namespace default mytomcat -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
  echo http://$SERVICE_IP:  

helm get values

语法:helm get values [flags] RELEASE-NAME

查看release的values配置  

-bash-4.2# helm get values mytomcat
USER-SUPPLIED VALUES:
null 


history

helm history

语法:helm history [flags] RELEASE-NAME

打印指定发布的历史修订,默认最多返回256个修订,设置--max配置返回的修订列表的最大长度。

-bash-4.2# helm upgrade -f values.yaml mytomcat .
WARNING: This chart is deprecated
Release "mytomcat" has been upgraded. Happy Helming!
NAME: mytomcat
LAST DEPLOYED: Fri Feb 17 16:01:00 2023
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services mytomcat)
  export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
-bash-4.2# helm history mytomcat
REVISION        UPDATED                         STATUS          CHART           APP VERSION     DESCRIPTION
1               Fri Feb 17 14:28:50 2023        superseded      tomcat-0.4.3    7.0             Install complete
2               Fri Feb 17 16:01:00 2023        deployed        tomcat-0.4.3    7.0  

rollback

helm rollback

语法:helm rollback [flags] RELEASE-NAME verison-num

常搭配history使用,快速回滚指定版本。  

-bash-4.2# helm history mytomcat
REVISION        UPDATED                         STATUS          CHART           APP VERSION     DESCRIPTION
1               Fri Feb 17 14:28:50 2023        superseded      tomcat-0.4.3    7.0             Install complete
2               Fri Feb 17 16:01:00 2023        deployed        tomcat-0.4.3    7.0             Upgrade complete
-bash-4.2# helm rollback mytomcat
1  (App: 7.0, Chart: tomcat-0.4.3)  2  (App: 7.0, Chart: tomcat-0.4.3)
-bash-4.2# helm rollback mytomcat 1
Rollback was a success! Happy Helming!
-bash-4.2# helm history mytomcat
REVISION        UPDATED                         STATUS          CHART           APP VERSION     DESCRIPTION
1               Fri Feb 17 14:28:50 2023        superseded      tomcat-0.4.3    7.0             Install complete
2               Fri Feb 17 16:01:00 2023        superseded      tomcat-0.4.3    7.0             Upgrade complete
3               Fri Feb 17 16:07:00 2023        deployed        tomcat-0.4.3    7.0  

inspect/show

helm inspect/show

语法:helm inspect/show [CHART] [flags]

检查一个chart并显示信息,helm inspect命令打印Chart.yaml和values.yaml文件的内容。

-bash-4.2# helm show
This command consists of multiple subcommands to display information about a chart
Usage:
  helm show [command]
Aliases:
  show, inspect
Available Commands:
  all         show all information of the chart
  chart       show the chart's definition
  crds        show the chart's CRDs
  readme      show the chart's README
  values      show the chart's values 

常用参数

helm show chart [CHART]

输出Chart.yaml全部信息

helm show values

输出chart的values


install

helm install

语法:helm install [NAME] [CHART] [flags]

样例:

通过chart引用:helm install local_chart stable/mariadb
通过打包的chart路径:helm install local_chart ./nginx-1.2.3.tgz
通过未打包的chart目录:helm install local_chart ./nginx
通过绝对URL:helm install local_chart https://example.com/charts/nginx-1.2.3.tgz
通过chart引用和仓库URL:helm install local_chart –repo https://example.com/charts/ nginx

安装参数必须是chart引用、打包chart的路径、未打包chart目录的路径或URL。


覆盖chart中的值,可以使用--values选项并传递到文件中,也可以使用--set选项并从命令行传递配置。若要强制--set指定的值为字符串,请使用--set-string。如果一个值很大,因此你不希望使用--values或--set,则使用--set-file从文件中读取单个大值。

-bash-4.2# helm install -f myvalues.yaml ./redis
-bash-4.2# helm install --set name=prod ./redis
-bash-4.2# helm install --set-string long-int=1234567890 ./redis
-bash-4.2# helm install –set-file multiline-text=path/to/textfile  

若出现多个指定参数,最后的指定的文件或值优先设定,例如:

override.yaml、foo=newbar优先设定

-bash-4.2# helm install -f myvalues.yaml -f override.yaml ./redis
-bash-4.2# helm install --set foo=bar --set foo=newbar ./redis 

要在不安装chart的情况下检查生成的版本清单,可以组合--debug和--dry-run选项,但这仍然需要与Tiller服务端通信,helm3已经去掉了tiller,helm需要安装tiller。

-o, --output string Prints the output in the specified format. Allowed values: table, json, yaml (default "table")  
  • 注意status
-bash-4.2# helm install mytomcat1 mycharthub/tomcat --dry-run
WARNING: This chart is deprecated
NAME: mytomcat1
LAST DEPLOYED: Fri Feb 17 18:09:22 2023
NAMESPACE: default
STATUS: pending-install
REVISION: 1
TEST SUITE: None
HOOKS:
MANIFEST: 

lint

helm lint

语法:helm lint [flags] PATH

使用chart的路径作为参数,并运行一系列测试来验证chart是否格式良好,如果linter遇到了会导致chart安装失败的事情,它将发出[错误]消息。如果遇到违反约定或建议的问题,它将发出[警告]消息。

-bash-4.2# ll
总用量 0
drwxr-xr-x 4 root root 93 2月  14 17:21 firstchart
drwxr-xr-x 3 root root 96 2月  16 17:16 mysql
drwxr-xr-x 3 root root 77 2月  17 16:00 tomcat
-bash-4.2# helm lint mysql
==> Linting mysql
1 chart(s) linted, 0 chart(s) failed
-bash-4.2# helm lint tomcat
==> Linting tomcat
1 chart(s) linted, 0 chart(s) failed 

list/ls

helm list

语法:helm list [flags] [FILTER]

命令获取所有的发布列表,

-bash-4.2# helm ls
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mytomcat        default         3               2023-02-17 16:07:00.209312399 +0800 CST deployed        tomcat-0.4.3    7.0
-bash-4.2# helm list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
mytomcat        default         3               2023-02-17 16:07:00.209312399 +0800 CST deployed        tomcat-0.4.3    7.0  

package

helm package

语法:helm package [flags] [CHART-PATH] [...]

将一个chart打包为版本化的chart归档文件中,如果给定了一个路径,它将检查该chart(其中必须包含一个chart)路径,然后打包那个目录,如果没有指定路径,则在当前工作目录中查找chart。将当前目录构建到一个chart中。  

-bash-4.2# helm package firstchart/
Successfully packaged chart and saved it to: /root/myapp/helm/firstchart-0.1.0.tgz
-bash-4.2# ll
总用量 4
drwxr-xr-x 4 root root   93 2月  14 17:21 firstchart
-rw-r--r-- 1 root root 3757 2月  17 18:45 firstchart-0.1.0.tgz
drwxr-xr-x 3 root root   96 2月  16 17:16 mysql
drwxr-xr-x 3 root root   77 2月  17 16:00 tomcat


相关实践学习
深入解析Docker容器化技术
Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间不会有任何接口。Docker是世界领先的软件容器平台。开发人员利用Docker可以消除协作编码时“在我的机器上可正常工作”的问题。运维人员利用Docker可以在隔离容器中并行运行和管理应用,获得更好的计算密度。企业利用Docker可以构建敏捷的软件交付管道,以更快的速度、更高的安全性和可靠的信誉为Linux和Windows Server应用发布新功能。 在本套课程中,我们将全面的讲解Docker技术栈,从环境安装到容器、镜像操作以及生产环境如何部署开发的微服务应用。本课程由黑马程序员提供。 &nbsp; &nbsp; 相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
目录
相关文章
|
API 对象存储 Java
实现从oss(阿里云)服务器以附件形式下载文件(含批量下载)
实现从oss(阿里云)服务器以附件形式下载文件(含批量下载) 笔者在项目中写一个从阿里云服务器上面以附件形式下载文件的接口时,遇到了问题,网上搜索无任何相关的解决方案,最后通过通过自己查阅API文档,再结合自己的经验,实现了下载功能。
7487 0
|
9月前
|
安全 搜索推荐 数据建模
2026阿里云最新SSL证书价格参考:免费版申请流程与收费版最新活动价格
为网站部署SSL证书实现HTTPS加密是构建安全基石的首要步骤。阿里云数字证书管理服务提供一站式SSL证书解决方案,涵盖从免费测试到企业级高安全认证的全系列产品。SSL证书可加密数据、认证身份、满足合规要求、提升搜索引擎排名并避免浏览器警告。阿里云提供零成本启航的免费SSL证书申请服务,适用于个人网站、开发测试等场景。同时,2026年阿里云推出付费SSL证书优惠活动,新用户可享6折起,新老用户同享8折优惠,最低95元起,提供全面的安全保障和增值服务。
|
9月前
|
人工智能 监控 前端开发
AI英语App的开发
本项目打造AI英语学习App,构建“感知—思考—表达”闭环系统。聚焦多模态大模型(GPT-4o/Gemini)、高精度ASR/TTS、RAG知识检索与提示词链编排,融合发音评测、游戏化交互与流式响应优化,兼顾教学专业性与用户体验。(239字)
|
9月前
|
XML JSON 监控
阐述:关键词搜索京东商品列表API接口
京东关键词搜索商品列表API是其开放平台核心接口,支持按关键词检索商品,提供多条件筛选、分页排序及丰富字段(价格、销量、店铺、库存等),适用于选品、竞品分析、价格监控与联盟推广,需AppKey+签名认证。
|
6月前
|
监控 安全 前端开发
构建坚不可摧的防线:全方位保障 API 接口数据安全
本文系统拆解企业级API安全防护体系,涵盖鉴权、传输加密、防篡改、防重放、限流熔断、参数校验、日志监控与合规风控八大维度,提供JWT/OAuth2/HMAC等实战方案,强调HTTPS为底线、签名+幂等为关键、监控巡检为长效保障,助力开发者构建稳定、安全、可追溯的生产级接口防线。
845 0
|
存储 安全 Windows
硬盘接入电脑提示格式化?是什么原因?怎么解决?
有时候,当你将硬盘接入电脑时,看到系统弹出“使用驱动器中的光盘之前需要将其格式化”的提示,肯定会感到十分困惑和焦虑。这种情况不仅让人担心数据丢失,也可能影响正常使用。为什么硬盘会突然要求格式化?是硬盘出了问题,还是系统出现了故障?今天和大家一起聊一聊硬盘提示格式化的常见原因,以及可以采取哪些方法来解决它。
|
缓存 API Python
如何通过API获取拼多多商品详情数据?
注册开放平台账号,获取client_id与client_secret,调用鉴权接口换取access_token(有效期24小时)。通过GET请求查询商品详情,需传goods_id和access_token。响应包含商品名称、价格、销量及SKU库存等信息。注意处理code非0的错误,控制请求频率≤100次/分钟,建议指数退避重试。Python示例使用requests实现。
1407 0
|
存储 算法 Java
(五)漫谈分布式之一致性算法篇:谁说Paxos晦涩难懂?你瞧这不一学就会!
没在时代发展的洪流中泯然于众的道理很简单,是因为它们并不仅是空中楼阁般的高大上理论,而是有着完整落地的思想,它们已然成为构建分布式系统不可或缺的底层基石,而本文则来好好聊聊分布式与一致性思想的落地者:Paxos与Raft协议(算法)。
906 6
|
安全 关系型数据库 MySQL
国产麒麟服务器等保二级 配置规范(一)
国产麒麟服务器等保二级 配置规范(一)
1832 0
|
Oracle 关系型数据库 数据库
Oracle 查看当前会话 SESSION ID 方法
查看当前会话的session  ID 有如下三种方法:   1.   v$mystat视图   SQL> desc v$mystat  Name                ...
2712 0