images\cherry_red.png1 Linux运维学习笔记
      images\cherry_blue.png1.1 基本操作命令
         images\cherry_orange.png1.1.1 权限管理
            images\cherry_cyan.png1.1.1.1 chmod
            images\cherry_cyan.png1.1.1.2 chown
            images\cherry_cyan.png1.1.1.3 setfacl
            images\cherry_cyan.png1.1.1.4 chattr
         images\cherry_orange.png1.1.2 用户管理
            images\cherry_cyan.png1.1.2.1 useradd(添加用户)
            images\cherry_cyan.png1.1.2.2 passwd(修改用户密码)
            images\cherry_cyan.png1.1.2.3 userdel(删除用户角色)
            images\cherry_cyan.png1.1.2.4 usermod(修改用户信息)
            images\cherry_cyan.png1.1.2.5 groupadd(添加工作组)
            images\cherry_cyan.png1.1.2.6 groupdel(删除工作组)
         images\cherry_orange.png1.1.3 文件管理
            images\cherry_cyan.png1.1.3.1 cat
            images\cherry_cyan.png1.1.3.2 mv
            images\cherry_cyan.png1.1.3.3 scp,rsync文件传输
               images\cherry_orange_dark.png1.1.3.3.1 scp
            images\cherry_cyan.png1.1.3.4 rz
            images\cherry_cyan.png1.1.3.5 awk
               images\cherry_orange_dark.png1.1.3.5.1 案例
            images\cherry_cyan.png1.1.3.6 cp复制
            images\cherry_cyan.png1.1.3.7 more
            images\cherry_cyan.png1.1.3.8 less
            images\cherry_cyan.png1.1.3.9 mkdir
            images\cherry_cyan.png1.1.3.10 diff
            images\cherry_cyan.png1.1.3.11 head
            images\cherry_cyan.png1.1.3.12 tail
            images\cherry_cyan.png1.1.3.13 sed
            images\cherry_cyan.png1.1.3.14 sort
            images\cherry_cyan.png1.1.3.15 uniq (去重语句)
            images\cherry_cyan.png1.1.3.16 grep
               images\cherry_orange_dark.png1.1.3.16.1 grep(2)
            images\cherry_cyan.png1.1.3.17 xargs
            images\cherry_cyan.png1.1.3.18 tr
            images\cherry_cyan.png1.1.3.19 cut
            images\cherry_cyan.png1.1.3.20 od
            images\cherry_cyan.png1.1.3.21 dos2unix
            images\cherry_cyan.png1.1.3.22 cpio
            images\cherry_cyan.png1.1.3.23 tee
            images\cherry_cyan.png1.1.3.24 column
            images\cherry_cyan.png1.1.3.25 swapon
         images\cherry_orange.png1.1.4 软件包管理
            images\cherry_cyan.png1.1.4.1 yarn
            images\cherry_cyan.png1.1.4.2 zip
         images\cherry_orange.png1.1.5 备份策略
            images\cherry_cyan.png1.1.5.1 tar
            images\cherry_cyan.png1.1.5.2 cp
      images\cherry_blue.png1.2 系统工作常用命令
         images\cherry_orange.png1.2.1 ab(压力测试)
            images\cherry_cyan.png1.2.1.1 ab常见问题
         images\cherry_orange.png1.2.2 nohup
            images\cherry_cyan.png1.2.2.1 bg fg
         images\cherry_orange.png1.2.3 crontab
         images\cherry_orange.png1.2.4 find
            images\cherry_cyan.png1.2.4.1 find
         images\cherry_orange.png1.2.5 tcpdump
         images\cherry_orange.png1.2.6 ifconfig
         images\cherry_orange.png1.2.7 netstat(网络通信情况)
         images\cherry_orange.png1.2.8 ps (查看系统进程)
         images\cherry_orange.png1.2.9 top (系统运维状态)
         images\cherry_orange.png1.2.10 alias
         images\cherry_orange.png1.2.11 pidof
         images\cherry_orange.png1.2.12 kill与killall与pkill
         images\cherry_orange.png1.2.13 uptime(系统负载信息)
         images\cherry_orange.png1.2.14 free(系统内存情况)
         images\cherry_orange.png1.2.15 last(登陆日志)
         images\cherry_orange.png1.2.16 fdisk(磁盘分区)
         images\cherry_orange.png1.2.17 strace
         images\cherry_orange.png1.2.18 lsmod
         images\cherry_orange.png1.2.19 ssh
            images\cherry_cyan.png1.2.19.1 sshpass
         images\cherry_orange.png1.2.20 ftp (sftp)
         images\cherry_orange.png1.2.21 du
         images\cherry_orange.png1.2.22 umask(文件权限)
         images\cherry_orange.png1.2.23 df (磁盘占用情况)
         images\cherry_orange.png1.2.24 curl
         images\cherry_orange.png1.2.25 date
         images\cherry_orange.png1.2.26 lsof
         images\cherry_orange.png1.2.27 chrony
         images\cherry_orange.png1.2.28 cpu运行状态
         images\cherry_orange.png1.2.29 lshw
         images\cherry_orange.png1.2.30 vim
         images\cherry_orange.png1.2.31 lsb_release -a (系统版本信息)
      images\cherry_blue.png1.3 网络基础
         images\cherry_orange.png1.3.1 ifconfig
         images\cherry_orange.png1.3.2 route
         images\cherry_orange.png1.3.3 nslookup
         images\cherry_orange.png1.3.4 ping网关
         images\cherry_orange.png1.3.5 ISO/OSI七层模型
         images\cherry_orange.png1.3.6 TCP/IP三次握手(四次挥手)
            images\cherry_cyan.png1.3.6.1 三次握手
            images\cherry_cyan.png1.3.6.2 四次挥手
         images\cherry_orange.png1.3.7 IP地址网段(可用IP地址)(广播地址)
         images\cherry_orange.png1.3.8 网络连接数
         images\cherry_orange.png1.3.9 mtr
         images\cherry_orange.png1.3.10 ip
      images\cherry_blue.png1.4 系统管理类
         images\cherry_orange.png1.4.1 进程与线程
            images\cherry_cyan.png1.4.1.1 pstree
         images\cherry_orange.png1.4.2 系统安全
            images\cherry_cyan.png1.4.2.1 记录一次远程挖矿病毒
            images\cherry_cyan.png1.4.2.2 漏洞修补
         images\cherry_orange.png1.4.3 nfs远程挂载
            images\cherry_cyan.png1.4.3.1 nfs自动挂载
         images\cherry_orange.png1.4.4 查询系统用户登录情况
         images\cherry_orange.png1.4.5 权限优化
         images\cherry_orange.png1.4.6 备份策略
         images\cherry_orange.png1.4.7 Raid(磁盘阵列)
         images\cherry_orange.png1.4.8 资源查看(监控)
            images\cherry_cyan.png1.4.8.1 dstat(网络监控)
         images\cherry_orange.png1.4.9 启动流程
         images\cherry_orange.png1.4.10 系统优化
         images\cherry_orange.png1.4.11 cpu
      images\cherry_blue.png1.5 Shell编程
         images\cherry_orange.png1.5.1 数组类型
         images\cherry_orange.png1.5.2 if 条件判断
         images\cherry_orange.png1.5.3 for
         images\cherry_orange.png1.5.4 文本截取
         images\cherry_orange.png1.5.5 随机字符串
         images\cherry_orange.png1.5.6 网站检测
            images\cherry_cyan.png1.5.6.1 nmap
         images\cherry_orange.png1.5.7 Debug
         images\cherry_orange.png1.5.8 declare
      images\cherry_blue.png1.6 网络服务类
         images\cherry_orange.png1.6.1 网关
         images\cherry_orange.png1.6.2 SSH服务
         images\cherry_orange.png1.6.3 DHCP + FTP
         images\cherry_orange.png1.6.4 DNS服务
            images\cherry_cyan.png1.6.4.1 智能DNS
         images\cherry_orange.png1.6.5 Apache配置
            images\cherry_cyan.png1.6.5.1 Apache 三种工作模式
         images\cherry_orange.png1.6.6 Apache优化
            images\cherry_cyan.png1.6.6.1 CDN
         images\cherry_orange.png1.6.7 Nginx配置
            images\cherry_cyan.png1.6.7.1 nginx开启SSL证书
            images\cherry_cyan.png1.6.7.2 Session一致性解决方案
            images\cherry_cyan.png1.6.7.3 异步非阻塞方式
            images\cherry_cyan.png1.6.7.4 Nginx反向代理配置出现问题
            images\cherry_cyan.png1.6.7.5 nginx 负载均衡算法
            images\cherry_cyan.png1.6.7.6 nginx status
         images\cherry_orange.png1.6.8 Nginx优化
            images\cherry_cyan.png1.6.8.1 Nginx请求PHP(Tomcat)过程
            images\cherry_cyan.png1.6.8.2 gzip压缩
            images\cherry_cyan.png1.6.8.3 缓存优化
            images\cherry_cyan.png1.6.8.4 反向代理
         images\cherry_orange.png1.6.9 http状态码
      images\cherry_blue.png1.7 数据库管理类
         images\cherry_orange.png1.7.1 集群部署(Amoeba)
         images\cherry_orange.png1.7.2 索引
         images\cherry_orange.png1.7.3 误操作Drop语句如何解决?
         images\cherry_orange.png1.7.4 Redis(缓存数据库)
            images\cherry_cyan.png1.7.4.1 Redis_
      images\cherry_blue.png1.8 Good Luck
      images\cherry_blue.png1.9 Linux(实际工作可能常用命令)
      images\cherry_blue.png1.10 LeetCode(Bash)
         images\cherry_orange.png1.10.1 统计词频
         images\cherry_orange.png1.10.2 有效电话号码
   images\cherry_red.png2 三剑客
      images\cherry_blue.png2.1 正则表达式
         images\cherry_orange.png2.1.1 扩展正则表达式
      images\cherry_blue.png2.2 grep(...过滤)
      images\cherry_blue.png2.3 sed(...替换)
         images\cherry_orange.png2.3.1 sed删除,增加
         images\cherry_orange.png2.3.2 sed 替换
      images\cherry_blue.png2.4 awk(...取列统计)
         images\cherry_orange.png2.4.1 awk模式匹配
         images\cherry_orange.png2.4.2 awk数组
一、Nginx负载均衡算法
1、轮询(默认)
每个请求按时间顺序逐一分配到不同的后端服务,如果后端某台服务器死机,自动剔除故障系统,使用户访问不受影响。

2、weight(轮询权值)
weight的值越大分配到的访问概率越高,主要用于后端每台服务器性能不均衡的情况下。或者仅仅为在主从的情况下设置不同的权值,达到合理有效的地利用主机资源。

3、ip_hash
每个请求按访问IP的哈希结果分配,使来自同一个IP的访客固定访问一台后端服务器,并且可以有效解决动态网页存在的session共享问题。

4、fair
比 weight、ip_hash更加智能的负载均衡算法,fair算法可以根据页面大小和加载时间长短智能地进行负载均衡,也就是根据后端服务器的响应时间
来分配请求,响应时间短的优先分配。Nginx本身不支持fair,如果需要这种调度算法,则必须安装upstream_fair模块。

5、url_hash
访问的URL的哈希结果来分配请求,使每个URL定向到一台后端服务器,可以进一步提高后端缓存服务器的效率。Nginx本身不支持url_hash,如果需要这种调度算法,则必须安装Nginx的hash软件包。


二、Nginx负载均衡调度状态
在Nginx upstream模块中,可以设定每台后端服务器在负载均衡调度中的状态,常用的状态有:

1、down,表示当前的server暂时不参与负载均衡

2、backup,预留的备份机器。当其他所有的非backup机器出现故障或者忙的时候,才会请求backup机器,因此这台机器的访问压力最低

3、max_fails,允许请求失败的次数,默认为1,当超过最大次数时,返回proxy_next_upstream模块定义的错误。

4、fail_timeout,请求失败超时时间,在经历了max_fails次失败后,暂停服务的时间。max_fails和fail_timeout可以一起使用。