nfs cron shell 作业
- 作业一:
- nginx反向代理三台web服务器,实现负载均衡
- 所有的web服务共享一台nfs的存储
- 2台服务器
- nginx 【lb】 :101.200.206.6
- nginx 【web】:101.200.169.119
- 准备环境:
- 分别在所有服务器执行
- =======>part1:
- iptables -F
- #systemctl disable firewalld #开机默认关闭
- #systemctl stop firewalld #立即关闭
- #systemctl status firewalld
- setenforce 0
- #/etc/sysconfig/selinux
- #SELINUX=disabled
- ==========>part2:
- 安装程序
- yum install rpcbind nfs-utils -y
- yum install nginx -y
- ==========>part3:
- 【lb】
- 创建共享目录 mkdir /nfs
- 修改配置文件
- [root@iZ25j36rr97Z nfs]# cat /etc/exports
- /nfs *(rw,sync,fsid=0)
- 修改权限
- chmod -R o+w /nfs
- 先为rpcbind和nfs做开机启动:
- systemctl enable nfs-server.service
- systemctl enable rpcbind.service
- systemctl start rpcbind.service
- systemctl start nfs-server.service
- 确认启动成功
- [root@iZ25j36rr97Z nfs]# rpcinfo
- program version netid address service owner
- 100000 4 tcp 0.0.0.0.0.111 portmapper superuser
- 100000 3 tcp 0.0.0.0.0.111 portmapper superuser
- 100000 2 tcp 0.0.0.0.0.111 portmapper superuser
- 100000 4 udp 0.0.0.0.0.111 portmapper superuser
- 100000 3 udp 0.0.0.0.0.111 portmapper superuser
- 100000 2 udp 0.0.0.0.0.111 portmapper superuser
- 100000 4 local /var/run/rpcbind.sock portmapper superuser
- 100000 3 local /var/run/rpcbind.sock portmapper superuser
- 100011 1 udp 0.0.0.0.3.107 rquotad superuser
- 100011 2 udp 0.0.0.0.3.107 rquotad superuser
- 100011 1 tcp 0.0.0.0.3.107 rquotad superuser
- 100011 2 tcp 0.0.0.0.3.107 rquotad superuser
- 100005 1 udp 0.0.0.0.169.8 mountd superuser
- 100005 1 tcp 0.0.0.0.202.245 mountd superuser
- 100005 2 udp 0.0.0.0.200.5 mountd superuser
- 100005 2 tcp 0.0.0.0.190.185 mountd superuser
- 100005 3 udp 0.0.0.0.236.40 mountd superuser
- 100005 3 tcp 0.0.0.0.152.224 mountd superuser
- 100003 2 tcp 0.0.0.0.8.1 nfs superuser
- 100003 3 tcp 0.0.0.0.8.1 nfs superuser
- 100003 4 tcp 0.0.0.0.8.1 nfs superuser
- 100227 2 tcp 0.0.0.0.8.1 nfs_acl superuser
- 100227 3 tcp 0.0.0.0.8.1 nfs_acl superuser
- 100003 2 udp 0.0.0.0.8.1 nfs superuser
- 100003 3 udp 0.0.0.0.8.1 nfs superuser
- 100003 4 udp 0.0.0.0.8.1 nfs superuser
- 100227 2 udp 0.0.0.0.8.1 nfs_acl superuser
- 100227 3 udp 0.0.0.0.8.1 nfs_acl superuser
- 100021 1 udp 0.0.0.0.134.187 nlockmgr superuser
- 100021 3 udp 0.0.0.0.134.187 nlockmgr superuser
- 100021 4 udp 0.0.0.0.134.187 nlockmgr superuser
- 100021 1 tcp 0.0.0.0.218.123 nlockmgr superuser
- 100021 3 tcp 0.0.0.0.218.123 nlockmgr superuser
- 100021 4 tcp 0.0.0.0.218.123 nlockmgr superuser
- 100024 1 udp 0.0.0.0.131.201 status 29
- 100024 1 tcp 0.0.0.0.206.148 status 29
- [root@iZ25j36rr97Z nfs]# exportfs
- /nfs <world>
- 默认查看自己共享的服务
- [root@iZ25j36rr97Z nfs]# showmount -e
- Export list for iZ25j36rr97Z:
- /nfs *
- [root@iZ25j36rr97Z nfs]#
- 修改【lb】 nginx配置
- [root@iZ25j36rr97Z conf]# cat nginx.conf
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- upstream nginxlb
- {
- server 101.200.206.67:8081;
- server 101.200.169.119:8081;
- server 101.200.169.119:8082;
- }
- include mime.types;
- default_type application/octet-stream;
- sendfile on;
- keepalive_timeout 65;
- server {
- listen 80;
- server_name 101.200.206.67;
- location / {
- proxy_pass http://nginxlb;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
- server {
- listen 8081;
- server_name 101.200.206.67;
- location / {
- root html;
- index nginx.txt index.html index.htm;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
- }
- 在根目录添加 nginx.txt
- echo 'nginx' >nginx.txt
- mount -t nfs 101.200.206.67:/nfs /home/service/nginx/html
- 客户端执行
- yum install rpcbind nfs-utils -y
- mount -t nfs 101.200.206.67:/nfs /home/service/nginx/html
- 修改nginx配置
- [root@iZ2ze0sw83m5wno8bd2yudZ conf]# cat nginx.conf
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- sendfile on;
- keepalive_timeout 65;
- server {
- listen 8081;
- server_name localhost;
- location / {
- root html;
- index 8081.txt index.html index.htm;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
- }
- [root@iZ2ze0sw83m5wno8bd2yudZ conf]# cat nginx1.conf
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- sendfile on;
- keepalive_timeout 65;
- server {
- listen 8082;
- server_name localhost;
- location / {
- root html;
- index 8082.txt index.html index.htm;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
- }
- echo '8081' >8081.txt
- echo '8082' >8082.txt
- 启动服务端和客户端nginx
- /home/service/nginx/sbin/nginx -c /home/service/nginx/conf/nginx.conf
- /home/service/nginx/sbin/nginx -c /home/service/nginx/conf/nginx1.conf
- 在浏览器端查看轮询结果
- 3台web 依次被lb调度
nfs cron shell 作业的更多相关文章
- nfs cron shell 笔记
1.nfs 2.crond 3.shell 1.准备环境: 防火墙 selinux 配置ip 2.安装软件 二进制 源码安装 3.改改配置文件 二进制:/etc/nginx/nginx.conf 源码 ...
- shell作业后台执行的方法
来思考几种场景: 1.某个脚本需要执行时间比较长,无人值守,可能执行过程中因ssh会话超时而中断? 2.某次测试一段代码,需要临时放入后台运行? 3.放入后台运行的脚本,需要在一段时间后重新调到前台? ...
- shell作业01
1.判断/etc/inittab文件是否大于100行,如果大于,则显示”/etc/inittab is a big file.”否者显示”/etc/inittab is a small file.” ...
- xv6的作业翻译——作业1 - shell和系统调用
Xv6的lecture LEC 1 Operating systems L1: O/S overview L1:O/S概述 * 6.828 goals 6.828的目标 Understan ...
- cron,linux定时脚本
Linux的cron和crontab Cron定时执行工具详解 Linux下的crontab定时执行任务命令详解 Linux上启动Cron任务 [linux]解析crontab cron表达式详解 c ...
- Shell记录-Shell命令(定时任务)
在Linux系统中, at 命令是针对仅运行一次的任务,循环运行的例行性计划任务,linux系统则是由 cron(crond) 这个系统服务来控制的.Linux 系统上面原本就有非常多的计划性工作,因 ...
- Ansible部署rsync、nfs及sersync
rsync nfs sersync httpd环境: 角色 外网IP(NAT) 内网IP(LAN) 主机名 Rsync服务端 eth0:10.0.1.51 eth1:172.16.1.51 backu ...
- NFS网络文件共享服务
NFS-网络文件系统,它的主要功能是通过网络让不同的主机系统之间可以彼此共享文件或目录. NFS在企业中得应用场景 在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频.图片.附件等静 ...
- 【NFS】nfs安装调优
nfs [root@flymaster ~]# rpm -qa nfs-utils rpcbindnfs-utils-1.2.3-75.el6.x86_64rpcbind-0.2.0-13.el6_9 ...
随机推荐
- 【转】服务器.htaccess 详解以及 .htaccess 参数说明
htaccess文件(或者”分布式配置文件”)提供了针对目录改变配置的方法, 即,在一个特定的文档目录中放置一个包含一个或多个指令的文件, 以作用于此目录及其所有子目录.作为用户,所能使用的命令受到限 ...
- mac 下面配置gradle
最近刚开始用gradle,先向大家介绍一下怎么配置gradle的环境变量吧: 1.下载最新安装包gradle-xxx-all.zip:http://www.gradle.org,并解压到/Users/ ...
- Flume-NG源码阅读之HBaseSink
关于HBase的sink的所有内容均在org.apache.flume.sink.hbase包下. 每个sink包括自己定制的,都extends AbstractSink implements Con ...
- Python OS导入一个文件夹所有文件
import os path = 'F:/save_file/seminarseries/' for root, dirs, files in os.walk(path): print(root) 这 ...
- DH02-策略模式
模式简介 面向对象的编程,并不是类越多越好,类的划分是为了封装,但分类的基础是抽象,具有相同属性和功能的对象的抽象集合才是类. 策略模式(Strategy)定义了算法家族,分别封装起来,让他们相互间可 ...
- MSDN 单机 MVC 帮助文档
因为微软的mvc框架也是从开源框架演变而来的,所以微软没把mvc帮助文档放到单击帮助文档中.sososos下载好msdn单机帮助后,却找不到 System.Web.MVC 等命名空间的东西. 解决办法 ...
- WP追加字符串到文件
#if DEBUG const string logfile = "demo.log"; try { using (var sw = new System.IO.StreamWri ...
- 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] 来源:淘宝数据平台团队 作者: [字体:大 中 小] ...
- 开发一个app需要多少钱
App应用开发是目前最热门的产业,很多企业都想通过app的开发来进入移动互联网市场分一杯羹. 那么你一定很想知道开发一个app需要多少钱吧?那下面企业帮就来帮大家计算一下费用吧. 面对app抄袭成风的 ...
- CodeForces-831A-Unimodal Array (水题)
题目链接 /* Name: Copyright: Author: Date: 2018/5/6 19:34:23 Description: */ #include <iostream> # ...