首页 > 其他分享 >基于NFS存储建立WEB群(PCS工具)

基于NFS存储建立WEB群(PCS工具)

时间:2023-01-10 13:31:09浏览次数:59  
标签:WEB httpd PCS sto NFS nfs root rs1 03


实现NFS共享存储的WEB群集,前提是建立好web群集
这是我另一篇建立web群集的博客:

基于NFS服务器的WEB群集原理

基于NFS存储建立WEB群(PCS工具)_apache

可以根据这个图片来理解这个原理,我在web1上有照片,但是我web2没有,我可以在两台web后加一个nfs存储服务器,NFS是一个共享目录或文件的服务。web1收到的数据,在发给nfs,nfs在给web2

1、安装NFS服务器

[root@sto yum.repos.d]# yum install -y nfs-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package matching 1:nfs-utils-1.3.0-0.21.el7.x86_64 already installed. Checking for update.
Nothing to do
[root@sto yum.repos.d]# systemctl restart rpcbind
[root@sto yum.repos.d]# systemctl enable rpcbind
[root@sto yum.repos.d]# systemctl enable nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@sto yum.repos.d]# systemctl start nfs-server
[root@sto yum.repos.d]# systemctl status firewalld
[root@sto http]# systemctl stop firewalld

防火墙开启的情况要增加nfs,rpc-bind,mounted服务,然后reload生效

2、准备NFS服务器资源

创建Export目录(共享目录)
[root@sto yum.repos.d]# mkdir /http
[root@sto yum.repos.d]# chmod a+x /http
[root@sto yum.repos.d]# vi /etc/exports
/http * (rw)
[root@sto yum.repos.d]# systemctl restart nfs-server

在其他节点进行测试
[root@rs1 ~]# showmount -e sto
Export list for sto:
/http *
[root@rs1 ~]# mkdir /mnt/nfs
[root@rs1 ~]# mount sto:/http /mnt/nfs
[root@rs1 ~]# cp ./anaconda-ks.cfg /mnt/nfs/test.txt

[root@rs2 ~]# showmount -e sto
Export list for sto:
/http *
[root@rs2 ~]# mkdir /mnt/nfs
[root@rs2 ~]# mount sto:/http /mnt/nfs
[root@rs2 ~]# cp ./anaconda-ks.cfg /mnt/nfs/test2.txt

[root@sto http]# ls
test2.txt test.txt

创建NFS集群

[root@rs1 ~]# pcs resource create WebFS ocf:heartbeat:Filesystem \
> device='sto:/http' directory='/var/www/html' fstype='nfs' \
> op monitor interval=20s timeout=40s \
> op start timeout=60s op stop timeout=60s

[root@rs1 ~]# pcs resource create WebFS ocf:heartbeat:Filesystem device='storage:/http' directory='/var/www/html' fstype='nfs' op monitor interval=20s timeout=40s > op start timeout=60s op stop timeout=60s
[root@rs1 ~]# pcs status
Cluster name: cluster1
Stack: corosync
Current DC: rs1 (version 1.1.20-5.el7-3c4c782f70) - partition with quorum
Last updated: Sat May 9 02:59:31 2020
Last change: Sat May 9 02:59:22 2020 by root via cibadmin on rs1

2 nodes configured
3 resources configured

Online: [ rs1 rs2 ]

Full list of resources:

VirtualIP (ocf::heartbeat:IPaddr2): Started rs1
WebFS (ocf::heartbeat:Filesystem): Started rs2

Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled


[root@rs1 ~]# echo NFS > /var/www/html
[root@rs1 ~]# systemctl restart httpd

创建web集群

pcs resource create Wbsite ocf

标签:WEB,httpd,PCS,sto,NFS,nfs,root,rs1,03
From: https://blog.51cto.com/u_14519396/6000222

相关文章

  • 从webview跳转到小程序报错,'wx' is not defined
    项目有一个需求是从h5中跳转回小程序里,在小程序内报了这个错误'wx'isnotdefined尝试了下面两种方法都没有用npminstallweixin-js-sdk,使用这个包没有效果<scr......
  • [项目源码] JavaWeb校园宿舍管理系统
     jsp校园宿舍管理系统源码,采用Servlet+JSP+MySQL。包含数据库文件,界面采用bootstrap,简洁大方。      项目导入eclipse后的目录结构如下: 关注下面公众号,下载源码原......
  • vue cli -webpack 引入字体文件.ttf不生效(开发环境)
    本示例是引入的‘站酷庆科黄油体’下载字体文件后一定要在windows中打开.ttf文件看一下字体名称是什么保证assets下xxfont.css文件里的font-family与下载字体文件里看到......
  • 一文彻底学会使用web worker
    一文彻底学会使用webworker:https://juejin.cn/post/7139718200177983524 前言先来聊聊单线程的Javascript众所周知,js最初设计是运行在浏览器中的,为了防止多个线程......
  • web基础概念
    01.万维网www其实是WorldWideWeb 的缩写,它是一个由许多互相链接的超文本组成的系统,通过互联网访问。在汉语中,www被翻译成“万维网”。www由两部分构成:www客户......
  • 入门2年的ctf新手自述--web方向
    为什么想写这篇博客,为什么要要跟大家分享?因为我的确入门费了非常多的时间,有很多坎。首先是自己的精力因为很多事情,确实分散了很多,有创新创业项目、学生工作、学业等等,没有......
  • 孙宇晨出席香港Web3峰会:火必重回三大的脚步将随行业复苏而加快
    1月9日,POW'ER2023香港Web3创新者峰会在香港数码港举行,波场TRON创始人、火必全球顾问委员会成员孙宇晨受邀与MarsBit联合创始人商思林对话,就香港加密行业发展前景、交易所......
  • python 使用waitress替代flask自带的web服务器
    首席引入依赖安装waitrsspipintsllwaitress 然后在flask程序内引入依赖使用server()函数代替app.run()函数启动时,直接pythonxxx.py即可fromwaitressimportserve......
  • WebGoat-8.2.2靶场之不安全的反序列化漏洞
    前言序列化是将变量或对象转换成字符串的过程反序列化就是把一个对象变成可以传输的字符串,目的就是为了方便传输而反序列化漏洞就是,假设,我们写了一个class,这个class里面......
  • webview2报错CoreWebView2 members cannot be accessed after the WebView2 control i
    System.Runtime.InteropServices.COMException(0x8007139F):组或资源的状态不是执行请求操作的正确状态。(异常来自HRESULT:0x8007139F)在Microsoft.Web.WebView2.C......