设为首页 加入收藏

TOP

Linux运维(五)
2019-09-03 00:54:02 】 浏览:43
Tags:Linux 运维

协议有:TCP UDP,数据包一旦离开网卡即进入网络传输层

网络层 (Network):

进行逻辑地址寻址,实现不同网络之间的路径选择。

协议有:ICMP IGMP IP(IPV4 IPV6) ARP RARP

数据链路层 (Link):

建立逻辑连接、进行硬件地址寻址、差错校验等功能。(由底层网络定义协议)

将比特组合成字节进而组合成帧,用MAC地址访问介质,错误发现但不能纠正

物理层(Physical Layer):

是计算机网络OSI模型中最低的一层

物理层规定:为传输数据所需要的物理链路创建、维持、拆除

而提供具有机械的,电子的,功能的和规范的特性

简单的说,物理层确保原始的数据可在各种物理媒体上传输。局域网与广域网皆属第1、2层

物理层是OSI的第一层,它虽然处于最底层,却是整个开放系统的基础

物理层为设备之间的数据通信提供传输媒体及互连设备,为数据传输提供可靠的环境

如果您想要用尽量少的词来记住这个第一层,那就是“信号和介质”

31、你常用的Nginx模块,用来做什么

rewrite模块,实现重写功能

access模块:来源控制

ssl模块:安全加密

ngx_http_gzip_module:网络传输压缩模块

ngx_http_proxy_module 模块实现代理

ngx_http_upstream_module模块实现定义后端服务器列表

ngx_cache_purge实现缓存清除功能

32、请列出你了解的web服务器负载架构

Nginx

Haproxy

Keepalived

LVS

33、查看http的并发请求数与其TCP连接状态

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

还有ulimit -n 查看linux系统打开最大的文件描述符,这里默认1024

不修改这里web服务器修改再大也没用,若要用就修改很几个办法,这里说其中一个:

修改/etc/security/limits.conf

  • soft nofile 10240

  • hard nofile 10240

重启后生效

34、用tcpdump嗅探80端口的访问看看谁最高

tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}'| sort | uniq -c | sort -nr |head -20

35、写一个脚本,实现判断192.168.1.0/24网络里,当前在线的IP有哪些,能ping通则认为在线

!/bin/bash

for ip in seq 1 255

do

{

ping -c 1 192.168.1.$ip > /dev/null 2>&1

if [ $? -eq 0 ]; then

echo 192.168.1.$ip UP

else

echo 192.168.1.$ip DOWN

fi

}&

done

wait

36、已知 apache 服务的访问日志按天记录在服务器本地目录/app/logs 下,由于磁盘空间紧张现在要求只能保留最近 7 天的访问日志!请问如何解决? 请给出解决办法或配置或处理命令

创建文件脚本:

!/bin/bash

for n in seq 14

do

date -s "11/0$n/14"

touch access_www_(date +%F).log

done

解决方法:

pwd/application/logs

ll

-rw-r--r--. 1 root root 0 Jan 1 00:00 access_www_2015-01-01.log
-rw-r--r--. 1 root root 0 Jan 2 00:00 access_www_2015-01-02.log
-rw-r--r--. 1 root root 0 Jan 3 00:00 access_www_2015-01-03.log
-rw-r--r--. 1 root root 0 Jan 4 00:00 access_www_2015-01-04.log
-rw-r--r--. 1 root root 0 Jan 5 00:00 access_www_2015-01-05.log
-rw-r--r--. 1 root root 0 Jan 6 00:00 access_www_2015-01-06.log
-rw-r--r--. 1 root root 0 Jan 7 00:00 access_www_2015-01-07.log
-rw-r--r--. 1 root root 0 Jan 8 00:00 access_www_2015-01-08.log
-rw-r--r--. 1 root root 0 Jan 9 00:00 access_www_2015-01-09.log
-rw-r--r--. 1 root root 0 Jan 10 00:00 access_www_2015-01-10.log
-rw-r--r--. 1 root root 0 Jan 11 00:00 access_www_2015-01-11.log
-rw-r--r--. 1 root root 0 Jan 12 00:00 access_www_2015-01-12.log
-rw-r--r--. 1 root root 0 Jan 13 00:00 access_www_2015-01-13.log

-rw-r--r--. 1 root root 0 Jan 14 00:00 access_www_2015-01-14.log

find /application/logs/ -type f -mtime +7 -name "*.log"|xargs rm –f

也可以使用-exec rm -f {} ;进行删除

ll

-rw-r--r--. 1 root root 0 Jan 7 00:00 access_www_2015-01-07.log
-rw-r--r--. 1 root root 0 Jan 8 00:00 access_www_2015-01-08.log
-rw-r--r--. 1 root root 0 Jan 9 00:00 access_www_2015-01-09.log
-rw-r--r--. 1 root root 0 Jan 10 00:00 access_www_2015-01-10.log
-rw-r--r--. 1 root root 0 Jan 11 00:00 access_www_2015-01-11.log
-rw-r--r--. 1 root root 0 Jan 12 00:00 access_www_2015-01-12.log
-rw-r--r--. 1 root root 0 Jan 13 00:00 access_www_2015-01-13.log

-rw-r--r--. 1 root root 0 Jan 14 00:00 access_www_2015-01-14.log

37、如何优化 Linux系统(可以不说太具体)?

  1. 不用root,添加普通用户,通过sudo授权管理

  2. 更改默认的远程连接SSH服务端口及禁止root用户远程连接

  3. 定时自动更新服务器时间

  4. 配置国内yum源

  5. 关闭selinux及iptables(iptables工作场景如果有外网IP一定要打开,高并发除外)

  6. 调整文件描述符的数量

  7. 精简开机启动服务(crond rsyslog network sshd)

  8. 内核参数优化(/etc

首页 上一页 2 3 4 5 6 下一页 尾页 5/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇chmod chown llinux文件及目录的.. 下一篇linux每日命令(27):chmod命令

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目