saltstack常用执行模块(1)

0

|_


inode:

27801

local-address:

:::22

program:

986/sshd

proto:

tcp6

recv-q:

0

remote-address:

::😗

send-q:

0

state:

LISTEN

user:

0

network.ping

使用ping命令测试到某主机的连通性

[root@master ~]# salt ‘p2’ network.ping baidu.com

p2:

PING baidu.com (220.181.38.148) 56(84) bytes of data.

64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=64.1 ms

64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=88.1 ms

64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=43.4 ms

64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=51.9 ms

— baidu.com ping statistics —

4 packets transmitted, 4 received, 0% packet loss, time 7ms

rtt min/avg/max/mdev = 43.383/61.865/88.102/16.841 ms

network.reverse_ip

返回一个指定的IP地址的反向地址

[root@master ~]# salt ‘p2’ network.reverse_ip 192.168.200.0

p2:

0.200.168.192.in-addr.arpa

SaltStack常用模块之service


service.available

判断指定的服务是否可用

//查看P2端的nginx服务状态

[root@p2 ~]# systemctl status nginx

● nginx.service - The nginx HTTP and reverse proxy server

Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)

Active: active (running) since Wed 2021-11-03 18:07:23 CST; 2s ago

Process: 139861 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)

Process: 139859 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)

Process: 139857 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Main PID: 139862 (nginx)

Tasks: 3 (limit: 11300)

Memory: 5.8M

CGroup: /system.slice/nginx.service

├─139862 nginx: master process /usr/sbin/nginx

├─139863 nginx: worker process

└─139864 nginx: worker process

//在master端执行模块查看nginx状态

[root@master ~]# salt ‘p2’ service.available nginx

p2:

True

[root@p2 ~]# systemctl status httpd

Unit httpd.service could not be found.

[root@master ~]# salt ‘p2’ service.available httpd #举一个反面教材,凸显效果

p2:

False

service.get_all

获取所有正在运行的服务

[root@master ~]# salt ‘p2’ service.get_all

p2:

  • NetworkManager

  • NetworkManager-dispatcher

  • NetworkManager-wait-online

  • arp-ethers

  • auditd

  • autovt@

  • basic.target

  • blk-availability

  • bluetooth.target

  • console-getty

  • container-getty@

  • cpupower

  • crond

  • 此处省略N行

service.disabled

检查指定服务是否开机不自动启动

[root@master ~]# salt ‘p2’ service.disabled nginx

p2:

False #是False说明是开机自启

service.enabled

检查指定服务是否开机自动启动

[root@master ~]# salt ‘p2’ service.enabled nginx

p2:

True

service.disable

设置指定服务开机不自动启动

[root@master ~]# salt ‘p2’ service.disable nginx

p2:

True

[root@master ~]# salt ‘p2’ service.enabled nginx

p2:

False

service.enable

设置指定服务开机自动启动

[root@master ~]# salt ‘p2’ service.enable nginx

p2:

True

[root@master ~]# salt ‘p2’ service.enabled nginx

p2:

True

service.reload

重新加载指定服务

[root@master ~]# salt ‘p2’ service.reload nginx

p2:

True

service.stop

停止指定服务

[root@master ~]# salt ‘p2’ service.stop nginx

p2:

True

//查看效果

[root@p2 ~]# systemctl status nginx

● nginx.service - The nginx HTTP and reverse proxy server

Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)

Active: inactive (dead) since Wed 2021-11-03 18:19:24 CST; 2s ago

Process: 159441 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)

Main PID: 139862 (code=exited, status=0/SUCCESS)

  • 省略N行

service.start

启动指定服务

[root@master ~]# salt ‘p2’ service.start nginx

p2:

True

//查看效果

[root@p2 ~]# systemctl status nginx

● nginx.service - The nginx HTTP and reverse proxy server

Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)

Active: active (running) since Wed 2021-11-03 18:20:33 CST; 19s ago

Process: 159441 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS)

Process: 164391 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)

Process: 164389 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)

Process: 164387 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Main PID: 164392 (nginx)

  • 省略N行

service.restart

重启指定服务

[root@master ~]# salt ‘p2’ service.restart nginx

p2:

True

service.status

查看指定服务的状态

[root@master ~]# salt ‘p2’ service.status nginx

p2:

True

SaltStack常用模块之pkg


pkg.download

只下载软件包但不安装

此功能将会下载指定的软件包,但是需要在minion端安装yum-utils,可以使用 cmd.run 进行远程安装

[root@master ~]# salt ‘p2’ pkg.download wget

p2:


wget:

/var/cache/yum/packages/wget-1.19.5-10.el8.x86_64.rpm #下载好的软件放在这里

//查看效果

[root@p2 ~]# ls /var/cache/yum/packages/

wget-1.19.5-10.el8.x86_64.rpm

pkg.file_list

列出指定包或系统中已安装的所有包的文件

//列出已安装的apache软件包提供的所有文件

[root@master ~]# salt ‘p2’ pkg.file_list nginx

p2:


errors:

files:

  • /etc/logrotate.d/nginx

  • /etc/nginx/fastcgi.conf

  • /etc/nginx/fastcgi.conf.default

  • /etc/nginx/fastcgi_params

  • /etc/nginx/fastcgi_params.default

  • /etc/nginx/koi-utf

  • /etc/nginx/koi-win

  • /etc/nginx/mime.types

  • /etc/nginx/mime.types.default

  • /etc/nginx/nginx.conf

  • /etc/nginx/nginx.conf.default

  • /etc/nginx/scgi_params

  • /etc/nginx/scgi_params.default

  • /etc/nginx/uwsgi_params

  • /etc/nginx/uwsgi_params.default

  • /etc/nginx/win-utf

  • /usr/bin/nginx-upgrade

  • /usr/lib/.build-id

  • /usr/lib/.build-id/2d

  • /usr/lib/.build-id/2d/da6018ae12edb856ad3d2cf61bf586b6b4873c

  • /usr/lib/systemd/system/nginx.service

  • /usr/lib64/nginx/modules

  • /usr/sbin/nginx

  • /usr/share/doc/nginx

  • /usr/share/doc/nginx/CHANGES

  • /usr/share/doc/nginx/README

  • /usr/share/doc/nginx/README.dynamic

  • /usr/share/licenses/nginx

  • /usr/share/licenses/nginx/LICENSE

  • /usr/share/man/man3/nginx.3pm.gz

  • /usr/share/man/man8/nginx-upgrade.8.gz

  • /usr/share/man/man8/nginx.8.gz

  • /usr/share/nginx/html/404.html

  • /usr/share/nginx/html/50x.html

  • /usr/share/nginx/html/index.html

  • /usr/share/nginx/html/nginx-logo.png

  • /usr/share/nginx/html/poweredby.png

  • /usr/share/vim/vimfiles/ftdetect/nginx.vim

  • /usr/share/vim/vimfiles/indent/nginx.vim

  • /usr/share/vim/vimfiles/syntax/nginx.vim

  • /var/lib/nginx

  • /var/lib/nginx/tmp

  • /var/log/nginx

//当不提供参数时,将会列出当前系统中所有已安装软件的文件列表

[root@master ~]# salt ‘p2’ pkg.file_list

p2:


errors:

files:

VALUE_TRIMMED

pkg.group_info

查看包组的信息

[root@master ~]# salt ‘p2’ pkg.group_info ‘Development Tools’

p2:


conditional:

default:

  • asciidoc

  • byacc

  • ctags

  • diffstat

  • elfutils-libelf-devel

  • git

  • intltool

  • jna

  • ltrace

  • patchutils

  • perl-Fedora-VSP

  • perl-Sys-Syslog

  • perl-generators

  • pesign

  • source-highlight

  • systemtap

  • valgrind

  • valgrind-devel

description:

A basic development environment.

group:

Development Tools

id:

None

mandatory:

  • autoconf

  • automake

  • binutils

  • bison

  • flex

  • gcc

  • gcc-c++

  • gdb

  • glibc-devel

  • libtool

  • make

  • pkgconf

  • pkgconf-m4

  • pkgconf-pkg-config

  • redhat-rpm-config

  • rpm-build

  • rpm-sign

  • strace

optional:

  • cmake

  • expect

  • rpmdevtools

  • rpmlint

type:

package group

pkg.group_list

列出系统中所有的包组

[root@master ~]# salt ‘p2’ pkg.group_list

p2:


available:

  • Conflicts BaseOS

  • Dial-up Networking Support

  • Hardware Monitoring Utilities

  • Hardware Support

  • Large Systems Performance

  • Legacy UNIX Compatibility

  • Python Web

  • Server product core

  • Windows File Server

  • Additional Development

  • Anaconda tools

  • Backup Client

  • Base

  • base-x

  • Conflicts AppStream

  • Container Management

  • Debugging Tools

  • Desktop Debugging and Performance Tools

  • Development Tools

  • .NET Core Development

  • File and Storage Server

  • Fonts

  • FTP Server

  • GNOME Applications

  • GNOME

  • Graphical Administration Tools

  • Graphics Creation Tools

  • Guest Agents

  • Guest Desktop Agents

  • Headless Management

  • Infiniband Support

  • Input Methods

  • Internet Applications

  • Internet Browser

  • Java Platform

  • Legacy X Window System Compatibility

  • Mail Server

  • Mainframe Access

  • Multimedia

  • Network File System Client

  • Network Servers

  • Networking Tools

  • Common NetworkManager submodules

  • Office Suite and Productivity

  • Atomic Host ostree support

  • Performance Tools

  • Platform Development

  • KVM platform specific packages

  • Hyper-v platform specific packages

  • Printing Client

  • Remote Desktop Clients

  • Remote Management for Linux

  • RPM Development Tools

  • Scientific Support

  • Security Tools

  • Smart Card Support

  • Standard

  • System Tools

  • TeX formatting system

  • Virtualization Client

  • Virtualization Hypervisor

  • Virtualization Platform

  • Virtualization Tools

  • Basic Web Server

  • Workstation product core

available environments:

  • Server with GUI

  • Server

  • Workstation

  • Custom Operating System

  • Virtualization Host

available languages:


installed:

  • Core

  • VMware platform specific packages

installed environments:

  • Minimal Install

pkg.install

安装软件

[root@master ~]# salt ‘p2’ pkg.install wget

p2:


wget:


new:

1.19.5-10.el8

old:

pkg.list_downloaded

列出已下载到本地的软件包

[root@master ~]# salt ‘p2’ pkg.list_downloaded

p2:


pkg.list_pkgs

以字典的方式列出当前已安装的软件包

[root@master ~]# salt ‘p2’ pkg.list_pkgs

p2:


NetworkManager:

1:1.22.8-4.el8

NetworkManager-libnm:

1:1.22.8-4.el8

NetworkManager-team:

1:1.22.8-4.el8

NetworkManager-tui:

1:1.22.8-4.el8

acl:

2.2.53-1.el8

audit:

3.0-0.17.20191104git1c2f876.el8

…此处省略N行

pkg.owner

列出指定文件是由哪个包提供的

[root@master ~]# salt ‘p2’ pkg.owner /usr/bin/ls

p2:

coreutils

[root@master ~]# salt ‘p2’ pkg.owner /etc/nginx/nginx.conf

p2:

nginx

pkg.remove

卸载指定软件

[root@master ~]# salt ‘p2’ cmd.run ‘rpm -qa|grep wget’

p2:

wget-1.19.5-10.el8.x86_64

[root@master ~]# salt ‘p2’ pkg.remove wget

p2:


wget:


new:

old:

1.19.5-10.el8

#若要卸载多个文件,中间需要用逗号隔开

pkg.upgrade

升级系统中所有的软件包或升级指定的软件包

[root@master ~]# salt ‘p2’ pkg.upgrade name=nginx

p2:


#若想升级系统中所有的软件包则把 name 参数去掉即可

SaltStack常用模块之state


state.show_highstate

显示当前系统中有哪些高级状态

[root@master ~]# salt ‘p2’ state.show_highstate

p2:


apache-install:


env:

base

sls:

web.apache.install

pkg:

|_


name:

httpd

  • installed

|_


order:

10000

apache-service:


env:

base

sls:

web.apache.install

service:

|_


name:

httpd

|_


enable:

True

  • running

|_


order:

10001

state.highstate

执行高级状态

[root@master ~]# salt ‘p2’ state.highstate web.apache.install

p2:


ID: apache-install

Function: pkg.installed

Name: httpd

Result: None

Comment: The following packages would be installed/updated: httpd

Started: 18:43:25.179256

Duration: 611.861 ms

Changes:


installed:


httpd:


new:

installed

old:


ID: apache-service

Function: service.running

Name: httpd

Result: None

Comment: Service httpd not present; if created in this state run, it would have been started

Started: 18:43:25.805518

Duration: 20.783 ms

Changes:

Summary for p2


Succeeded: 2 (unchanged=2, changed=1)

Failed: 0


Total states run: 2

Total run time: 632.644 ms

state.show_state_usage

显示当前系统中的高级状态执行情况

[root@master ~]# salt ‘p2’ state.show_state_usage

p2:


base:


count_all:

2

count_unused:

1

count_used:

1

unused:

  • top

used:

  • web.apache.install

dev:


count_all:

0

count_unused:

0

count_used:

0

unused:

used:

prod:


count_all:

0

count_unused:

0

count_used:

0

unused:

used:

test:


count_all:

0

count_unused:

0

count_used:

0

unused:

used:

state.show_top

返回minion将用于highstate的顶级数据

[root@master ~]# salt ‘p2’ state.show_top

p2:


base:

  • web.apache.install

state.top

执行指定的top file,而不是默认的

[root@master ~]# salt ‘p2’ state.top top.sls

p2:


ID: apache-install

Function: pkg.installed

Name: httpd

Result: True

Comment: All specified packages are already installed

Started: 21:23:44.821788

Duration: 1558.727 ms

Changes:


ID: apache-service

Function: service.running

Name: httpd

Result: True

Comment: The service httpd is already running

Started: 21:23:46.385995

Duration: 105.409 ms

Changes:

Summary for p2


Succeeded: 2

Failed: 0


Total states run: 2

Total run time: 1.664 s

state.show_sls

显示 master 上特定sls或sls文件列表中的状态数据

[root@master ~]# salt ‘p2’ state.show_sls web.apache.install

p2:


apache-install:


env:

base

sls:

web.apache.install

pkg:

|_


name:

httpd

  • installed

|_


order:

10000

apache-service:


env:

base

sls:

web.apache.install

service:

|_


name:

httpd

|_


enable:

True

  • running

|_


order:

10001

SaltStack常用模块之user


查看关于user模块的相关函数

[root@master ~]# salt ‘p2’ sys.list_functions user

p2:

  • user.add

  • user.chfullname

  • user.chgid

  • user.chgroups

  • user.chhome

  • user.chhomephone

  • user.chloginclass

  • user.chother

  • user.chroomnumber

  • user.chshell

  • user.chuid

  • user.chworkphone

  • user.delete

  • user.get_loginclass

  • user.getent

  • user.info

  • user.list_groups

  • user.list_users

  • user.primary_group

  • user.rename

user.add

在minion端上创建一个用户,用法:salt ‘*’ user.add name

[root@master ~]# salt ‘p2’ user.add ran

p2:

True

user.info

返回指定用户信息

[root@master ~]# salt ‘p2’ user.info ran

p2:


fullname:

gid:

1000

groups:

  • ran

home:

/home/ran

homephone:

name:

ran

other:

passwd:

x

roomnumber:

shell:

/bin/bash

uid:

1000

workphone:

user.getent

返回所有系统用户信息的列表

[root@master ~]# salt ‘p2’ user.getent

p2:

|_


fullname:

root

gid:

0

groups:

  • root

home:

/root

homephone:

name:

root

other:

passwd:

x

roomnumber:

shell:

/bin/bash

uid:

0

workphone:

|_


fullname:

bin

gid:

1

groups:

  • bin

home:

/bin

homephone:

name:

bin

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

1

workphone:

|_


fullname:

daemon

gid:

2

groups:

  • daemon

home:

/sbin

homephone:

name:

daemon

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

2

workphone:

|_


fullname:

adm

gid:

4

groups:

  • adm

home:

/var/adm

homephone:

name:

adm

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

3

workphone:

|_


fullname:

lp

gid:

7

groups:

  • lp

home:

/var/spool/lpd

homephone:

name:

lp

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

4

workphone:

|_


fullname:

sync

gid:

0

groups:

  • root

home:

/sbin

homephone:

name:

sync

other:

passwd:

x

roomnumber:

shell:

/bin/sync

uid:

5

workphone:

|_


fullname:

shutdown

gid:

0

groups:

  • root

home:

/sbin

homephone:

name:

shutdown

other:

passwd:

x

roomnumber:

shell:

/sbin/shutdown

uid:

6

workphone:

|_


fullname:

halt

gid:

0

groups:

  • root

home:

/sbin

homephone:

name:

halt

other:

passwd:

x

roomnumber:

shell:

/sbin/halt

uid:

7

workphone:

|_


fullname:

mail

gid:

12

groups:

  • mail

home:

/var/spool/mail

homephone:

name:

mail

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

8

workphone:

|_


fullname:

operator

gid:

0

groups:

  • root

home:

/root

homephone:

name:

operator

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

11

workphone:

|_


fullname:

games

gid:

100

groups:

  • users

home:

/usr/games

homephone:

name:

games

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

12

workphone:

|_


fullname:

FTP User

gid:

50

groups:

  • ftp

home:

/var/ftp

homephone:

name:

ftp

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

14

workphone:

|_


fullname:

Kernel Overflow User

gid:

65534

groups:

  • nobody

home:

/

homephone:

name:

nobody

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

65534

workphone:

|_


fullname:

System message bus

gid:

81

groups:

  • dbus

home:

/

homephone:

name:

dbus

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

81

workphone:

|_


fullname:

systemd Core Dumper

gid:

997

groups:

  • systemd-coredump

home:

/

homephone:

name:

systemd-coredump

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

999

workphone:

|_


fullname:

systemd Resolver

gid:

193

groups:

  • systemd-resolve

home:

/

homephone:

name:

systemd-resolve

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

193

workphone:

|_


fullname:

Account used by the trousers package to sandbox the tcsd daemon

gid:

59

groups:

  • tss

home:

/dev/null

homephone:

name:

tss

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

59

workphone:

|_


fullname:

User for polkitd

gid:

996

groups:

  • polkitd

home:

/

homephone:

name:

polkitd

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

998

workphone:

|_


fullname:

Unbound DNS resolver

gid:

995

groups:

  • unbound

home:

/etc/unbound

homephone:

name:

unbound

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

997

workphone:

|_


fullname:

User for sssd

gid:

993

groups:

  • sssd

home:

/

homephone:

name:

sssd

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

996

workphone:

|_


fullname:

Privilege-separated SSH

gid:

74

groups:

  • sshd

home:

/var/empty/sshd

homephone:

name:

sshd

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

74

workphone:

|_


fullname:

Random Number Generator Daemon

gid:

992

groups:

  • rngd

home:

/var/lib/rngd

homephone:

name:

rngd

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

995

workphone:

|_


fullname:

Apache

gid:

48

groups:

  • apache

home:

/usr/share/httpd

homephone:

name:

apache

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

48

workphone:

|_


fullname:

Nginx web server

gid:

991

groups:

  • nginx

home:

/var/lib/nginx

homephone:

name:

nginx

other:

passwd:

x

roomnumber:

shell:

/sbin/nologin

uid:

994

workphone:

|_


fullname:

gid:

1000

groups:

  • ran

home:

/home/ran

homephone:

name:

ran

other:

passwd:

x

roomnumber:

shell:

/bin/bash

uid:

1000

workphone:

user.chgid

更改用户GID

[root@master ~]# salt ‘p2’ user.add hao

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘id hao’

p2:

uid=1001(hao) gid=1001(hao) groups=1001(hao)

[root@master ~]# salt ‘p2’ user.chgid hao 1000

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘id hao’

p2:

uid=1001(hao) gid=1000(ran) groups=1000(ran)

user.chuid

更改用户UID

[root@master ~]# salt ‘p2’ cmd.run ‘id ran’

p2:

uid=1000(ran) gid=1000(ran) groups=1000(ran)

[root@master ~]# salt ‘p2’ user.chuid ran 2000

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘id ran’

p2:

uid=2000(ran) gid=1000(ran) groups=1000(ran)

user.list_groups

列出指定用户所属组的列表

[root@master ~]# salt ‘p2’ user.list_groups ran

p2:

  • ran

user.rename

修改指定用户的用户名

[root@master ~]# salt ‘p2’ cmd.run ‘id hao’

p2:

uid=1001(hao) gid=1000(ran) groups=1000(ran)

[root@master ~]# salt ‘p2’ user.rename hao hhr

p2:

False #虽然返回的是False但是操作是成功了

[root@master ~]# salt ‘p2’ cmd.run ‘id hao’

p2:

id: ‘hao’: no such user

ERROR: Minions returned with non-zero exit code

[root@master ~]# salt ‘p2’ cmd.run ‘id hhr’

p2:

uid=1001(hhr) gid=1000(ran) groups=1000(ran)

user.delete

在minion端删除一个用户

[root@master ~]# salt ‘p2’ cmd.run ‘id hhr’

p2:

uid=1001(hhr) gid=1000(ran) groups=1000(ran)

[root@master ~]# salt ‘p2’ user.delete hhr

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘id hhr’

p2:

id: ‘hhr’: no such user

ERROR: Minions returned with non-zero exit code

SaltStack常用模块之salt-cp


salt-cp

salt-cp能够很方便的把 master 上的文件批量传到 minion上

//拷贝单个文件到目标主机的/usr/src目录下

[root@master ~]# salt ‘p2’ cmd.run ‘ls /usr/src/’

p2:

debug

kernels

[root@master ~]# salt-cp ‘p2’ /etc/passwd /usr/src/

p2:


/usr/src/passwd:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls /usr/src’

p2:

debug

kernels

passwd

//拷贝多个文件到目标主机的/usr/src目录下

[root@master ~]# salt-cp ‘p2’ /root/anaconda-ks.cfg /etc/group /usr/src

p2:


/usr/src/anaconda-ks.cfg:

True

/usr/src/group:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls /usr/src’

p2:

anaconda-ks.cfg

debug

group

kernels

passwd

//在传输脚本时,是不会把执行权限传输过去

[root@master ~]# touch test.sh

[root@master ~]# vim test.sh

[root@master ~]# cat test.sh

#!/bin/bash

jjyy

[root@master ~]# salt-cp ‘p2’ /root/test.sh /opt

p2:


/opt/test.sh:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /opt’

p2:

total 4

-rw-r–r–. 1 root root 17 Nov 4 14:23 test.sh

[root@master ~]# chmod +x test.sh

[root@master ~]# ll /root/test.sh

-rwxr-xr-x 1 root root 17 11月 4 14:22 /root/test.sh

[root@master ~]# salt-cp ‘p2’ /root/test.sh /opt

p2:


/opt/test.sh:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /opt’

p2:

total 4

-rw-r–r–. 1 root root 17 Nov 4 14:25 test.sh

SaltStack常用模块之file


file.access

检查指定路径是否存在

[root@master ~]# salt ‘p2’ cmd.run ‘ls /usr/src’

p2:

anaconda-ks.cfg

debug

group

jjyy

kernels

passwd

[root@master ~]# salt ‘p2’ file.access /usr/src/passwd f

p2:

True

[root@master ~]# salt ‘p2’ file.access /usr/src/abc f

p2:

False

检查指定文件的权限信息

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /usr/src/’

p2:

total 12

-rw-r–r–. 1 root root 1284 Nov 3 21:57 anaconda-ks.cfg

drwxr-xr-x. 2 root root 6 Aug 12 2018 debug

-rw-r–r–. 1 root root 512 Nov 3 21:57 group

-rw-r–r–. 1 root root 0 Nov 3 21:56 jjyy

drwxr-xr-x. 2 root root 6 Aug 12 2018 kernels

-rw-r–r–. 1 root root 1159 Nov 3 21:52 passwd

[root@master ~]# salt ‘p2’ file.access /usr/src/passwd r #是否有读权限

p2:

True

[root@master ~]# salt ‘p2’ file.access /usr/src/passwd w #是否有写权限

p2:

True

[root@master ~]# salt ‘p2’ file.access /usr/src/passwd x #是否有执行权限

p2:

False

file.append

往一个文件里追加内容,若此文件不存在则会报异常

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/hh’

p2:

-rw-r–r–. 1 root root 0 Nov 4 18:37 /root/hh

[root@master ~]# salt ‘p2’ file.append /root/hh “hello world” “jjyy runtt” #添加有空格的内容,用引号引起来。(几对引号就添加几行)

p2:

Wrote 2 lines to “/root/hh”

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/hh’

p2:

-rw-r–r–. 1 root root 23 Nov 4 18:39 /root/hh

[root@master ~]# salt ‘p2’ cmd.run ‘cat /root/hh’

p2:

hello world

jjyy runtt

file.basename

获取指定路径的基名

[root@master ~]# salt ‘p2’ file.basename ‘/root/test.sh/jjtt’

p2:

jjtt

file.dirname

获取指定路径的目录名

[root@master ~]# salt ‘p2’ file.dirname ‘/root/test.sh/jjtt’

p2:

/root/test.sh

file.check_hash

检查指定的文件与hash字符串是否匹配,匹配则返回 True 否则返回 False

[root@master ~]# salt ‘p2’ cmd.run ‘md5sum /etc/passwd’

p2:

f4167f25847ec833a58db8347bfe5129 /etc/passwd

[root@master ~]# salt ‘p2’ file.check_hash /etc/passwd f4167f25847ec833a58db8347bfe5129

p2:

True

file.chattr

修改指定文件的属性

| 属性 | 对文件的意义 | 对目录的意义 |

| — | :-- | :-- |

| a | 只允许在这个文件之后追加数据

不允许任何进程覆盖或截断这个文件 | 只允许在这个目录下建立和修改文件

而不允许删除任何文件 |

| i | 不允许对这个文件进行任何的修改

不能删除、更改、移动 | 任何的进程只能修改目录之下的文件

不允许建立和删除文件 |

给指定文件添加属性

//查看当前属性

[root@master ~]# salt ‘p2’ cmd.run ‘lsattr /root/’

p2:

-------------------- /root/anaconda-ks.cfg

-------------------- /root/ss

-------------------- /root/hh

//添加属性

[root@master ~]# salt ‘p2’ cmd.run ‘lsattr /root/hh’

p2:

----ia-------------- /root/hh

给指定文件去除属性

[root@master ~]# salt ‘p2’ file.chattr /root/hh operator=remove attributes=ai

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘lsattr /root/hh’

p2:

-------------------- /root/hh

file.chown

设置指定文件的属主、属组信息

[root@master ~]# salt ‘p2’ cmd.run ‘id ran’

p2:

uid=2000(ran) gid=1000(ran) groups=1000(ran)

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/’

p2:

total 4

-rw-------. 1 root root 1184 Jul 12 15:19 anaconda-ks.cfg

-rw-r–r–. 1 root root 0 Nov 3 22:14 ss

[root@master ~]# salt ‘p2’ file.chown /root/ss ran ran #属主、属组必须一致

p2:

None

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/’

p2:

total 4

-rw-------. 1 root root 1184 Jul 12 15:19 anaconda-ks.cfg

-rw-r–r–. 1 ran ran 0 Nov 3 22:14 ss

file.copy

在远程主机上复制文件或目录

//拷贝文件

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root’

p2:

total 8

-rw-------. 1 root root 1184 Jul 12 15:19 anaconda-ks.cfg

-rw-r–r–. 1 root root 23 Nov 4 18:39 hh

-rw-r–r–. 1 ran ran 0 Nov 3 22:14 ss

[root@master ~]# salt ‘p2’ file.copy /root/hh /root/hhhh

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root’

p2:

total 12

-rw-------. 1 root root 1184 Jul 12 15:19 anaconda-ks.cfg

-rw-r–r–. 1 root root 23 Nov 4 18:39 hh

-rw-r–r–. 1 root root 23 Nov 4 18:52 hhhh

-rw-r–r–. 1 ran ran 0 Nov 3 22:14 ss

覆盖并拷贝目录,将会覆盖同名文件或目录

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /opt’

p2:

total 0

[root@master ~]# salt ‘p2’ file.copy /root/abc /opt/abc recurse=True

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /opt’

p2:

total 0

drwxr-xr-x. 2 root root 20 Nov 4 19:05 abc

删除目标目录中同名的文件或目录并拷贝新内容至其中

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /opt/abc’

p2:

total 8

-rw-r–r–. 1 root root 23 Nov 4 18:39 hh

-rw-r–r–. 1 root root 1258 Nov 4 19:05 passwd

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/abc’

p2:

total 4

-rw-r–r–. 1 root root 1258 Nov 4 19:05 passwd

//拷贝目录

[root@master ~]# salt ‘p2’ file.copy /root/abc/ /opt/abc/ recurse=True remove_existing=True

p2:

True

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /opt/abc’

p2:

total 4

-rw-r–r–. 1 root root 1258 Nov 4 19:05 passwd

file.ditectory_exists

判断指定目录是否存在,存在则返回 True ,否则返回 False

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root’

p2:

total 8

drwxr-xr-x. 2 root root 20 Nov 4 19:05 abc

-rw-------. 1 root root 1184 Jul 12 15:19 anaconda-ks.cfg

-rw-r–r–. 1 root root 23 Nov 4 18:52 hhhh

-rw-r–r–. 1 ran ran 0 Nov 3 22:14 ss

[root@master ~]# salt ‘p2’ file.directory_exists /root/ss

p2:

False #返回False是因为ss是文件而非目录

[root@master ~]# salt ‘p2’ file.directory_exists /root/abc

p2:

True

file.diskusage

递归计算指定路径的磁盘使用情况并以字节为单位返回

[root@master ~]# salt ‘p2’ cmd.run ‘du -sb /etc’

p2:

21430793 /etc

[root@master ~]# salt ‘p2’ file.diskusage /etc

p2:

21704143

file.file_exists

判断指定文件是否存在

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/’

p2:

total 8

drwxr-xr-x. 2 root root 20 Nov 4 19:05 abc

-rw-------. 1 root root 1184 Jul 12 15:19 anaconda-ks.cfg

-rw-r–r–. 1 root root 23 Nov 4 18:52 hhhh

-rw-r–r–. 1 ran ran 0 Nov 3 22:14 ss

[root@master ~]# salt ‘p2’ file.file_exists /root/ss

p2:

True

[root@master ~]# salt ‘p2’ file.file_exists /root/abc

p2:

False #返回False是因为abc是目录而非文件

file.find

类似 find 命令并返回符合指定条件的路径列表

The options include match criteria:

name = path-glob # case sensitive

iname = path-glob # case insensitive

regex = path-regex # case sensitive

iregex = path-regex # case insensitive

type = file-types # match any listed type

user = users # match any listed user

group = groups # match any listed group

size = [±]number[size-unit] # default unit = byte

mtime = interval # modified since date

grep = regex # search file contents

and/or actions:

delete [= file-types] # default type = ‘f’

exec = command [arg …] # where {} is replaced by pathname

print [= print-opts]

and/or depth criteria:

maxdepth = maximum depth to transverse in path #深度指的是多少级

mindepth = minimum depth to transverse before checking files or directories

The default action is print=path

path-glob:

  •            = match zero or more chars
    

? = match any char

[abc] = match a, b, or c

[!abc] or [^abc] = match anything except a, b, and c

[x-y] = match chars x through y

[!x-y] or [^x-y] = match anything except chars x through y

{a,b,c} = match a or b or c

path-regex: a Python Regex (regular expression) pattern to match pathnames

file-types: a string of one or more of the following:

a: all file types

b: block device

c: character device

d: directory

p: FIFO (named pipe)

f: plain file

l: symlink

s: socket

users: a space and/or comma separated list of user names and/or uids

groups: a space and/or comma separated list of group names and/or gids

size-unit:

b: bytes

k: kilobytes

m: megabytes

g: gigabytes

t: terabytes

interval:

[w] [d] [h] [m] [s]

where:

w: week

d: day

h: hour

m: minute

s: second

print-opts: a comma and/or space separated list of one or more of the following:

group: group name

md5: MD5 digest of file contents

mode: file permissions (as integer)

mtime: last modification time (as time_t)

name: file basename

path: file absolute path

size: file size in bytes

type: file type

user: user name

示例:

//查找类型为普通文件,以.log结尾的,大小在10以上的文件

[root@master ~]# salt ‘p2’ file.find / type=f name=*.log size=+1m

//在var目录下查询修改后的时间在10天前,大小在10M以上的文件,打印路径,文件大小,修改后的时间

[root@master ~]# salt ‘p2’ file.find /var mtime=+10d size=+10m print=path,size,mtime

//在/var/log下查找以.任意数字的且30天前修改的,大于10m的文件,删除

[root@master ~]# salt ‘p2’ file.find /var/log name=*.[0-9] mtime=+30d size=+10m delete

file.get_gid

获取指定文件的gid

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/hhhh’

p2:

-rw-r–r–. 1 root root 23 Nov 4 18:52 /root/hhhh

[root@master ~]# salt ‘p2’ file.get_gid /root/hhhh

p2:

0

file.get_group

获取指定文件的组名

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/hhhh’

p2:

-rw-r–r–. 1 root root 23 Nov 4 18:52 /root/hhhh

[root@master ~]# salt ‘p2’ file.get_group /root/hhhh

p2:

root

file.get_hash

获取指定文件的hash值,该值通过 sha256 算法得来

[root@master ~]# salt ‘p2’ cmd.run ‘sha256sum /root/hhhh’

p2:

7ef8c0088774169440e714762633b17523a537aaf45cbb06a95707524174af2d /root/hhhh

[root@master ~]# salt ‘p2’ file.get_hash /root/hhhh

p2:

7ef8c0088774169440e714762633b17523a537aaf45cbb06a95707524174af2d

file.get_mode

获取指定文件的权限,以数字方式显示

//获取文件权限

[root@master ~]# salt ‘p2’ file.get_mode /root/hhhh

p2:

0644

//获取目录的权限

[root@master ~]# salt ‘p2’ file.get_mode /root/abc

p2:

0755

file.get_selinux_context

获取指定文件的 SELINUX 上下文信息

[root@master ~]# salt ‘p2’ cmd.run ‘ls -Z /root/hhhh’

p2:

system_u:object_r:admin_home_t:s0 /root/hhhh

[root@master ~]# salt ‘p2’ file.get_selinux_context /root/hhhh

p2:

system_u:object_r:admin_home_t:s0

file.get_sum

按照指定的算法计算指定文件的特征码并显示,默认使用的sha256算法。

该函数可使用的算法参数有:

  • md5

  • sha1

  • sha224

  • sha256 (default)

  • sha384

  • sha512

[root@master ~]# salt ‘p2’ cmd.run ‘sha256sum /root/hhhh’

p2:

7ef8c0088774169440e714762633b17523a537aaf45cbb06a95707524174af2d /root/hhhh

[root@master ~]# salt ‘p2’ file.get_sum /root/hhhh

p2:

7ef8c0088774169440e714762633b17523a537aaf45cbb06a95707524174af2d

[root@master ~]# salt ‘p2’ cmd.run ‘md5sum /root/ss’

p2:

d41d8cd98f00b204e9800998ecf8427e /root/ss

[root@master ~]# salt ‘p2’ file.get_sum /root/ss md5

p2:

d41d8cd98f00b204e9800998ecf8427e

file.get_uid与file.get_user

获取指定文件的 uid 或 用户名

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/hhhh’

p2:

-rw-r–r–. 1 root root 23 Nov 4 18:52 /root/hhhh

[root@master ~]# salt ‘p2’ file.get_uid /root/hhhh

p2:

0

[root@master ~]# salt ‘p2’ file.get_user /root/hhhh

p2:

root

file.gid_to_group

将指定的 gid 转换为组名并显示

[root@master ~]# salt ‘p2’ file.gid_to_group 1000

p2:

ran

[root@master ~]# salt ‘p2’ file.gid_to_group 0

p2:

root

file.group_to_gid

将指定的组名转换为 gid 并显示

[root@master ~]# salt ‘p2’ file.group_to_gid root

p2:

0

[root@master ~]# salt ‘p2’ file.group_to_gid ran

p2:

1000

file.grep

在指定文件中检索指定内容

该函数支持通配符,若在指定的路径中用通配符则必须用双引号引起来

//salt ‘*’ file.grep /etc/passwd nobody

[root@master ~]# salt ‘p2’ file.grep /etc/passwd nobody #搜索/etc/passwd以nodody的关键字

p2:


pid:

489648

retcode:

0

stderr:

stdout:

nobody❌65534:65534:Kernel Overflow User:/:/sbin/nologin

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i #查找ip地址

p2:


pid:

492483

retcode:

0

stderr:

stdout:

IPADDR=“192.168.129.250”

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i -B2

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i -B2 #查找当前行的前两行(包括当前行)

p2:


pid:

493881

retcode:

0

stderr:

stdout:

DEVICE=“ens160”

ONBOOT=“yes”

IPADDR=“192.168.129.250”

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i -A2

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i -A2 #查找当前行的后两行(包括当前行)

p2:


pid:

494646

retcode:

0

stderr:

stdout:

IPADDR=“192.168.129.250”

PREFIX=“24”

GATEWAY=“192.168.129.2”

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i -C2 #查找当前行的前后两行(包括当前行)

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i -C2

p2:


pid:

495181

retcode:

0

stderr:

stdout:

DEVICE=“ens160”

ONBOOT=“yes”

IPADDR=“192.168.129.250”

PREFIX=“24”

GATEWAY=“192.168.129.2”

//salt '’ file.grep "/etc/sysconfig/network-scripts/" ipaddr – -i -l

[root@master ~]# salt ‘p2’ file.grep “/etc/sysconfig/network-scripts/*” ipaddr – -i -l #查看当前行的路径是在哪里

p2:


pid:

495872
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注Java获取)

img

总结

我们总是喜欢瞻仰大厂的大神们,但实际上大神也不过凡人,与菜鸟程序员相比,也就多花了几分心思,如果你再不努力,差距也只会越来越大。实际上,作为程序员,丰富自己的知识储备,提升自己的知识深度和广度是很有必要的。

Mybatis源码解析

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
/root/hhhh

[root@master ~]# salt ‘p2’ file.get_selinux_context /root/hhhh

p2:

system_u:object_r:admin_home_t:s0

file.get_sum

按照指定的算法计算指定文件的特征码并显示,默认使用的sha256算法。

该函数可使用的算法参数有:

  • md5

  • sha1

  • sha224

  • sha256 (default)

  • sha384

  • sha512

[root@master ~]# salt ‘p2’ cmd.run ‘sha256sum /root/hhhh’

p2:

7ef8c0088774169440e714762633b17523a537aaf45cbb06a95707524174af2d /root/hhhh

[root@master ~]# salt ‘p2’ file.get_sum /root/hhhh

p2:

7ef8c0088774169440e714762633b17523a537aaf45cbb06a95707524174af2d

[root@master ~]# salt ‘p2’ cmd.run ‘md5sum /root/ss’

p2:

d41d8cd98f00b204e9800998ecf8427e /root/ss

[root@master ~]# salt ‘p2’ file.get_sum /root/ss md5

p2:

d41d8cd98f00b204e9800998ecf8427e

file.get_uid与file.get_user

获取指定文件的 uid 或 用户名

[root@master ~]# salt ‘p2’ cmd.run ‘ls -l /root/hhhh’

p2:

-rw-r–r–. 1 root root 23 Nov 4 18:52 /root/hhhh

[root@master ~]# salt ‘p2’ file.get_uid /root/hhhh

p2:

0

[root@master ~]# salt ‘p2’ file.get_user /root/hhhh

p2:

root

file.gid_to_group

将指定的 gid 转换为组名并显示

[root@master ~]# salt ‘p2’ file.gid_to_group 1000

p2:

ran

[root@master ~]# salt ‘p2’ file.gid_to_group 0

p2:

root

file.group_to_gid

将指定的组名转换为 gid 并显示

[root@master ~]# salt ‘p2’ file.group_to_gid root

p2:

0

[root@master ~]# salt ‘p2’ file.group_to_gid ran

p2:

1000

file.grep

在指定文件中检索指定内容

该函数支持通配符,若在指定的路径中用通配符则必须用双引号引起来

//salt ‘*’ file.grep /etc/passwd nobody

[root@master ~]# salt ‘p2’ file.grep /etc/passwd nobody #搜索/etc/passwd以nodody的关键字

p2:


pid:

489648

retcode:

0

stderr:

stdout:

nobody❌65534:65534:Kernel Overflow User:/:/sbin/nologin

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i #查找ip地址

p2:


pid:

492483

retcode:

0

stderr:

stdout:

IPADDR=“192.168.129.250”

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i -B2

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i -B2 #查找当前行的前两行(包括当前行)

p2:


pid:

493881

retcode:

0

stderr:

stdout:

DEVICE=“ens160”

ONBOOT=“yes”

IPADDR=“192.168.129.250”

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i -A2

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i -A2 #查找当前行的后两行(包括当前行)

p2:


pid:

494646

retcode:

0

stderr:

stdout:

IPADDR=“192.168.129.250”

PREFIX=“24”

GATEWAY=“192.168.129.2”

//salt ‘*’ file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr – -i -C2 #查找当前行的前后两行(包括当前行)

[root@master ~]# salt ‘p2’ file.grep /etc/sysconfig/network-scripts/ifcfg-ens160 ipaddr – -i -C2

p2:


pid:

495181

retcode:

0

stderr:

stdout:

DEVICE=“ens160”

ONBOOT=“yes”

IPADDR=“192.168.129.250”

PREFIX=“24”

GATEWAY=“192.168.129.2”

//salt '’ file.grep "/etc/sysconfig/network-scripts/" ipaddr – -i -l

[root@master ~]# salt ‘p2’ file.grep “/etc/sysconfig/network-scripts/*” ipaddr – -i -l #查看当前行的路径是在哪里

p2:


pid:

495872
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。[外链图片转存中…(img-YR9LTEk9-1713381348996)]

[外链图片转存中…(img-lzVWi0aJ-1713381348996)]

[外链图片转存中…(img-WJz9oNfu-1713381348997)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注Java获取)

img

总结

我们总是喜欢瞻仰大厂的大神们,但实际上大神也不过凡人,与菜鸟程序员相比,也就多花了几分心思,如果你再不努力,差距也只会越来越大。实际上,作为程序员,丰富自己的知识储备,提升自己的知识深度和广度是很有必要的。

Mybatis源码解析

[外链图片转存中…(img-KyhNyhuD-1713381348997)]

[外链图片转存中…(img-bgBgNRVq-1713381348997)]

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

  • 8
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值