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 ...
随机推荐
- ggplot笔记001——ggplot2安装
R3.2.2版安装ggplot2 今天安装ggplot2,开始用的是R3.2.1版本,但是一直报错.后面换了一个最新的R3.2.2,但安装时还是一样报错,原因是munsell这个包 ...
- Linux系统用户/用户组/文件权限相关
目录一.Linux系统用户/用户组权限相关二.Linux系统文件权限相关 一.Linux系统用户/用户组权限相关 .命令:usermod 用法:usermod [-agGus] user args ‘ ...
- java:system根据输入的内容,然后输出(字节流)
把输入的内容输出来:根据system.in的内容System.out.println输出出来 都是字节流,的形式: //限制读取的字符长度 //字节流 InputStream ips = System ...
- Nodejs + TypeScript
Node.js https://nodejs.org https://nodejs.org/en/download/ win: msi mac: pkg linux: tar.xz source co ...
- 终端命令对字符串进行sha1、md5、base64、urlencode/urldecode
sha1.md5.base64 mac $ echo -n foo|shasum 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 - $ 2c26b46b68ffc6 ...
- Android项目的目录结构 初学者记录
Android项目的目录结构 Activity:应用被打开时显示的界面 src:项目代码 R.java:项目中所有资源文件的资源id Android.jar:Android的jar包,导入此包方可使用 ...
- 伯乐在线资讯URL
伯乐资讯URL # encoding: utf-8 import requests from bs4 import BeautifulSoup import csv import time base_ ...
- php操作EXCLE(通过phpExcle实现读excel数据)
<?phprequire_once('/PHPExcel/Reader/Excel2007.php');$objReader = new PHPExcel_Reader_Excel2007;$P ...
- UOJ#454. 【UER #8】打雪仗
UOJ#454. [UER #8]打雪仗 http://uoj.ac/problem/454 分析: 好玩的通信题~ 把序列分成三块,\(bob\)先发出这三块中询问点最多的一块给\(alice\). ...
- hadoop-pig学习笔记
A1 = LOAD '/luo/lzttxt01.txt' AS (col1:chararray,col2:int,col3:int,col4:int,col5:double,col6:double) ...