2019-06-11 架构第二次测试

1章 命令题

1.1 创建用户rsync指定uidgid1001,将/backup目录授权给rsync用户

Groupadd –g 1001 rsync

Usreadd -u 1001 –g rsync –s /sbin/nologin –M rsync

Chown rsync.rsync /backup

1.2/application/nginx-1.14.0创建一个名为/application/nginx的软连接

Ln –s /application/nginx-1.14.0 /application/naginx

1.3/etc/hostname文件推送至10.0.0.41 backup服务器上的/tmp目录(两种方法)

Rsync –az /etc/hostname 10.0.0.41:/tmp

Scp /etc/hostname 10.0.0.41:/tmp

1.4backup服务器上的/backup/test文件拉取至本机/tmp目录下,并作免交互

Rsync –az 10.0.0.41:/backup/test /tmp –password –file=/etc/rsync.pass

1.5 发送一封标题是“hello”内容是“hello oldboy”的邮件到testoldboy@163.com

Echo ‘hello oldboy’ | mail –s ‘hello’ testoldboy@163.com

1.6 取出本机的IP地址(三种方法)

ip a s eth0|sed -nr '3s#^.t (.)/.*$#\1#gp'

ip a s eth0 |egrep -o '[0-9.]{7,13}' |grep -v 255

ip a s eth0 |awk -F'[ /]' 'NR==3{print $6}'

1.7 找出/etc/目录下所有以.conf结尾的文件打包压缩到/backup目录下,压缩包以IP地址命名

ip=hostname -I |awk '{print $1}'

tar zcf /backup/$ip.tar.gz `find /etc/ -type f -name “*.conf”`

1.8 每天0000找出/etc/目录下所有以.conf结尾的文件打包压缩到/backup目录下,压缩包以时间命名,并推送到backup服务器上

 Vim back.sh

 #!/bin/bash

ip=hostname -I |awk '{print $1}'

#tar

tar zcf /backup/$ip.tar.gz `find /etc/ -type f -name “*.conf”`

#rsync

 Rsync –az /backup/ 10.0.0.41:/backup/ --password-file=/etc/rsync.ps

00 00 * * *  /server/scripts/back.sh >/dev/null 2>&1

1.9 将本地的/data目录共享为172.16.1.0/24网段可以挂载,挂载为可以读写,并全部压缩为uid999gid999的用户,然后挂载到backup172.16.1.41)服务器上的/backup目录上(写出nfs配置文件内容和挂载命令)

/data 172.16.1.0/24(rw,all_squash,anonuid=888,anongid=888)

/mont –t nfs /data/ /backup/

2章 简答题

2.1 写出用户访问网站详细的流程

1.DNS解析 2.TCP/IP三次握手建立连接 3.HTTP请求报文 4.空行 5.HTTP响应报文 6.TCP/IP 四次挥手断开连接

2.2 DNS中常见的记录类型及含义,DNSTTL是什么意思?

A 记录: IP、域名

CNAME 记录:别名记录CDN(网站加速,缓存网站页面)

MX 记录:邮件使用

TTL:(Time-To-live)原理:TTL是IP协议中的一个值,它告诉网络路由包在网络中的时间是否太长而应被丢弃。

2.3 nginx访问日志中的变量及含义

$remote_addr 客户端ip地址

$remote_user 远程用户(空)

[$time_local] 时间

"$request" 请求报文的起始行 $request_uri 只取出uri

'$status 状态码

$body_bytes_sent 身体 字节 发送 服务端发给客户端大小(文件大小)

"$http_referer" 用户浏览器

"$http_user_agent" 负载均衡: web服务器用来记录用户真实IP地址

2.4 写出nginx配置文件每部分的含义

worker_processes 1; worker 进程数量 所有核心数或*2

events {

worker_connections 1024; 每个进程最大连接数

}

http {

include mime.types; 媒体类型http协议中的文件类型

default_type application/octet-stream; 定义了nginx访问日志的格式

sendfile on; 开启高效传输模式

keepalive_timeout 65; 超时时间

server {

listen 80; 指定监听端口号

server_name www.oldboy.com; 域名

location / {

root html; 指定站点目录

index index.html index.htm; 首页文件(默认展示文件)

}

error_page 500 502 503 504 /50x.html; 错误提示 优雅显示

location = /50x.html {

root html; 指定站点目录

}

}

}

2.5 写出连不上网络排错的流程、

检查道路通不通

检查是否有拦截

查看服务是否正常

2.6 写出centos7开机启动流程

|

系统

|

CentOS6

|

CentOS7

|
| --- | --- | --- |
| |

开机自检(检查CPU,内存,磁盘,硬件是否有问题)

| |
| |

MBR引导(通过硬盘启动)

| |
| |

GRUB菜单(选择不同的内核)

| |
| |

加载内核

| |
| |

运行init进程

|

运行system进程

|
| |

读取/etc/inittab(读取运行级别)

|

读取运行级别(target(7) multi-user.target /etc/systemd/system/)

|
| |

读取/etc/rc.sysinit初始化系统

|

并行启动(usr/lib/systemd/system /etc/systemd/system)

|
| |

根据运行级别选择/etc/rc{0..6}.d下面的脚本

|

显示

|
| |

显示

| |

2.7 写出/etc/fstab每一列的含义

UUID=a00bfd6a-3689-41c0-a343-ae53c60f849e swap swap defaults 0 0

标识符 挂载点 挂载目录 文件系统 默认参数 是否自动挂载 是否自动备份

2.8 画出综合架构的综合架构示意图

3章 翻译题

3.1 /etc: not a regular file

不是个普通文件

3.2 ssh: connect to host 176.16.1.31 port 22: Connection refused

连接被拒绝

3.3 @ERROR: auth failed on module data

模块数据验证失败

3.4 secrets file must be owned by root when running as root (see strict modes)

<pre style="line-height:22.5pt;background:#FCFCFC">以root身份运行时,机密文件必须为root所有(请参见严格模式)</pre>

3.5 @ERROR: Unknown module 'data'

未知模块

3.6 Name or service not known

服务或名字未知

3.7 password mismatch

密码不匹配

3.8 permission denied

拒绝许可

3.9 remote command not found

找不到远程命令

3.10 wrong fs type

错误的****fs****类型

3.11 Connection refused

连接被拒绝

3.12 Address already in use

地址已经被使用

3.13 404 Not found

未找到****服务器未找到请求的页面

3.14 403 Forbidden

禁止****服务器拒绝请求

3.15 Cannot assign requested address

无法请求分配的地址

3.16 304 Not modified

未修改****自从上次请求后网页内容没有改变过。服务器返回此响应时,不会返回网页内容。

3.17 conflicting server name

冲突的服务器昵称

3.18 401 Authorization Required

需要授权

3.19 500 Internal Server Error

内部服务器错误

3.20 Access denied for user 'wordpress'@'localhost' (using password: YES)

访问被拒绝 (使用密码:是)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容