先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上运维知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
如果你需要这些资料,可以添加V获取:vip1024b (备注运维)
正文
top - 21:43:41 up 13 min, 3 users, load average: 0.00, 0.01, 0.04
Tasks: 194 total, 1 running, 193 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu4 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu5 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu6 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu7 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 16267428 total, 15500496 free, 392744 used, 374188 buff/cache
KiB Swap: 10485756 total, 10485756 free, 0 used. 15559560 avail Mem
- 执行:
sh cpu.sh 3 120
【意思是占用3颗cpu,占用120秒】
如果参数不够,该脚本是会报错的
[root@centos-73-iso-100g-test ~]# sh cpu.sh 3
USAGE: cpu.sh <cpus,sleep time>
[root@centos-73-iso-100g-test ~]#
执行以后可以就会出现下面内容【此时该脚本并不会结束,而是处于 sleep 120状态
[root@centos-73-iso-100g-test ~]# sh cpu.sh 3 120
execute: kill 3083
execute: kill 3085
execute: kill 3087
If executed ctrl+C,Please execute the above lines manually
Please wait 120 seconds
- 回到刚才执行top的窗口中,可以看到有3颗cpu的使用率为100%
[root@centos-73-iso-100g-test ~]# top
top - 21:45:21 up 15 min, 3 users, load average: 0.67, 0.16, 0.09
Tasks: 199 total, 4 running, 195 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0 us, 0.0 sy, 0.0 ni, 99.7 id, 0.3 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu4 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu5 : 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu6 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu7 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 16267428 total, 15499112 free, 394012 used, 374304 buff/cache
KiB Swap: 10485756 total, 10485756 free, 0 used. 15558272 avail Mem
- 120秒以后,该脚本就结束了,并自动kill掉这几个进程
[root@centos-73-iso-100g-test ~]# sh cpu.sh 3 120
execute: kill 3083
execute: kill 3085
execute: kill 3087
If executed ctrl+C,Please execute the above lines manually
Please wait 120 seconds
kill 3083
kill 3085
kill 3087
[root@centos-73-iso-100g-test ~]#
- 此时 top界面的cpu使用率也被释放了
[root@centos-73-iso-100g-test ~]# top
top - 21:47:48 up 17 min, 3 users, load average: 1.26, 0.84, 0.37
Tasks: 193 total, 1 running, 192 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu4 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu5 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu6 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu7 : 0.8 us, 0.0 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 16267428 total, 15499472 free, 393652 used, 374304 buff/cache
KiB Swap: 10485756 total, 10485756 free, 0 used. 15558620 avail Mem
===================================================================
代码
-
这个脚本功能如下【这个脚本不难,代码就不做解释了】
-
1、想占用多少内存【单位是M(不能超过现有内存,否则可能会蹦)】
-
2、占用多长时间【单位是秒】
-
3、占用时间到达以后,会自动释放被占用的内存【如果提前结束,需要手动删除占用文件】
[root@centos-76-qcow2-50g-3 ~]# free -g
total used free shared buff/cache available
Mem: 62 0 62 0 0 61
Swap: 0 0 0
[root@centos-76-qcow2-50g-3 ~]#
[root@centos-76-qcow2-50g-3 ~]# cat free.sh
#!/bin/bash
if [ $# != 2 ]; then
echo “USAGE: $0 <free,sleep time>”
exit 1;
fi
free -m > /tmp/freee
cat /tmp/freee
mkdir /tmp/memory
mount -t tmpfs -o size=$1M tmpfs /tmp/memory
dd if=/dev/zero of=/tmp/memory/block
free -m > /tmp/freee
cat /tmp/freee
echo “If executed ctrl+C,Please execute the following lines manually”
echo “execute: rm -rf /tmp/memory/block”
echo “execute: umount /tmp/memory”
echo “execute: rmdir /tmp/memory”
echo “Please wait $2 seconds”
sleep $2
rm -rf /tmp/memory/block
umount /tmp/memory
rmdir /tmp/memory
[root@centos-76-qcow2-50g-3 ~]#
测试
-
执行:
sh free.sh 2048 120
【2048是内存数量,单位是M,120是时间,单位是秒】 -
因为我这台虚机有64,所以我定义的是20480,占用20G
如果参数不够 会报错的
[root@centos-76-qcow2-50g-3 ~]# sh free.sh 1024
USAGE: free.sh <free,sleep time>
[root@centos-76-qcow2-50g-3 ~]#
执行以后可以就会出现下面内容【此时该脚本并不会结束,而是处于 sleep 120状态
[root@centos-76-qcow2-50g-3 ~]# sh free.sh 20480 120
total used free shared buff/cache available
Mem: 64264 451 63559 16 253 63300
Swap: 0 0 0
dd: writing to ‘/tmp/memory/block’: No space left on device
41943041+0 records in
41943040+0 records out
21474836480 bytes (21 GB) copied, 67.0879 s, 320 MB/s
total used free shared buff/cache available
Mem: 64264 451 43033 20496 20779 42797
Swap: 0 0 0
If executed ctrl+C,Please execute the following lines manually
execute: rm -rf /tmp/memory/block
execute: umount /tmp/memory
execute: rmdir /tmp/memory
Please wait 120 seconds
- 这个占用的是 shared共享内存,可以看到数量已经有变化了,并且free可用内存也相应减少了
- 等待120秒以后呢,该脚本运行结束,并且占用的内存也会被释放
[root@centos-76-qcow2-50g-3 ~]# sh free.sh 20480 120
total used free shared buff/cache available
Mem: 64264 451 63559 16 253 63300
Swap: 0 0 0
dd: writing to ‘/tmp/memory/block’: No space left on device
41943041+0 records in
41943040+0 records out
21474836480 bytes (21 GB) copied, 67.0879 s, 320 MB/s
total used free shared buff/cache available
Mem: 64264 451 43033 20496 20779 42797
Swap: 0 0 0
If executed ctrl+C,Please execute the following lines manually
execute: rm -rf /tmp/memory/block
execute: umount /tmp/memory
execute: rmdir /tmp/memory
Please wait 120 seconds
[root@centos-76-qcow2-50g-3 ~]#
[root@centos-76-qcow2-50g-3 ~]# free -m
total used free shared buff/cache available
Mem: 64264 451 63559 16 253 63300
Swap: 0 0 0
[root@centos-76-qcow2-50g-3 ~]#
rpm包下载安装
- 这个rpm包下载地址:内存占用rpm包.rar
下载好以后上传到linux主机上,然后通过下面方法安装好。
[root@ccx ~]# ls /opt
memload-7.0-1.r29766.x86_64.rpm
[root@ccx ~]# rpm -ivh /opt/memload-7.0-1.r29766.x86_64.rpm
Preparing… ################################# [100%]
Updating / installing…
1:memload-7.0-1.r29766 ################################# [100%]
[root@ccx ~]#
占用测试
- 基本环境弄好了,我们现在开始消耗内存看看【占用内存不要超过总内存】
我下面是在多个窗口中,注意看主机名 的变化
可以看到node2现在消耗了1G内存
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 1 28 0 1 29
Swap: 0 0 0
[root@ccx ~]#
#现在回到容器内部开始占用内容,因为我这虚机是32G内存,所以我占用多一点吧
#容器中占用了10G
[root@ccx ~]# memload 10240
Attempting to allocate 10240 Mebibytes of resident memory…
回到node2,可以看到10G确实可以被占用的
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 1 28 0 1 29
Swap: 0 0 0
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 4 24 0 1 25
Swap: 0 0 0
[root@ccx ~]#
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 7 22 0 1 23
Swap: 0 0 0
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 8 21 0 1 22
Swap: 0 0 0
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 11 18 0 1 19
Swap: 0 0 0
[root@ccx ~]#
释放
- 上面呢是可以正常释放的,现在我们释放掉占用的这10G
#容器ctrl+c即可释放
[root@ccx ~]# memload 10240
Attempting to allocate 10240 Mebibytes of resident memory…
Allocated 10000 pages
^C
[root@ccx ~]#
回到node2看是否已经被释放,然后再释放下缓存内存
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 1 28 0 1 29
Swap: 0 0 0
[root@ccx ~]# echo 3 > /proc/sys/vm/drop_caches
[root@ccx ~]#
[root@ccx ~]# free -g
total used free shared buff/cache available
Mem: 31 1 29 0 0 29
Swap: 0 0 0
[root@ccx ~]#
=====================================================================
-
这是一个是用来获取ATA/IDE硬盘的参数的命令,是由早期Linux IDE驱动的开发和维护人员 Mark Lord开发编写的( hdparm has been written by Mark Lord mlord@pobox.com, the primary developer and maintainer of the (E)IDE driver for Linux, with suggestions from many netfolk).该命令应该也是仅用于Linux系统,对于UNIX系统,ATA/IDE硬盘用的可能比较少,一般大型的系统都是使用磁盘阵列的.
-
使用方法很简单
/dev/sda3 是设备名称
为了做好运维面试路上的助攻手,特整理了上百道 【运维技术栈面试题集锦】 ,让你面试不慌心不跳,高薪offer怀里抱!
这次整理的面试题,小到shell、MySQL,大到K8s等云原生技术栈,不仅适合运维新人入行面试需要,还适用于想提升进阶跳槽加薪的运维朋友。
本份面试集锦涵盖了
- 174 道运维工程师面试题
- 128道k8s面试题
- 108道shell脚本面试题
- 200道Linux面试题
- 51道docker面试题
- 35道Jenkis面试题
- 78道MongoDB面试题
- 17道ansible面试题
- 60道dubbo面试题
- 53道kafka面试
- 18道mysql面试题
- 40道nginx面试题
- 77道redis面试题
- 28道zookeeper
总计 1000+ 道面试题, 内容 又全含金量又高
- 174道运维工程师面试题
1、什么是运维?
2、在工作中,运维人员经常需要跟运营人员打交道,请问运营人员是做什么工作的?
3、现在给你三百台服务器,你怎么对他们进行管理?
4、简述raid0 raid1raid5二种工作模式的工作原理及特点
5、LVS、Nginx、HAproxy有什么区别?工作中你怎么选择?
6、Squid、Varinsh和Nginx有什么区别,工作中你怎么选择?
7、Tomcat和Resin有什么区别,工作中你怎么选择?
8、什么是中间件?什么是jdk?
9、讲述一下Tomcat8005、8009、8080三个端口的含义?
10、什么叫CDN?
11、什么叫网站灰度发布?
12、简述DNS进行域名解析的过程?
13、RabbitMQ是什么东西?
14、讲一下Keepalived的工作原理?
15、讲述一下LVS三种模式的工作过程?
16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?
17、如何重置mysql root密码?
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注运维)
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
么对他们进行管理?
4、简述raid0 raid1raid5二种工作模式的工作原理及特点
5、LVS、Nginx、HAproxy有什么区别?工作中你怎么选择?
6、Squid、Varinsh和Nginx有什么区别,工作中你怎么选择?
7、Tomcat和Resin有什么区别,工作中你怎么选择?
8、什么是中间件?什么是jdk?
9、讲述一下Tomcat8005、8009、8080三个端口的含义?
10、什么叫CDN?
11、什么叫网站灰度发布?
12、简述DNS进行域名解析的过程?
13、RabbitMQ是什么东西?
14、讲一下Keepalived的工作原理?
15、讲述一下LVS三种模式的工作过程?
16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?
17、如何重置mysql root密码?
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注运维)
[外链图片转存中…(img-GHrYbYH3-1713370048085)]
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!