1. TiDB-Operator 备份到 Minio

创建minio s3

  1. 初始化minio
minio server $HOME/operator/data --console-address :9090
  1. 设置region为上海

创建tidb-operator备份CR

1.备份CR配置文件backup-s3.yaml信息

apiVersion: pingcap.com/v1alpha1
kind: Backup
metadata:name: backup2s3-devnamespace: tidb-adminlabels:user: paul
spec:## Describes the compute resource requirements and limits of Backup.## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/resources:requests:cpu: 500mmemory: 512Milimits:cpu: 500mmemory: 512Mi## List of environment variables to set in the container, like v1.Container.Env.## Note that the following builtin env vars will be overwritten by values set here.## - S3_PROVIDER## - S3_ENDPOINT## - AWS_REGION## - AWS_ACL## - AWS_STORAGE_CLASS## - AWS_DEFAULT_REGION## - AWS_ACCESS_KEY_ID## - AWS_SECRET_ACCESS_KEY## - GCS_PROJECT_ID## - GCS_OBJECT_ACL## From is the TidbCluster to be backed up.## It takes high precedence than spec in BR. If `from` not set, cluster in BR will be backed up.#from:## Host is the address of the TidbCluster to be backed up, which is the service name of the TidbCluster, such as `basic-tidb`.#host: alpha-tidb## Port is the port of the TidbCluster to be backed up.#port: 4000## User is the accessing user of the TidbCluster to be backed up.#user: root## SecretName is the secret that contains the password of the accessing user of the TidbCluster to be backed up.# secretName: sh.helm.release.v1.tidb-operator.v1 ## TLSClientSecretName is the name of secret which stores tidb server client certificate.## Defaults to nil.# tlsClientSecretName: ""backupType: fullbackupMode: snapshot## TikvGCLifeTime specifies the safe gc life time for Backup.## The time limit during which data is retained for each GC, in the format of Go Duration.## When a GC happens, the current time minus this value is the safe point.## Defaults to 72h.tikvGCLifeTime: 72hs3:provider: awssecretName: minio-secretbucket: tidbussprefix: tidb/s3endpoint: http://192.168.1.2:9000## StorageSize is the PV size specified for the backup operation.## This value must be greater than the size of the TidbCluster to be backed up.## Defaults to 100Gi.storageSize: "100Gi"## BR configuration.## Ref: https://docs.pingcap.com/tidb/stable/backup-and-restore-toolbr:## Cluster specifies name of TidbCluster to be backed up.cluster: "alpha"## Namespace specifies namespace of TidbCluster to be backed up.clusterNamespace: "tidb-admin"## LogLevel is the log level. Defaults to `info`.# logLevel: "info"## StatusAddr is the HTTP listening address for the status report service. Defaults to empty.# statusAddr: ""## Concurrency is the size of thread pool on each node that execute the backup task.## Defaults to 4.concurrency: 4## RateLimit is the rate limit of the backup task, MB/s per node.## If set to 4, the speed limit is 4 MB/s.The speed limit is not set by default.# rateLimit: 0## TimeAgo presents back up the data before `timeAgo`, e.g. 1m, 1h. Defaults to empty.# timeAgo: 1m## Checksum specifies whether to verify the files after the backup is completed.## Defaults to `true``.# checksum: true## CheckRequirements specifies whether to check requirements before backup# checkRequirements: true## SendCredToTikv specifies whether the BR process passes its AWS or GCP privileges to the TiKV process.## Defaults to `true``.sendCredToTikv: true## OnLine specifies whether online during restore. Defaults to false.# onLine: false## Options specifies the extra arguments that BR supports. These options has highest priority.# options: []## ToolImage specifies the tool image used in `Backup`, which supports BR and Dumpling images.## For examples `spec.toolImage: pingcap/br:v5.2.0` or `spec.toolImage: pingcap/dumpling:v5.2.0`## For BR image, if it does not contain tag, Pod will use image 'ToolImage:${TiKV_Version}'.toolImage: pingcap/br:v6.5.5## ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.## If private registry is used, imagePullSecrets may be set.## You can also set this in service account.## Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod# imagePullSecrets:# - name: secretName## TableFilter specifies tables that match the table filter rules for BR or Dumpling.## Ref: https://docs.pingcap.com/tidb/stable/table-filter## Defaults to empty.# tableFilter: []## Affinity for Backup pod scheduling## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity# affinity: {}## UseKMS to decrypt the secrets. Defaults to false.useKMS: false## ServiceAccount Specify service account of Backup.serviceAccount: "tidb-backup-manager"## CleanPolicy specifies whether to clean backup data when the Backup CR is deleted, if not set, the backup data will be retained.## `Retain` represents that the backup data will be retained when the Backup CR is deleted.## `OnFailure` represents that the backup data will be cleaned only for the failed backups when the Backup CR is deleted.## `Delete` represents that the backup data will be cleaned when the Backup CR is deleted.cleanPolicy: Retain
  1. 执行创建备份
kubectl -n tidb-admin apply -f  backup-s3.yaml

备份错误与异常排查

  1. 错误日志如下:
E1105 10:41:10.821663       8 manager.go:408] Get backup metadata for backup files in s3://tidbuss/tidb/s3 of cluster tidb-admin/backup2s3-dev failed, err: read backup meta from bucket tidbuss and prefix tidb/s3: blob (key "backupmeta") (code=Unknown): BadRequest: Bad Requeststatus code: 400, request id: 1794B3FFD6488588, host id: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
I1105 10:41:10.841852       8 backup_status_updater.go:128] Backup: [tidb-admin/backup2s3-dev] updated successfully
error: read backup meta from bucket tidbuss and prefix tidb/s3: blob (key "backupmeta") (code=Unknown): BadRequest: Bad Requeststatus code: 400, request id: 1794B3FFD6488588, host id: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e
  1. tidb-operator br备份到minio s3异常排查
    通过对tidb-operator项目代码进行分析,定位到util.GetBRMetaData方法,文件位于cmd/backup-manager/app/util/util.go
// 编写单元测试用例
func TestGetBRMetaData(t *testing.T) {ctx := context.Background()os.Setenv("AWS_ACCESS_KEY_ID", "tidb")os.Setenv("AWS_SECRET_ACCESS_KEY", "Jianxin123")provider := v1alpha1.StorageProvider{S3: &v1alpha1.S3StorageProvider{Provider:   "aws",Bucket:     "tidbuss",Prefix:     "tidb/s3",Endpoint:   "http://192.168.1.2:9000",SecretName: "minio-secrete",},}_, err := GetBRMetaData(ctx, provider)log.Fatalln(err)}// 修改原始方法,通过debug日志显示根本原因
// GetBRMetaData get backup metadata from cloud storage
func GetBRMetaData(ctx context.Context, provider v1alpha1.StorageProvider) (*kvbackup.BackupMeta, error) {s, err := util.NewStorageBackend(provider, &util.StorageCredential{})if err != nil {return nil, err}defer s.Close()var metaData []byte// use exponential backoff, every retry duration is duration * factor ^ (used_step - 1)backoff := wait.Backoff{Duration: time.Second,Steps:    6,Factor:   2.0,Cap:      time.Minute,}fmt.Println("bucket", s.GetBucket())//	_, err = s.Attributes(ctx, "backupmeta")obj, err := s.List(&blob.ListOptions{Prefix: "tidb/s3"}).Next(ctx)fmt.Println("xx bucket", err, obj)readBackupMeta := func() error {exist, err := s.Exists(ctx, "backupmeta")if err != nil {return err}fmt.Println("IS existed", exist)if !exist {return fmt.Errorf("%s not exist", constants.MetaFile)}metaData, err = s.ReadAll(ctx, constants.MetaFile)if err != nil {return err}return nil}fmt.Println("xxxx", readBackupMeta())isRetry := func(err error) bool {return !strings.Contains(err.Error(), "not exist")}err = retry.OnError(backoff, isRetry, readBackupMeta)if err != nil {return nil, errors.Annotatef(err, "read backup meta from bucket %s and prefix %s", s.GetBucket(), s.GetPrefix())}backupMeta := &kvbackup.BackupMeta{}err = proto.Unmarshal(metaData, backupMeta)if err != nil {return nil, errors.Annotatef(err, "unmarshal backup meta from bucket %s and prefix %s", s.GetBucket(), s.GetPrefix())}return backupMeta, nil
}

在修改后的方法中,定位到Bucket的Exists、Attribute的方法无法获得有用排查错误信息,转而采用List方法,李处minio s3存储的backupmeta文件,错误日志提示为缺乏region信息。

go test -timeout 30s -run ^TestGetBRMetaData$
bucket tidbuss
xx bucket blob (code=Unknown): AuthorizationHeaderMalformed: The authorization header is malformed; the region is wrong; expecting 'shanghai'.status code: 400, request id: 1794B4674A2D5A48, host id: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8 <nil>
xxxx blob (key "backupmeta") (code=Unknown): BadRequest: Bad Requeststatus code: 400, request id: 1794B4674B073F88, host id: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8

测试用例中的数据与backup-s3.yaml中的s3相关配置一直,其单元测试复现结果指向region配置项。

  1. 在单元测试中加入region配置
func TestGetBRMetaData(t *testing.T) {ctx := context.Background()os.Setenv("AWS_ACCESS_KEY_ID", "tidb")os.Setenv("AWS_SECRET_ACCESS_KEY", "Jianxin123")provider := v1alpha1.StorageProvider{S3: &v1alpha1.S3StorageProvider{Provider:   "aws",Region:     "shanghai",Bucket:     "tidbuss",Prefix:     "tidb/s3",Endpoint:   "http://192.168.1.2:9000",SecretName: "minio-secrete",},}_, err := GetBRMetaData(ctx, provider)log.Fatalln(err)}

重跑该测试用例,显示测试通过,说明配置文件中s3相关内容中region为必填字段,需与minio的region配置保持一致

hbu@Pauls-MacBook-Air util % go test -timeout 30s -run ^TestGetBRMetaData$
bucket tidbuss
xx bucket EOF <nil>
IS existed true
xxxx <nil>
IS existed true
2023/11/05 18:52:00 <nil>
exit status 1
FAIL    github.com/pingcap/tidb-operator/cmd/backup-manager/app/util    0.442s

解决问题

  1. 修改tidb-operator备份到s3配置文件backup2s3-dev.yaml,在s3配置中添加region字段。
apiVersion: pingcap.com/v1alpha1
kind: Backup
metadata:name: backup2s3-devnamespace: tidb-adminlabels:user: paul
spec:## Describes the compute resource requirements and limits of Backup.## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/resources:requests:cpu: 500mmemory: 512Milimits:cpu: 500mmemory: 512Mi## List of environment variables to set in the container, like v1.Container.Env.## Note that the following builtin env vars will be overwritten by values set here.## - S3_PROVIDER## - S3_ENDPOINT## - AWS_REGION## - AWS_ACL## - AWS_STORAGE_CLASS## - AWS_DEFAULT_REGION## - AWS_ACCESS_KEY_ID## - AWS_SECRET_ACCESS_KEY## - GCS_PROJECT_ID## - GCS_OBJECT_ACL## From is the TidbCluster to be backed up.## It takes high precedence than spec in BR. If `from` not set, cluster in BR will be backed up.#from:## Host is the address of the TidbCluster to be backed up, which is the service name of the TidbCluster, such as `basic-tidb`.#host: alpha-tidb## Port is the port of the TidbCluster to be backed up.#port: 4000## User is the accessing user of the TidbCluster to be backed up.#user: root## SecretName is the secret that contains the password of the accessing user of the TidbCluster to be backed up.# secretName: sh.helm.release.v1.tidb-operator.v1 ## TLSClientSecretName is the name of secret which stores tidb server client certificate.## Defaults to nil.# tlsClientSecretName: ""backupType: fullbackupMode: snapshot## TikvGCLifeTime specifies the safe gc life time for Backup.## The time limit during which data is retained for each GC, in the format of Go Duration.## When a GC happens, the current time minus this value is the safe point.## Defaults to 72h.tikvGCLifeTime: 72hs3:provider: awssecretName: minio-secretregion: shanghaibucket: tidbussprefix: tidb/s3endpoint: http://192.168.1.2:9000## StorageSize is the PV size specified for the backup operation.## This value must be greater than the size of the TidbCluster to be backed up.## Defaults to 100Gi.storageSize: "100Gi"## BR configuration.## Ref: https://docs.pingcap.com/tidb/stable/backup-and-restore-toolbr:## Cluster specifies name of TidbCluster to be backed up.cluster: "alpha"## Namespace specifies namespace of TidbCluster to be backed up.clusterNamespace: "tidb-admin"## LogLevel is the log level. Defaults to `info`.# logLevel: "info"## StatusAddr is the HTTP listening address for the status report service. Defaults to empty.# statusAddr: ""## Concurrency is the size of thread pool on each node that execute the backup task.## Defaults to 4.concurrency: 4## RateLimit is the rate limit of the backup task, MB/s per node.## If set to 4, the speed limit is 4 MB/s.The speed limit is not set by default.# rateLimit: 0## TimeAgo presents back up the data before `timeAgo`, e.g. 1m, 1h. Defaults to empty.# timeAgo: 1m## Checksum specifies whether to verify the files after the backup is completed.## Defaults to `true``.# checksum: true## CheckRequirements specifies whether to check requirements before backup# checkRequirements: true## SendCredToTikv specifies whether the BR process passes its AWS or GCP privileges to the TiKV process.## Defaults to `true``.sendCredToTikv: true## OnLine specifies whether online during restore. Defaults to false.# onLine: false## Options specifies the extra arguments that BR supports. These options has highest priority.# options: []## ToolImage specifies the tool image used in `Backup`, which supports BR and Dumpling images.## For examples `spec.toolImage: pingcap/br:v5.2.0` or `spec.toolImage: pingcap/dumpling:v5.2.0`## For BR image, if it does not contain tag, Pod will use image 'ToolImage:${TiKV_Version}'.toolImage: pingcap/br:v6.5.5## ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.## If private registry is used, imagePullSecrets may be set.## You can also set this in service account.## Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod# imagePullSecrets:# - name: secretName## TableFilter specifies tables that match the table filter rules for BR or Dumpling.## Ref: https://docs.pingcap.com/tidb/stable/table-filter## Defaults to empty.# tableFilter: []## Affinity for Backup pod scheduling## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity# affinity: {}## UseKMS to decrypt the secrets. Defaults to false.useKMS: false## ServiceAccount Specify service account of Backup.serviceAccount: "tidb-backup-manager"## CleanPolicy specifies whether to clean backup data when the Backup CR is deleted, if not set, the backup data will be retained.## `Retain` represents that the backup data will be retained when the Backup CR is deleted.## `OnFailure` represents that the backup data will be cleaned only for the failed backups when the Backup CR is deleted.## `Delete` represents that the backup data will be cleaned when the Backup CR is deleted.cleanPolicy: Retain
  1. 删除原有运行Backup CR
kubectl -n tidb-admin delete -f backup-s3.yaml
  1. 从minio中删除原有备份地址中的文件

重新运行备份

hbu@Pauls-MacBook-Air backup % kubectl -n tidb-admin apply -f  backup-s3.yaml
backup.pingcap.com/backup2s3-dev created

检查结果

hbu@Pauls-MacBook-Air data % kubectl  -n tidb-admin get pod                          
NAME                                       READY   STATUS      RESTARTS      AGE
alpha-discovery-68588cd598-k5m56           1/1     Running     1 (12d ago)   15d
alpha-pd-0                                 1/1     Running     1 (12d ago)   15d
alpha-tidb-0                               2/2     Running     2 (12d ago)   15d
alpha-tikv-0                               1/1     Running     1 (12d ago)   15d
backup-backup2s3-dev-l5rq4                 0/1     Completed   0             33s
tidb-controller-manager-54694444b9-ncj8z   1/1     Running     6             15d
hbu@Pauls-MacBook-Air data % kubectl  -n tidb-admin get backup
NAME              TYPE   MODE       STATUS     BACKUPPATH             BACKUPSIZE   COMMITTS             LOGTRUNCATEUNTIL   AGE
backup2s3-dev     full   snapshot   Complete   s3://tidbuss/tidb/s3   271 kB       445430282047455233                      42s

修改后的备份配置文件,成功触发tidb-operator备份到s3兼容存储minio。

总结

如果参照TiDB Operator官方文档,TiDB Operator执行备份到S3兼容存储minio相对容易一些。但是,TiDB Operator业务订制化开发工作需要开发者对相关字段掌握更多,才能更好的排查错误。

另外,AWS S3和Minio毕竟还是两种产品,有关Minio region设置和应用方式,也是开发过程需要关注的功能点。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/185460.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

分享86个简历竞聘PPT,总有一款适合您

分享86个简历竞聘PPT&#xff0c;总有一款适合您 86个简历竞聘PPT下载链接&#xff1a;https://pan.baidu.com/s/130iX0EIH6J-PFzb6HcntcQ?pwd8888 提取码&#xff1a;8888 Python采集代码下载链接&#xff1a;采集代码.zip - 蓝奏云 学习知识费力气&#xff0c;收集整…

【追求卓越10】算法--跳表

引导 在上一节中&#xff0c;我们学习到二分查找&#xff0c;惊叹于它超高的效率&#xff08;时间复杂度为O(logn)&#xff09;。但是二分查找有一个局限性就是依赖于数组&#xff0c;这就导致它应用并不广泛。 那么适用链表是否可以做到呢&#xff1f;答案是可以的。只不过要复…

【程序员的自我修养03】深入了解ELF文件格式

绪论 大家好&#xff0c;欢迎来到【程序员的自我修养】专栏。正如其专栏名&#xff0c;本专栏主要分享学习《程序员的自我修养——链接、装载与库》的知识点以及结合自己的工作经验以及思考。编译原理相关知识本身就比较有难度&#xff0c;我会尽自己最大的努力&#xff0c;争取…

嵌入式Linux:ARM驱动+QT应用+OpenCV人脸识别项目实现

一、前言&#xff1a; 这个项目主要分为两部分&#xff0c;客户端&#xff08;ARM板端&#xff09;负责利用OpenCV采集人脸数据&#xff0c;利用TCP将人脸数据发送给服务器&#xff0c;然后服务器根据人脸数据进行人脸识别&#xff0c;将识别后的结果返还给客户端&#xff0c;客…

请大数据把奥威BI分析工具推给每一个财务!

这个财务指标怎么算&#xff1f;那些数据什么时候能拿到&#xff1f;看完报表&#xff0c;发现某部门上个月的支出涨幅过大&#xff0c;想了解原因怎么办&#xff1f;……财务人&#xff0c;你是不是每个月都把时间消耗在这些事情上了&#xff1f;那你可得快接住这个BI大数据分…

[个人笔记] Apache2.4配置TLS1.3安装openssl1.1.1

Linux - 运维篇 第二章 Apache2.4配置TLS1.3&安装openssl1.1.1 Linux - 运维篇系列文章回顾Apache2.4配置TLS1.3&安装openssl1.1.1参考来源 系列文章回顾 第一章 php-fpm编译和使用openssl扩展 Apache2.4配置TLS1.3&安装openssl1.1.1 [rootlocalhost ~]# yum ins…

网站文章采集软件大盘点

在信息时代&#xff0c;随着互联网的不断发展和普及&#xff0c;获取、整理和利用海量信息成为各行业的共同挑战。在这个背景下&#xff0c;网站文章采集技术应运而生&#xff0c;成为满足信息需求的重要工具。本文将对网站文章采集及其相关软件进行深入探讨&#xff0c;为读者…

@Openssh【7.x升级9.0版(Centos7.9,rpm)】

文章目录 1.版本查看2.配置备份3.软件包openssh9.0下载4.升级openssh9.0版本5.配置备份恢复6.服务器启动验证及问题排查 1.版本查看 #系统版本 [rootHZLOPENSSHTEST ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)#openssh版本 [rootHZLOPENSSHTEST ~]# r…

Linux文件截断命令(truncate head tail dd)

目录 一、truncate功能概述实例&#xff08;可用于删除文件末尾指定大小的内容&#xff09; 二、head功能概述实例&#xff08;可用于删除文件末尾指定大小的内容&#xff09; 三、tail功能概述&#xff1a;实例&#xff08;可用于删除文件开头指定大小的内容&#xff09; 四、…

Golang语言基础之切片

概述 数组的长度是固定的并且数组长度属于类型的一部分&#xff0c;所以数组有很多的局限性 func arraySum(x [3]int) int{sum : 0for _, v : range x{sum sum v}return sum } 这个求和函数只能接受 [3]int 类型&#xff0c;其他的都不支持。 切片 切片&#xff08;Slic…

virustotal的使用

www.virustotal.com是一个恶意代码扫描网站&#xff0c;提交时需要验证码。 该网站有近百个病毒引擎的支持。 该网站最有用的地方在于&#xff0c;这是一个交互式的恶意代码检测网站&#xff0c;这样的模式有一个隐形的福利&#xff0c;那就是为病毒木马爱好者提供了攻防一体…

市面上这么多SD-WAN服务商,究竟有何不同?

随着数字化浪潮的不断发展&#xff0c;企业网络已经成为了现代企业中不可缺少的一部分。而提供企业组网服务的SD-WAN服务商也呈现出快速增长的趋势。但是&#xff0c;市场上有这么多SD-WAN服务商&#xff0c;各个服务商技术实现方案非常相似&#xff0c;那么这些服务商之间到底…

人工智能驱动的医疗辅助:陪诊系统的技术原理与应用

随着人工智能技术的不断发展&#xff0c;医疗领域也迎来了新的可能性。本文将深入探讨陪诊系统的技术原理及其在医疗领域中的应用。我们将重点关注人工智能的核心概念&#xff0c;如自然语言处理、机器学习和语音识别&#xff0c;以解释陪诊系统是如何在医疗环境中发挥作用的。…

配置spring boot3后redis NOAUTH Authentication required

升级到spring boot3之后&#xff0c;redis报错 redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required检查完密码之后都没有问题&#xff0c;后来发现是配置的原因。 在application.properties配置文件里 加上.data 原来是spring.redis.passwor…

html5各行各业官网模板源码下载(1)

文章目录 1.来源2.源码模板2.1 HTML5白色简洁设计师网站模板 作者&#xff1a;xcLeigh 文章地址&#xff1a;https://blog.csdn.net/weixin_43151418/article/details/134682321 html5各行各业官网模板源码下载&#xff0c;这个主题覆盖各行业的html官网模板&#xff0c;效果模…

图解Redis适用场景

Redis以其速度而闻名。 1 业务数据缓存 1.1 通用数据缓存 string&#xff0c;int&#xff0c;list&#xff0c;map。Redis 最常见的用例是缓存对象以加速 Web 应用程序。 此用例中&#xff0c;Redis 将频繁请求的数据存储在内存。允许 Web 服务器快速返回频繁访问的数据。这…

Make sure bypassing Vue built-in sanitization is safe here.

一、问题描述 二、问题分析 XSS(跨站脚本攻击) XSS攻击通常指的是通过利用网页开发时留下的漏洞&#xff0c;通过巧妙的方法注入恶意指令代码到网页&#xff0c;使用户加载并执行攻击者恶意制造的网页程序。这些恶意网页程序通常是JavaScript&#xff0c;但实际上也可以包括J…

【注册表】Sublime Text添加到右键菜单

官网下载 windows下地地址: http://www.sublimetext.com/download_thanks?targetwin-x64设置右键菜单和菜单小图标 win R打开运行&#xff0c;并输入regedit打开注册表编辑器依次找到HKEY_CLASSESS_ROOT -> * -> Shell&#xff0c;下面新建项&#xff0c; 这个项的名…

PAT乙级(CPP基础STL)

万能头&#xff0c;库 #include<bits/stdc.h> string数组 //string的初始化 string s"abc"; string(6,A); //string取子串&#xff08;起始位置&#xff0c;长度&#xff09; string s"Hello World!"; cout << s.substr(6) << endl…

【新手解答7】深入探索 C 语言:代码缩进 + 变量作用域、静态变量 + 变量名和函数名重名

C语言的相关问题解答 写在最前面问题一&#xff1a;代码缩进问题二&#xff1a;C语言中的变量作用域变量作用域静态变量总结 问题三&#xff1a;变量名和函数名重名相关解析变量 sumC 语言中&#xff0c;sum 并不是一个内置的函数名或保留字变量名和函数名重名&#xff1f;总结…