Linux 磁盘分区、格式化和挂载

server/2024/11/25 18:37:39/

一、磁盘分区表分类

Linux中想使用磁盘的步骤和Windows一样

加硬盘->分区->格式化->挂载

#通过命令行方式对磁盘进行分区(两种方式,第一种就是MBR,第二种就是GPT)

如果想采用MBR(Master Boot Record)的方式进行分区就使用fdisk命令

MBR特征:

  • 较旧的分区表格式,仅支持最多4个主分区(或者3个主分区加一个扩展分区)。
  • 支持的最大磁盘容量为2TB。
  • 常用于较旧的BIOS启动系统。
  • MBR的结构较简单,但不如GPT可靠。

如果想采用GPT(GUID Partition Table)的方式进行分区就使用gdisk命令

GPT特征:

  • 现代的分区表格式,支持超过2TB的磁盘容量。
  • 支持最多128个主分区。
  • 具有更强的冗余功能,可以存储多个备份的分区表。
  • 必须使用UEFI(Unified Extensible Firmware Interface)启动。

1、手动创建分区(效率太低)

2、自动创建分区(有一定的操作性)

# 查看当前所有磁盘的分区情况

[server root ~] # fdisk -l

# 查看当前模块硬盘的分区情况

[server root ~] # fdisk -l /dev/sdb 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

一个sectors等于512B

[server root ~] # fdisk -lDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000e1369Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1050623      524288   83  Linux
/dev/sda2         1050624     9439231     4194304   82  Linux swap / Solaris
/dev/sda3         9439232    83886079    37223424   83  LinuxDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes[server root ~] # fdisk -l /dev/sdb Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes[server root ~] # 

二、fdisk命令创建分区

对于服务器来说,磁盘从使用目的来说分为三种,第一种是用来存放操作系统的,此类硬盘一个只存放操作系统以及配置文件,剩下的任何数据都不应该主动存放在此硬盘中。第二种磁盘是用来存放本地大文件,一般这种磁盘叫做本地存储盘。第三种磁盘是用来存放本地大文件,而是使用了网络存储(SAN->storage area network),一般这种磁盘叫做网络存储

1、交互式的命令

[server root ~] # fdisk /dev/sdb

[server root ~] # fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x0f1f0bcc.Command (m for help): q(quit 不保存的)[server root ~] # fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x57ae1208.Command (m for help): w(write 保存)
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.
[server root ~] # 

2、分区主分区

对/dev/sdb磁盘进行分区,如果分了四个主分区后,还有剩余空间,那就没法进行额外分区了,如下

[server root ~] # fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x05cc5d51.Command (m for help): m
Command actiona   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partition(删除一个分区)g   create a new empty GPT partition tableG   create an IRIX (SGI) partition tablel   list known partition types(列出当前支持的分区种类)m   print this menun   add a new partition(添加一个分区)o   create a new empty DOS partition tablep   print the partition table(列出当前状态的所有分区)q   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)Command (m for help): Command (m for help): n
Partition type:p   primary (0 primary, 0 extended, 4 free)e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +5G
Partition 1 of type Linux and of size 5 GiB is setCommand (m for help): w
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.
[server root ~] # fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.......Command (m for help): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x05cc5d51Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    10487807     5242880   83  Linux
/dev/sdb2        10487808    12584959     1048576   83  Linux
/dev/sdb3        12584960    14682111     1048576   83  Linux
/dev/sdb4        14682112    16779263     1048576   83  LinuxCommand (m for help): n
If you want to create more than four partitions, you must replace a
primary partition with an extended partition first.# 如果要创建四个以上的分区,则必须替换首先使用扩展分区的主分区。
Command (m for help): n
If you want to create more than four partitions, you must replace a
primary partition with an extended partition first.

3、创建扩展分区,然后继续创建主分区

# 需要先删除一个主分区,然后创建扩展分区,默认剩余空间都给扩展分区
[server root ~] # fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): d
Partition number (1-4, default 4): 4
Partition 4 is deletedCommand (m for help): n
Partition type:p   primary (3 primary, 0 extended, 1 free)e   extended
Select (default e): e
Selected partition 4
First sector (14682112-41943039, default 14682112): 
Using default value 14682112
Last sector, +sectors or +size{K,M,G} (14682112-41943039, default 41943039): 
Using default value 41943039
Partition 4 of type Extended and of size 13 GiB is setCommand (m for help): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x05cc5d51Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    10487807     5242880   83  Linux
/dev/sdb2        10487808    12584959     1048576   83  Linux
/dev/sdb3        12584960    14682111     1048576   83  Linux
/dev/sdb4        14682112    41943039    13630464    5  Extended# 创建扩展分区之后,就可以在创建主分区了
[server root ~] # fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (14684160-41943039, default 14684160): 
Using default value 14684160
Last sector, +sectors or +size{K,M,G} (14684160-41943039, default 41943039): +5G
Partition 5 of type Linux and of size 5 GiB is setCommand (m for help): PDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x05cc5d51Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    10487807     5242880   83  Linux
/dev/sdb2        10487808    12584959     1048576   83  Linux
/dev/sdb3        12584960    14682111     1048576   83  Linux
/dev/sdb4        14682112    41943039    13630464    5  Extended
/dev/sdb5        14684160    25169919     5242880   83  Linux

4、自动创建分区

自动分区采用了重定向的方法

fdisk /dev/sdb < test

或者

fdisk /dev/sdb < test &>> /dev/null

区别:显示创建过程与不显示创建过程

# 先将需要分区大小,分区类型是主分区还是扩展分区,直接写到一个文本中,如下(注意一定要空行)
[server root ~] # vim test
n
p+1Gn
ewq# 重定向分区                                                    
[server root ~] # fdisk /dev/sdb < test
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): Partition type:p   primary (0 primary, 0 extended, 4 free)e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): Partition 1 of type Linux and of size 1 GiB is setCommand (m for help): Command (m for help): Partition type:p   primary (1 primary, 0 extended, 3 free)e   extended
Select (default p): Partition number (2-4, default 2): First sector (2099200-41943039, default 2099200): Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-41943039, default 41943039): Using default value 41943039
Partition 2 of type Extended and of size 19 GiB is setCommand (m for help): The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.
[server root ~] # fdisk -l /dev/sdbDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x05cc5d51Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2099199     1048576   83  Linux
/dev/sdb2         2099200    41943039    19921920    5  Extended

注意:在 Linux 中,分区大于 2TB 的硬盘时,通常需要使用 GPT(GUID Partition Table) 分区表,因为 MBR(Master Boot Record) 分区表只支持最多 2TB 的磁盘容量。GPT 分区表则没有这个限制,能够支持最大 9.4ZB 的磁盘容量

需要安装gdisk

apt-get install gdisk                 # Debian/Ubuntu 系统

yum install gdisk                      # CentOS/RHEL 系统

gdisk 相关参数

b back up GPT data to a file                       #备份当前的 GPT 数据到一个文件

c change a partition's name                        #更改某个分区的名称

d delete a partition                                       #删除一个分区。

i show detailed information on a partition    #显示某个分区的详细信息

l list known partition types                            #列出已知的分区类型

n add a new partition                                    #添加一个新的分区

o create a new empty GUID partition table (GPT)                #创建一个新的空的 GPT 分区表

p print the partition table                               # 打印当前分区表的内容,显示磁盘的分区信息

q quit without saving changes                       #退出 gdisk

r recovery and transformation options (experts only)            #恢复和转换选项。

s sort partitions                                              #对分区进行排序。

t change a partition's type code                     #更改某个分区的类型

v verify disk                                                    #验证磁盘的 GPT 分区表

w write table to disk and exit                          #将更改后的分区表写入磁盘并退出

x extra functionality (experts only)                  #扩展功能,适用于高级用户,提供一些特殊的操作,如转换分区表格式等

三、格式化分区

1、Linux常见文件系统格式有:ext2、ext3、ext4、xfs、btrfs和btrfs

#ext4的文件系统限制是,单个文件大小不能超过1T

#xfs的文件系统每个文件系统量最大支持8eb,单个文件可以支持16tb

2、mkfs命令格式化分区

# mkfs.ext4格式化分区/dev/sdb1
[server root ~] # mkf
mkfifo       mkfs.btrfs   mkfs.ext2    mkfs.ext4    mkfs.xfs     
mkfs         mkfs.cramfs  mkfs.ext3    mkfs.minix   
[server root ~] # mkfs.ext
mkfs.ext2  mkfs.ext3  mkfs.ext4  
[server root ~] # mkfs.ext4 /dev/sdb1 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done # mkfs.xfs格式化分区/dev/sdb5
[server root ~] # mkfs.xfs /dev/sdb5 
meta-data=/dev/sdb5              isize=512    agcount=4, agsize=327680 blks=                       sectsz=512   attr=2, projid32bit=1=                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=1310720, imaxpct=25=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[server root ~] # # mkfs.ext2格式化分区/dev/sdb6
[server root ~] # mkfs.ext2 /dev/sdb6 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
393216 inodes, 1572864 blocks
78643 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1610612736
48 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done [server root ~] # 

四、挂载Linux分区(文件系统)

1、临时挂载

mount 命令格式

mount -t 文件系统类型 文件系统所在的分区路径        文件系统的挂载点路径

mount -t fstypes        分区路径        挂载点路径

# 还未挂载前
[server root ~] # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  900M     0  900M   0% /dev
tmpfs          tmpfs     910M     0  910M   0% /dev/shm
tmpfs          tmpfs     910M  9.5M  901M   2% /run
tmpfs          tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda3      xfs        36G  3.7G   32G  11% /
/dev/sda1      xfs       509M  138M  372M  28% /boot
tmpfs          tmpfs     182M     0  182M   0% /run/user/0# 创建挂载目录
[server root ~] # mkdir /mount-point{1..3}
[server root ~] # 
[server root ~] # ls /mount-point* -d
/mount-point1  /mount-point2  /mount-point3
[server root ~] # # 将三个分区进行挂载,挂载到/mount-point(1,2,3)目录下
[server root ~] # mount /dev/sdb1 /mount-point1
[server root ~] # mount /dev/sdb5 /mount-point2
[server root ~] # mount /dev/sdb6 /mount-point3
[server root ~] # 
[server root ~] # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  900M     0  900M   0% /dev
tmpfs          tmpfs     910M     0  910M   0% /dev/shm
tmpfs          tmpfs     910M  9.5M  901M   2% /run
tmpfs          tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda3      xfs        36G  3.7G   32G  11% /
/dev/sda1      xfs       509M  138M  372M  28% /boot
tmpfs          tmpfs     182M     0  182M   0% /run/user/0
/dev/sdb1      ext4      4.8G   20M  4.6G   1% /mount-point1
/dev/sdb5      xfs       5.0G   33M  5.0G   1% /mount-point2
/dev/sdb6      ext2      6.0G   12M  5.6G   1% /mount-point3
[server root ~] # 

2、 永久挂载分区

mount命令只是临时挂载,系统重启之后就没了

如果想文件系统永久挂载,就需要把挂载信息写入到/etc/fstab。

/etc/fstab这个文件非常重要,一旦这个文件删除了,或者里边的某些行错误删除了,甚至写法错误都会导致系统无法正常启动。

# 系统重启后,挂载的分区没了
[server root ~] # reboot
Connection closing...Socket close.
Connection closed by foreign host.Disconnected from remote host(centos) at 14:15:58.Type `help' to learn how to use Xshell prompt.
[C:\~]$ 
Reconnecting in 30 seconds. Press any key to exit local shell.
..............................Connecting to 192.168.18.134:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.Last login: Fri Nov 22 09:21:41 2024 from 192.168.18.1
[server root ~] # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  900M     0  900M   0% /dev
tmpfs          tmpfs     910M     0  910M   0% /dev/shm
tmpfs          tmpfs     910M  9.5M  901M   2% /run
tmpfs          tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda3      xfs        36G  3.7G   32G  11% /
/dev/sda1      xfs       509M  138M  372M  28% /boot
tmpfs          tmpfs     182M     0  182M   0% /run/user/0
[server root ~] # 

编辑/etc/fstab之前,最好先备份

# 备份文件
[server root ~] # cp /etc/fstab /etc/fstab.bak
[server root ~] # ls /etc/fstab
fstab      fstab.bak  [server root ~] # cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Tue Jan 16 23:35:15 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=7f5b46d3-e0da-430a-97f2-2e6a19f9e4ff /                       xfs     defaults        0 0
UUID=ebaf11a7-f84f-4429-8df8-0ee0111e76e5 /boot                   xfs     defaults        0 0
UUID=48826076-975a-4d59-bf1a-5b1004e96f29 swap                    swap    defaults        0 0
# 第一列是文件系统所在的分区路径
#第二列是文件系统的挂载点
#第三列是文件系统的类型
#第四列是挂载参数
#第五列和第六列分别写0,只有在一些特殊的文件系统,后两列才需要改成非0/dev/sdb1       /mount-point1   ext4    defaults        0 0
/dev/sdb5       /mount-point2   xfs     defaults        0 0
/dev/sdb6       /mount-point3   ext2    defaults        0 0

当fstab文件编辑完成后,需使用mount -a命令自动挂载生效。

注意:如果某个文件系统已经挂载了。且还在fstab里边被记录,那么mount -a不会将该文件卸载,再重新挂载,mount -a会自动忽略改文件系统

[server root ~] # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  900M     0  900M   0% /dev
tmpfs          tmpfs     910M     0  910M   0% /dev/shm
tmpfs          tmpfs     910M  9.5M  901M   2% /run
tmpfs          tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda3      xfs        36G  3.7G   32G  11% /
/dev/sda1      xfs       509M  138M  372M  28% /boot
tmpfs          tmpfs     182M     0  182M   0% /run/user/0# mount -a命令自动挂载生效
[server root ~] # mount -a
[server root ~] # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  900M     0  900M   0% /dev
tmpfs          tmpfs     910M     0  910M   0% /dev/shm
tmpfs          tmpfs     910M  9.5M  901M   2% /run
tmpfs          tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda3      xfs        36G  3.7G   32G  11% /
/dev/sda1      xfs       509M  138M  372M  28% /boot
tmpfs          tmpfs     182M     0  182M   0% /run/user/0
/dev/sdb1      ext4      4.8G   20M  4.6G   1% /mount-point1
/dev/sdb5      xfs       5.0G   33M  5.0G   1% /mount-point2
/dev/sdb6      ext2      6.0G   12M  5.6G   1% /mount-point3
[server root ~] # 

重启之后挂载正常

[server root ~] # rebootChannel(Socket) closed from remote host(centos) at 14:35:29.Type `help' to learn how to use Xshell prompt.
[C:\~]$ 
WARNING! The remote SSH server rejected X11 forwarding request.WARNING! The remote SSH server rejected X11 forwarding request.
Last login: Fri Nov 22 14:36:10 2024 from 192.168.18.1
[server root ~] # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  900M     0  900M   0% /dev
tmpfs          tmpfs     910M     0  910M   0% /dev/shm
tmpfs          tmpfs     910M  9.6M  901M   2% /run
tmpfs          tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda3      xfs        36G  3.7G   32G  11% /
/dev/sdb5      xfs       5.0G   33M  5.0G   1% /mount-point2
/dev/sda1      xfs       509M  138M  372M  28% /boot
/dev/sdb6      ext2      6.0G   12M  5.6G   1% /mount-point3
/dev/sdb1      ext4      4.8G   20M  4.6G   1% /mount-point1
tmpfs          tmpfs     182M     0  182M   0% /run/user/0
[server root ~] # 


http://www.ppmy.cn/server/144867.html

相关文章

Spring Boot整合Nacos启动时 Failed to rename context [nacos] as [xxx]

一.先说解决办法 方法1&#xff1a; 启动类中添加以下代码 System.setProperty("nacos.logging.default.config.enabled","false");方法2: Java虚拟机选项中添加 -Dnacos.logging.default.config.enabledfalse参考:https://blog.csdn.net/hello_world_qwp…

如何在 Ubuntu 22.04 上安装 Metabase 数据可视化分析工具

简介 Metabase 提供了一个简单易用的界面&#xff0c;让你能够轻松地对数据进行探索和分析。通过本文的指导&#xff0c;你将能够在 Ubuntu 22.04 系统上安装并配置 Metabase&#xff0c;并通过 Nginx 进行反向代理以提高安全性。本教程假设你已经拥有了一个非 root 用户&…

C/C++ 每日一练:实现字符串的大小写转换

题目要求 实现一个函数&#xff0c;将字符串中的所有字母的大小写进行转换&#xff0c;即将大写字母转换为小写字母&#xff0c;小写字母转换为大写字母&#xff0c;非字母字符保持不变。 示例&#xff1a; 输入&#xff1a;"Hello, World!" 输出&#xff1a;"…

C++之旅-set和map掌握篇

目录 前言 1.set的使用 1.1set类的介绍 1.2 set的构造和迭代器 1.3 set的增删查 1.4 代码练习 1.4.1 set的构造&#xff0c;插入与删除 1.4.2 set 的find的使用样例&#xff0c;与erase结合 1.4.3 set获取区间值函数的应用 1.5 multiset和set的差异 1.6 set强化练习&…

微信小程序技术架构图

一、视图层1.WXML&#xff08;WeiXin Markup Language&#xff09; 这是微信小程序的标记语言&#xff0c;类似于 HTML。它用于构建小程序的页面结构。例如&#xff0c;通过标签来定义各种视图元素&#xff0c;如<view>&#xff08;类似于 HTML 中的<div>&#xff…

Java爬虫:数据采集的强大工具

引言 在信息爆炸的今天&#xff0c;数据已成为企业决策的重要依据。无论是市场趋势分析、用户行为研究还是竞争对手监控&#xff0c;都离不开对海量数据的收集和分析。Java作为一种成熟且功能强大的编程语言&#xff0c;其在数据采集领域——尤其是爬虫技术的应用——展现出了…

Elasticsearch面试内容整理-安全与权限管理

在 Elasticsearch 中,安全与权限管理至关重要,特别是当系统处理敏感数据时。Elasticsearch 提供了一套全面的安全机制来确保数据的机密性、完整性和可用性。以下是 Elasticsearch 安全与权限管理的详细介绍。 安全组件概述 Elasticsearch 的安全功能由 Elastic Stack 提供的一…

leetcode 面试150之 156.LUR 缓存

请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。 实现 LRUCache 类&#xff1a; LRUCache(int capacity) 以 正整数 作为容量 capacity 初始化 LRU 缓存int get(int key) 如果关键字 key 存在于缓存中&#xff0c;则返回关键字的值&#xff0c;否则返回 -…