为了做好运维面试路上的助攻手,特整理了上百道 【运维技术栈面试题集锦】 ,让你面试不慌心不跳,高薪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密码?
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
| 6 | S_IROTH
| 其他用户读 |
- 返回值
| No. | 返回值 | 含义 |
| — | — | — |
| 1 | -1
| 出错 |
| 2 | 其他 | 共享内存描述符 |
- 示例
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = shm_open(argv[1],O_CREAT|O_RDWR,0644);
ftruncate(fd,atoi(argv[2]));
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_WRITE,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
}
3.1.2 删除
int shm_unlink(const char *name)
- 参数
| No. | 参数 | 含义 |
| — | — | — |
| 1 | name
| posix IPC名字 |
- 返回值
| No. | 返回值 | 含义 |
| — | — | — |
| 1 | -1
| 出错 |
| 2 | 0
| 成功 |
- 示例
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
shm_unlink(argv[1]);
}
3.1.3 建立内存映射
void* mmap(void* start,size_t length,int prot,int flags,int fd,off_t offset)
- 参数
| No. | 参数 | 含义 |
| — | — | — |
| 1 | start
| 映射区的开始地址,通常使用NULL
,让系统决定映射区的起始地址 |
| 2 | length
| 映射区的长度,单位字节,不足一内存页按一内存页处理 |
| 3 | prot
| 内存保护标志 |
| 4 | flags
| 映射对象的类型 |
| 5 | fd
| 文件描述符,不能是套接字和终端的fd
,-1
为匿名内存映射 |
| 6 | offset
| 被映射对象内容的起点,只能是页大小的整数倍 |
如何获取页大小?
sysconf(_SC_PAGESIZE)
- 内存保护标志
| No. | 参数 | 含义 |
| — | — | — |
| 1 | PROT_EXEC
| 页内容可以被执行 |
| 2 | PROT_READ
| 页内容可以被读取 |
| 3 | PROT_WRITE
| 页可以被写入 |
| 4 | PROT_NONE
| 页不可访问,不能与文件的打开模式冲突 |
- 映射对象的类型
| No. | 参数 | 含义 |
| — | — | — |
| 1 | MAP_SHARED
| 变动共享 |
| 2 | MAP_PRIVATE
| 变动私有 |
| 3 | MAP_ANON
| 匿名内存映射 |
- 返回值
| No. | 返回值 | 含义 |
| — | — | — |
| 1 | MAP_FAILED
| 失败 |
| 2 | 非MAP_FAILED
| 共享内存地址 |
- 示例
写
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = shm_open(argv[1],O_RDWR,0);
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_WRITE,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
strcpy(buf,argv[2]);
munmap(buf,BUFSIZ);
}
读
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = shm_open(argv[1],O_RDONLY,0);
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_READ,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
printf(“%s\n”,buf);
munmap(buf,BUFSIZ);
}
3.1.4 关闭内存映射
int munmap(void *start,size_t length)
- 参数
| No. | 参数 | 含义 |
| — | — | — |
| 1 | start
| 映射内存起始地址 |
| 2 | length
| 内存大小 |
- 返回值
| No. | 返回值 | 含义 |
| — | — | — |
| 1 | 0
| 成功 |
| 2 | -1
| 失败 |
- 注意
关闭mmap
中的文件描述符不能删除内存映射。
4.1 内存映射文件
- 创建文件并且写入数据
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(){
int fd = open(“./mmap.txt”,O_CREAT|O_RDWR,0644);
char str[] = “hello mmap\n”;
ftruncate(fd,sizeof(str));
void* buf = NULL;
if(( buf = mmap(NULL,sizeof(str),PROT_WRITE,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
strcpy(buf,str);
munmap(buf,sizeof(str));
close(fd);
}
问题
如果没有ftruncate(fd,sizeof(str));
会出现什么情况?
- 读取数据并且重新写入数据
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = open(“./mmap.txt”,O_RDWR);
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
printf(“%s\n”,buf);
strcpy(buf,“this sdfdsfdsfdsfdsfdsfdsfdsfdsfdsf\n”);
munmap(buf,BUFSIZ);
close(fd);
}
- 亲缘进程读写数据
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = open(“./mmap.txt”,O_CREAT|O_RDWR,0644);
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
if(fork()){
strcpy(buf,argv[1]);
}else{
printf(“%s\n”,buf);
}
munmap(buf,BUFSIZ);
close(fd);
}
- 非亲缘进程读写数据
写
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = open(“./mmap.txt”,O_CREAT|O_RDWR,0644);
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
strcpy(buf,argv[1]);
munmap(buf,BUFSIZ);
close(fd);
}
读
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
int fd = open(“./mmap.txt”,O_CREAT|O_RDWR,0644);
void* buf = NULL;
if(( buf = mmap(NULL,BUFSIZ,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0)) == MAP_FAILED){
perror(“mmap error\n”);
return 1;
}
printf(“%s\n”,buf);
munmap(buf,BUFSIZ);
close(fd);
}
4.2 共享内存区对象(非亲缘进程)
写
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前在阿里
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上运维知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
io.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
int main(int argc,char* argv[]){
先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前在阿里
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
[外链图片转存中…(img-g9hULXSS-1714807547644)]
[外链图片转存中…(img-ViprnCsb-1714807547644)]
[外链图片转存中…(img-ZpIx1U2w-1714807547645)]
[外链图片转存中…(img-pgtmr6vb-1714807547645)]
[外链图片转存中…(img-ZR8cZFxT-1714807547645)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上运维知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新