1. 作业一:
  2. nginx反向代理三台web服务器,实现负载均衡
  3. 所有的web服务共享一台nfs的存储
  4. 2台服务器
  5. nginx lb :101.200.206.6
  6. nginx web】:101.200.169.119
  7.  
  8. 准备环境:
  9. 分别在所有服务器执行
  10. =======>part1:
  11. iptables -F
  12. #systemctl disable firewalld #开机默认关闭
  13. #systemctl stop firewalld #立即关闭
  14. #systemctl status firewalld
  15.  
  16. setenforce 0
  17. #/etc/sysconfig/selinux
  18. #SELINUX=disabled
  19. ==========>part2:
  20. 安装程序
  21. yum install rpcbind nfs-utils -y
  22. yum install nginx -y
  23. ==========>part3:
  24.  
  25. lb
  26. 创建共享目录 mkdir /nfs
  27. 修改配置文件
  28. [root@iZ25j36rr97Z nfs]# cat /etc/exports
  29. /nfs *(rw,sync,fsid=0)
  30. 修改权限
  31. chmod -R o+w /nfs
  32. 先为rpcbindnfs做开机启动:
  33. systemctl enable nfs-server.service
  34. systemctl enable rpcbind.service
  35. systemctl start rpcbind.service
  36. systemctl start nfs-server.service
  37. 确认启动成功
  38. [root@iZ25j36rr97Z nfs]# rpcinfo
  39. program version netid address service owner
  40. 100000 4 tcp 0.0.0.0.0.111 portmapper superuser
  41. 100000 3 tcp 0.0.0.0.0.111 portmapper superuser
  42. 100000 2 tcp 0.0.0.0.0.111 portmapper superuser
  43. 100000 4 udp 0.0.0.0.0.111 portmapper superuser
  44. 100000 3 udp 0.0.0.0.0.111 portmapper superuser
  45. 100000 2 udp 0.0.0.0.0.111 portmapper superuser
  46. 100000 4 local /var/run/rpcbind.sock portmapper superuser
  47. 100000 3 local /var/run/rpcbind.sock portmapper superuser
  48. 100011 1 udp 0.0.0.0.3.107 rquotad superuser
  49. 100011 2 udp 0.0.0.0.3.107 rquotad superuser
  50. 100011 1 tcp 0.0.0.0.3.107 rquotad superuser
  51. 100011 2 tcp 0.0.0.0.3.107 rquotad superuser
  52. 100005 1 udp 0.0.0.0.169.8 mountd superuser
  53. 100005 1 tcp 0.0.0.0.202.245 mountd superuser
  54. 100005 2 udp 0.0.0.0.200.5 mountd superuser
  55. 100005 2 tcp 0.0.0.0.190.185 mountd superuser
  56. 100005 3 udp 0.0.0.0.236.40 mountd superuser
  57. 100005 3 tcp 0.0.0.0.152.224 mountd superuser
  58. 100003 2 tcp 0.0.0.0.8.1 nfs superuser
  59. 100003 3 tcp 0.0.0.0.8.1 nfs superuser
  60. 100003 4 tcp 0.0.0.0.8.1 nfs superuser
  61. 100227 2 tcp 0.0.0.0.8.1 nfs_acl superuser
  62. 100227 3 tcp 0.0.0.0.8.1 nfs_acl superuser
  63. 100003 2 udp 0.0.0.0.8.1 nfs superuser
  64. 100003 3 udp 0.0.0.0.8.1 nfs superuser
  65. 100003 4 udp 0.0.0.0.8.1 nfs superuser
  66. 100227 2 udp 0.0.0.0.8.1 nfs_acl superuser
  67. 100227 3 udp 0.0.0.0.8.1 nfs_acl superuser
  68. 100021 1 udp 0.0.0.0.134.187 nlockmgr superuser
  69. 100021 3 udp 0.0.0.0.134.187 nlockmgr superuser
  70. 100021 4 udp 0.0.0.0.134.187 nlockmgr superuser
  71. 100021 1 tcp 0.0.0.0.218.123 nlockmgr superuser
  72. 100021 3 tcp 0.0.0.0.218.123 nlockmgr superuser
  73. 100021 4 tcp 0.0.0.0.218.123 nlockmgr superuser
  74. 100024 1 udp 0.0.0.0.131.201 status 29
  75. 100024 1 tcp 0.0.0.0.206.148 status 29
  76. [root@iZ25j36rr97Z nfs]# exportfs
  77. /nfs <world>
  78. 默认查看自己共享的服务
  79. [root@iZ25j36rr97Z nfs]# showmount -e
  80. Export list for iZ25j36rr97Z:
  81. /nfs *
  82. [root@iZ25j36rr97Z nfs]#
  83. 修改【lb nginx配置
  84. [root@iZ25j36rr97Z conf]# cat nginx.conf
  85. worker_processes 1;
  86. events {
  87. worker_connections 1024;
  88. }
  89. http {
  90. upstream nginxlb
  91. {
  92. server 101.200.206.67:8081;
  93. server 101.200.169.119:8081;
  94. server 101.200.169.119:8082;
  95. }
  96. include mime.types;
  97. default_type application/octet-stream;
  98. sendfile on;
  99. keepalive_timeout 65;
  100. server {
  101. listen 80;
  102. server_name 101.200.206.67;
  103. location / {
  104. proxy_pass http://nginxlb;
  105. }
  106. error_page 500 502 503 504 /50x.html;
  107. location = /50x.html {
  108. root html;
  109. }
  110. }
  111. server {
  112. listen 8081;
  113. server_name 101.200.206.67;
  114. location / {
  115. root html;
  116. index nginx.txt index.html index.htm;
  117. }
  118. error_page 500 502 503 504 /50x.html;
  119. location = /50x.html {
  120. root html;
  121. }
  122. }
  123. }
  124. 在根目录添加 nginx.txt
  125. echo 'nginx' >nginx.txt
  126. mount -t nfs 101.200.206.67:/nfs /home/service/nginx/html
  127.  
  128. 客户端执行
  129. yum install rpcbind nfs-utils -y
  130. mount -t nfs 101.200.206.67:/nfs /home/service/nginx/html
  131. 修改nginx配置
  132. [root@iZ2ze0sw83m5wno8bd2yudZ conf]# cat nginx.conf
  133. worker_processes 1;
  134. events {
  135. worker_connections 1024;
  136. }
  137. http {
  138. include mime.types;
  139. default_type application/octet-stream;
  140. sendfile on;
  141. keepalive_timeout 65;
  142. server {
  143. listen 8081;
  144. server_name localhost;
  145. location / {
  146. root html;
  147. index 8081.txt index.html index.htm;
  148. }
  149. error_page 500 502 503 504 /50x.html;
  150. location = /50x.html {
  151. root html;
  152. }
  153. }
  154. }
  155. [root@iZ2ze0sw83m5wno8bd2yudZ conf]# cat nginx1.conf
  156. worker_processes 1;
  157. events {
  158. worker_connections 1024;
  159. }
  160. http {
  161. include mime.types;
  162. default_type application/octet-stream;
  163. sendfile on;
  164. keepalive_timeout 65;
  165. server {
  166. listen 8082;
  167. server_name localhost;
  168. location / {
  169. root html;
  170. index 8082.txt index.html index.htm;
  171. }
  172. error_page 500 502 503 504 /50x.html;
  173. location = /50x.html {
  174. root html;
  175. }
  176. }
  177. }
  178.  
  179. echo '8081' >8081.txt
  180. echo '8082' >8082.txt
  181. 启动服务端和客户端nginx
  182. /home/service/nginx/sbin/nginx -c /home/service/nginx/conf/nginx.conf
  183. /home/service/nginx/sbin/nginx -c /home/service/nginx/conf/nginx1.conf
  184.  
  185. 在浏览器端查看轮询结果
  186. 3web 依次被lb调度

  

nfs cron shell 作业的更多相关文章

  1. nfs cron shell 笔记

    1.nfs 2.crond 3.shell 1.准备环境: 防火墙 selinux 配置ip 2.安装软件 二进制 源码安装 3.改改配置文件 二进制:/etc/nginx/nginx.conf 源码 ...

  2. shell作业后台执行的方法

    来思考几种场景: 1.某个脚本需要执行时间比较长,无人值守,可能执行过程中因ssh会话超时而中断? 2.某次测试一段代码,需要临时放入后台运行? 3.放入后台运行的脚本,需要在一段时间后重新调到前台? ...

  3. shell作业01

    1.判断/etc/inittab文件是否大于100行,如果大于,则显示”/etc/inittab is a big file.”否者显示”/etc/inittab is a small file.” ...

  4. xv6的作业翻译——作业1 - shell和系统调用

    Xv6的lecture LEC 1 Operating systems   L1: O/S overview L1:O/S概述   * 6.828 goals 6.828的目标   Understan ...

  5. cron,linux定时脚本

    Linux的cron和crontab Cron定时执行工具详解 Linux下的crontab定时执行任务命令详解 Linux上启动Cron任务 [linux]解析crontab cron表达式详解 c ...

  6. Shell记录-Shell命令(定时任务)

    在Linux系统中, at 命令是针对仅运行一次的任务,循环运行的例行性计划任务,linux系统则是由 cron(crond) 这个系统服务来控制的.Linux 系统上面原本就有非常多的计划性工作,因 ...

  7. Ansible部署rsync、nfs及sersync

    rsync nfs sersync httpd环境: 角色 外网IP(NAT) 内网IP(LAN) 主机名 Rsync服务端 eth0:10.0.1.51 eth1:172.16.1.51 backu ...

  8. NFS网络文件共享服务

    NFS-网络文件系统,它的主要功能是通过网络让不同的主机系统之间可以彼此共享文件或目录. NFS在企业中得应用场景 在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频.图片.附件等静 ...

  9. 【NFS】nfs安装调优

    nfs [root@flymaster ~]# rpm -qa nfs-utils rpcbindnfs-utils-1.2.3-75.el6.x86_64rpcbind-0.2.0-13.el6_9 ...

随机推荐

  1. 【转】服务器.htaccess 详解以及 .htaccess 参数说明

    htaccess文件(或者”分布式配置文件”)提供了针对目录改变配置的方法, 即,在一个特定的文档目录中放置一个包含一个或多个指令的文件, 以作用于此目录及其所有子目录.作为用户,所能使用的命令受到限 ...

  2. mac 下面配置gradle

    最近刚开始用gradle,先向大家介绍一下怎么配置gradle的环境变量吧: 1.下载最新安装包gradle-xxx-all.zip:http://www.gradle.org,并解压到/Users/ ...

  3. Flume-NG源码阅读之HBaseSink

    关于HBase的sink的所有内容均在org.apache.flume.sink.hbase包下. 每个sink包括自己定制的,都extends AbstractSink implements Con ...

  4. Python OS导入一个文件夹所有文件

    import os path = 'F:/save_file/seminarseries/' for root, dirs, files in os.walk(path): print(root) 这 ...

  5. DH02-策略模式

    模式简介 面向对象的编程,并不是类越多越好,类的划分是为了封装,但分类的基础是抽象,具有相同属性和功能的对象的抽象集合才是类. 策略模式(Strategy)定义了算法家族,分别封装起来,让他们相互间可 ...

  6. MSDN 单机 MVC 帮助文档

    因为微软的mvc框架也是从开源框架演变而来的,所以微软没把mvc帮助文档放到单击帮助文档中.sososos下载好msdn单机帮助后,却找不到 System.Web.MVC 等命名空间的东西. 解决办法 ...

  7. WP追加字符串到文件

    #if DEBUG const string logfile = "demo.log"; try { using (var sw = new System.IO.StreamWri ...

  8. hadoop-0.20.1+120 hive-0.3.99.1+0 试用hwi(hive web interface

    摘自:http://www.chinacloud.cn/show.aspx?id=3274&cid=12 [日期:2010-07-04] 来源:淘宝数据平台团队  作者: [字体:大 中 小] ...

  9. 开发一个app需要多少钱

    App应用开发是目前最热门的产业,很多企业都想通过app的开发来进入移动互联网市场分一杯羹. 那么你一定很想知道开发一个app需要多少钱吧?那下面企业帮就来帮大家计算一下费用吧. 面对app抄袭成风的 ...

  10. CodeForces-831A-Unimodal Array (水题)

    题目链接 /* Name: Copyright: Author: Date: 2018/5/6 19:34:23 Description: */ #include <iostream> # ...