云原生之Docker容器的存储管理

news2024/11/17 6:44:15

一、检查本地docker环境

1.检查宿主机系统版本

[root@docker ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core) 

2.检查docker版本

[root@docker ~]# docker -v
Docker version 20.10.18, build b40c2f6

二、创建一个测试httpd容器

1.创建测试目录

[root@docker ~]# mkdir -p /data/test
[root@docker ~]# cd /data/test/
[root@docker test]# 

2.创建httpd容器

docker run -d  --name web01 -p 82:80 -v /data/test/htdocs/:/usr/local/apache2/htdocs/ httpd

image.png

3.查看容器状态

[root@docker test]# docker ps
CONTAINER ID   IMAGE                         COMMAND                  CREATED              STATUS              PORTS                                                 NAMES
05d35ba971ad   httpd                         "httpd-foreground"       About a minute ago   Up About a minute   0.0.0.0:82->80/tcp, :::82->80/tcp                     web01

4.查看容器详细信息

[root@docker test]# docker inspect web01 
[
    {
        "Id": "05d35ba971ad78179a7ab7a93dfb4c59faeb5872152f03a897144f4e5040b7ee",
        "Created": "2022-10-24T09:15:39.545943014Z",
        "Path": "httpd-foreground",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 113766,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2022-10-24T09:15:39.826230552Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:dabbfbe0c57b6e5cd4bc089818d3f664acfad496dc741c9a501e72d15e803b34",
        "ResolvConfPath": "/var/lib/docker/containers/05d35ba971ad78179a7ab7a93dfb4c59faeb5872152f03a897144f4e5040b7ee/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/05d35ba971ad78179a7ab7a93dfb4c59faeb5872152f03a897144f4e5040b7ee/hostname",
        "HostsPath": "/var/lib/docker/containers/05d35ba971ad78179a7ab7a93dfb4c59faeb5872152f03a897144f4e5040b7ee/hosts",
        "LogPath": "/var/lib/docker/containers/05d35ba971ad78179a7ab7a93dfb4c59faeb5872152f03a897144f4e5040b7ee/05d35ba971ad78179a7ab7a93dfb4c59faeb5872152f03a897144f4e5040b7ee-json.log",
        "Name": "/web01",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/data/test/htdocs/:/usr/local/apache2/htdocs/"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "82"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "host",
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/97d6b86a78f355c15fb43d539fc284b60f464c0ee768d87a8e5cbe62e3a62626-init/diff:/var/lib/docker/overlay2/76281b2c0491c38ccd64dc2c9164c58eefd014a7294117c4962515bf75419681/diff:/var/lib/docker/overlay2/1f4f0f5f0c604cca28ad955db0b19c04f93026468448ca98f43f4eeaa69b4186/diff:/var/lib/docker/overlay2/47f840069670e495b72b41d3aba5e0ed52346af2da30c4b9accc0b9866d9e3f9/diff:/var/lib/docker/overlay2/e1042193e6b8e7fefe86fc987757ee0a9c7d1f297db466e08af143ead1095138/diff:/var/lib/docker/overlay2/4649e6ac724d477b2fe8db2da934d572eaaaa946a847936794b506edf8b0c87d/diff",
                "MergedDir": "/var/lib/docker/overlay2/97d6b86a78f355c15fb43d539fc284b60f464c0ee768d87a8e5cbe62e3a62626/merged",
                "UpperDir": "/var/lib/docker/overlay2/97d6b86a78f355c15fb43d539fc284b60f464c0ee768d87a8e5cbe62e3a62626/diff",
                "WorkDir": "/var/lib/docker/overlay2/97d6b86a78f355c15fb43d539fc284b60f464c0ee768d87a8e5cbe62e3a62626/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/data/test/htdocs",
                "Destination": "/usr/local/apache2/htdocs",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "05d35ba971ad",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/apache2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "HTTPD_PREFIX=/usr/local/apache2",
                "HTTPD_VERSION=2.4.52",
                "HTTPD_SHA256=0127f7dc497e9983e9c51474bed75e45607f2f870a7675a86dc90af6d572f5c9",
                "HTTPD_PATCHES="
            ],
            "Cmd": [
                "httpd-foreground"
            ],
            "Image": "httpd",
            "Volumes": null,
            "WorkingDir": "/usr/local/apache2",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {},
            "StopSignal": "SIGWINCH"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "99696b43e61670fc9f98c0d84d6da281fe4db3ec52dc5210895014dbe4ca69a4",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "82"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "82"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/99696b43e616",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "276ea4df3a145005646c1f457c57ad47ab3e367cc6a2c15ce78bc2b0a198b25d",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "49542796523d70c8ccea7b297c45542ee4b5f30be2d9e1420cdf9ea57c5864fe",
                    "EndpointID": "276ea4df3a145005646c1f457c57ad47ab3e367cc6a2c15ce78bc2b0a198b25d",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]

三、宿主机目录内更新文件,验证容器内读取

1.进入容器宿主机挂载目录

[root@docker test]# pwd
/data/test
[root@docker test]# cd htdocs/
[root@docker htdocs]# ls
[root@docker htdocs]# 

2.新建index.html文件

echo "Docker technology plays an important role in today's society." > index.html

3.查看容器内index.html

[root@docker htdocs]# docker exec -it web01 /bin/bash
root@05d35ba971ad:/usr/local/apache2# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs	modules
root@05d35ba971ad:/usr/local/apache2# cd htdocs/
root@05d35ba971ad:/usr/local/apache2/htdocs# ls
index.html
root@05d35ba971ad:/usr/local/apache2/htdocs# cat index.html 
Docker technology plays an important role in today's society.

四、删除测试容器,查看宿主机index.heml

[root@docker htdocs]# docker stop web01 
web01
[root@docker htdocs]# docker rm  web01 
web01
[root@docker htdocs]# ls
index.html
[root@docker htdocs]# cat index.html 
Docker technology plays an important role in today's society.

五、容器的数据卷管理

1.再次运行测试容器

[root@docker htdocs]# docker run -d  --name web02 -p 85:80 -v /usr/local/apache2/htdocs/  httpd
f028c9fbcddb186dd616a5bf7990378abc9f492e9275f0f5b587ef60a30145e3

2.查看容器默认挂载的数据卷

[root@docker htdocs]# docker inspect web02  |grep Mounts -A5
        "Mounts": [
            {
                "Type": "volume",
                "Name": "3b1eab4eb072a43375068c8ff534028de2a7f6dd6aeceb60c0d1584c4bc046a6",
                "Source": "/var/lib/docker/volumes/3b1eab4eb072a43375068c8ff534028de2a7f6dd6aeceb60c0d1584c4bc046a6/_data",
                "Destination": "/usr/local/apache2/htdocs",

3.进入容器内编辑index.html内容

[root@docker htdocs]# docker exec -it web02  /bin/bash
root@f028c9fbcddb:/usr/local/apache2# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs	modules
root@f028c9fbcddb:/usr/local/apache2# cd htdocs/
root@f028c9fbcddb:/usr/local/apache2/htdocs# echo "Docker technology plays an important role in today's society." > index.html
root@f028c9fbcddb:/usr/local/apache2/htdocs# 

4.宿主机访问内容

[root@docker htdocs]# curl 127.0.0.1:85
Docker technology plays an important role in today's society.

5.在宿主机默认挂载卷检查index.html

[root@docker htdocs]# docker inspect web02  |grep Mounts -A5
        "Mounts": [
            {
                "Type": "volume",
                "Name": "3b1eab4eb072a43375068c8ff534028de2a7f6dd6aeceb60c0d1584c4bc046a6",
                "Source": "/var/lib/docker/volumes/3b1eab4eb072a43375068c8ff534028de2a7f6dd6aeceb60c0d1584c4bc046a6/_data",
                "Destination": "/usr/local/apache2/htdocs",
[root@docker htdocs]# cd /var/lib/docker/volumes/3b1eab4eb072a43375068c8ff534028de2a7f6dd6aeceb60c0d1584c4bc046a6/_data
[root@docker _data]# ls
index.html
[root@docker _data]# cat index.html 
Docker technology plays an important role in today's society.

6.删除容器,验证数据持久化

[root@docker _data]# docker stop web02 
web02
[root@docker _data]# docker rm  web02 
web02
[root@docker _data]# ls
index.html
[root@docker _data]# pwd
/var/lib/docker/volumes/3b1eab4eb072a43375068c8ff534028de2a7f6dd6aeceb60c0d1584c4bc046a6/_data
[root@docker _data]# cat index.html 
Docker technology plays an important role in today's society.

六、创建数据卷容器

1.创建一个数据卷容器test03

[root@docker htdocs]#  docker create --name test03 -v /data/test/htdocs:/usr/local/apache2/htdocs -v /other/tools/ busybox 
3aab455cee0bccd7776ed43bee1d083a4fb61275e7cfd8b63a3e0de9a9b6b9c5


2.查看数据卷容器详细信息

[root@docker htdocs]# docker inspect test03 |grep Mounts -A16
        "Mounts": [
            {
                "Type": "volume",
                "Name": "795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db",
                "Source": "/var/lib/docker/volumes/795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db/_data",
                "Destination": "/other/tools",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "/data/test/htdocs",
                "Destination": "/usr/local/apache2/htdocs",
                "Mode": "",
                "RW": true,
[root@docker htdocs]# 

七、创建test04测试容器

1.创建test04容器

[root@docker htdocs]#  docker run --name test04 -td -p 86:80 --volumes-from test03  busybox
cfde4db1ff755695a7b2f4c10e863c9fdf8e9a0f7f4a132d2fdd2fb0e4c497f8


2.检查test04容器的volume部分

[root@docker htdocs]# docker inspect test04 |grep Mounts
        "Mounts": [
[root@docker htdocs]# docker inspect test04 |grep Mounts -A16
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/data/test/htdocs",
                "Destination": "/usr/local/apache2/htdocs",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db",
                "Source": "/var/lib/docker/volumes/795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db/_data",
                "Destination": "/other/tools",
                "Driver": "local",
                "Mode": "",
                "RW": true,


3.检查test04容器中index.html

[root@docker htdocs]# docker exec -it test04 /bin/bash
OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown
[root@docker htdocs]# docker exec -it test04 /bin/sh
/ # cat /usr/local/apache2/htdocs/index.html
Docker technology plays an important role in today's society.
/ # 


4.在test04容器挂载路径创建文件,验证宿主机路径信息

/ # cd /other/tools/
/other/tools # ls
/other/tools # echo "aa-test-out " > test.out
/other/tools # 

5.检查数据卷中的文件

[root@docker htdocs]# docker inspect test04 |grep Mounts
        "Mounts": [
[root@docker htdocs]# docker inspect test04 |grep Mounts -A16
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/data/test/htdocs",
                "Destination": "/usr/local/apache2/htdocs",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db",
                "Source": "/var/lib/docker/volumes/795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db/_data",
                "Destination": "/other/tools",
                "Driver": "local",
                "Mode": "",
                "RW": true,
[root@docker htdocs]# cd /var/lib/docker/volumes/795b0038d6092015781b524d85e95252326787f9e5db45b703666f3ca587c1db/_data
[root@docker _data]# ls
test.out
[root@docker _data]# cat test.out 
aa-test-out 

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

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

相关文章

Python版本PathPlanning运动规划库中RotationToWorldFrame函数内部计算过程分析

本文主要对Python版本PathPlanning运动规划库中RotationToWorldFrame函数的内部计算过程分析,包括相关必备python基础和计算过程分析两部分,并给出了等效的MATLAB版本计算过程程序,方便分析对比。 (注:RotationToWorld…

【春节旅游攻略】南京周边出发,小众又好玩的景点推荐

【写在前面】 过年了,今天咱不谈技术,聊聊轻松的话题,旅游,其实博主很喜欢去外面走走看的,特汇总了一个4天3晚的旅行攻略,说走就走,带上自己的亲人多看看外面的锦世繁华。 三人行,…

使用最小二乘法和最大似然法估计非线性模型

专注系列化、高质量的R语言教程推文索引 | 联系小编 | 付费合集本文是年前的最后一篇推文,我们来学习一下使用最小二乘法和最大似然法进行非线性模型估计。模型估计是指,在模型形式已知的情况下,求解出可以使已有数据与模型形式最大程度上相符…

【日常系列】LeetCode《28·动态规划3》

数据规模->时间复杂度 <10^4 &#x1f62e;(n^2) <10^7:o(nlogn) <10^8:o(n) 10^8<:o(logn),o(1) 内容 二维数组中的路径问题 买卖股票的最佳时机 lc 62【剑指 098】【top100】&#xff1a;不同路径 https://leetcode.cn/problems/unique-paths/ 提示&#x…

分享优秀的视频地址

【2022 RISC-V中国峰会-芯来演讲合集】https://www.bilibili.com/video/BV1mV4y1W785?vd_source733efcf14020a43e7dac58e4c28ca0c8【计算机组成与设计&#xff1a;RISC-V【浙江大学】】https://www.bilibili.com/video/BV1tz411z7GN?vd_source733efcf14020a43e7dac58e4c28ca0…

【Dat图片的位异或解密】

文章目录 异或一、图片字节标识二、开始异或计算异或 异或(eor)是一个数学运算符。它应用于逻辑运算。异或的数学符号为"⊕"&#xff0c;计算机符号为"eor"。其运算法则为: a⊕b (a ∧ b) ∨ (a ∧b) 如果a、b两个值不相同&#xff0c;则异或结果为1。…

Tkinter的Label与Button

Tkinter是Python的一个内置包&#xff0c;主要用于简单的界面设计&#xff0c;使用起来非常方便。 目录 一、创建界面 1. 具体步骤 1.1 导入tkinter包 1.2 tk.Tk()函数&#xff1a;创建一个主界面&#xff0c;并命名为root 1.3 root.title()函数&#xff1a;给root界面设置…

API 接口案例--基于 MySQL 数据库 + Express对外提供用户列表的 API 接口服务

API 接口案例1. 案例需求2. 主要的实现步骤3. 搭建项目的基本结构4. 创建基本的服务器5. 创建 db 数据库操作模块6. 创建 user_ctrl 模块7. 创建 user_router 模块8. 导入并挂载路由模块9. 使用 try…catch 捕获异常1. 案例需求 基于 MySQL 数据库 Express 对外提供用户列表的…

【论文速递】WACV2022 - 基于小样本分割的多尺度Non-Novel片段消除方法

【论文速递】WACV2022 - 基于小样本分割的多尺度Non-Novel片段消除方法 【论文原文】&#xff1a;Elimination of Non-Novel Segments at Multi-Scale for Few-Shot Segmentation 获取地址&#xff1a;https://openaccess.thecvf.com/content/WACV2023/papers/Kayabasi_Elimi…

【睿睿的2022年度总结和2023的目标】

博客主页&#xff1a;张栩睿的博客主页欢迎关注&#xff1a;点赞收藏留言系列专栏&#xff1a;c语言学习家人们写博客真的很花时间的&#xff0c;你们的点赞和关注对我真的很重要&#xff0c;希望各位路过的朋友们能多多点赞并关注我&#xff0c;我会随时互关的&#xff0c;欢迎…

畅捷通T+与道一云对接集成报销凭证

畅捷通T与道一云对接集成获取报销信息列表连通凭证创建(报销保险费&#xff08;甘肃&#xff09;)数据源系统:道一云在道一云坚实的技术基础上&#xff0c;道一云推出全新升级的2.0产品矩阵&#xff0c;分别是低码平台、智能门户、场景应用。基于云原生底座&#xff0c;为企业提…

Allegro如何设置等长规则操作指导

Allegro如何设置等长规则操作指导 PCB设计需要给某一组信号做组间等长的时候,需要给这个组设置等长规则,如下图 以给以下两个网络设置等长规则为例 具体操作如下 打开规则管理器

【华为上机真题 2023】寻找相同子串

&#x1f388; 作者&#xff1a;Linux猿 &#x1f388; 简介&#xff1a;CSDN博客专家&#x1f3c6;&#xff0c;华为云享专家&#x1f3c6;&#xff0c;Linux、C/C、云计算、物联网、面试、刷题、算法尽管咨询我&#xff0c;关注我&#xff0c;有问题私聊&#xff01; &…

(17)go-micro微服务Prometheus监控

文章目录一 Prometheus监控介绍1.微服务监控系统promethues介绍2.微服务监控系统promethues工作流程二 Prometheus监控重要组件和重要概念1.微服务监控系统promethues重要组件2.微服务监控系统promethues重要概念三 微服务监控系统grafana看板四 Prometheus监控Grafana看板安装…

【LeetCode每日一题:1817. 查找用户活跃分钟数~~~读懂题目意思+HashMap】

题目描述 给你用户在 LeetCode 的操作日志&#xff0c;和一个整数 k 。日志用一个二维整数数组 logs 表示&#xff0c;其中每个 logs[i] [IDi, timei] 表示 ID 为 IDi 的用户在 timei 分钟时执行了某个操作。 多个用户 可以同时执行操作&#xff0c;单个用户可以在同一分钟内…

数据库 | 事务相关知识点总结

本专栏收录了数据库的知识点&#xff0c;而从本文起&#xff0c;将讲述有关于数据库设计有关知识点&#xff0c;提供给有需要的小伙伴进行学习&#xff0c;本专栏地址可以戳下面链接查看 &#x1f388; 数据库知识点总结&#xff08;持续更新中&#xff09;&#xff1a;【数据库…

LeetCode101_101. 对称二叉树

LeetCode101_101. 对称二叉树 一、描述 给你一个二叉树的根节点 root &#xff0c; 检查它是否轴对称。 示例 1&#xff1a; 输入&#xff1a;root [1,2,2,3,4,4,3] 输出&#xff1a;true示例 2&#xff1a; 输入&#xff1a;root [1,2,2,null,3,null,3] 输出&#xff1…

多表查询与7种JOINS的实现

文章目录1.案例多表连接案例说明笛卡尔积&#xff08;或交叉连接&#xff09;2. 多表查询分类讲解角度1&#xff1a;等值连接与非等值连接角度2&#xff1a;自连接与非自连接角度3&#xff1a;内连接与外连接SQL92&#xff1a;使用()创建连接3. SQL99语法实现多表查询内连接(IN…

分类回归树简单理解总结

CART 决策树 CART决策树&#xff08;Classification And Regression Tree&#xff09;&#xff0c;可以做为分类树也可以作为回归树。 什么是回归树&#xff1f; 在分类树中我们可以处理离散的数据&#xff08;数据种类有限的数据&#xff09;它输出的数据样本是数据的类别&…

E. Arithmetic Operations 根号分治

题意&#xff1a;1e5长的数组&#xff0c;ai<1e5&#xff0c;问要将其变成等差数列的最小次数&#xff1b; 分析&#xff1a; 简单分析可得 —— 显然这个答案是固定的&#xff0c;就是原数列本来就能成为等差数列的最大个数。 但是最直接的想法是 的&#xff0c;一维枚举…