death114 发表于 2018-11-19 07:54:19

heartbeat+nfs+apache(web)

  NFS配置:yum install nfs-utils portmap nfs4-acl-tools
  mkdir /data/www
  chown apache:apache /data/www
  编辑配置文件:vim /etc/exports
  /data/www *(rw,sync)

  保存退出
  vim /data/www/index.html

  192.168.26.211/212两台服务器都需要安装:yuminstall -yheartbeat(略)
  编译安装需要复制配置文件路径:cp /usr/share/doc/heartbeat-3.0.4/{ha.cf,authkeys,haresources}/etc/ha.d/
  修改配置文件:
   vim /etc/ha.d/authkeys #认证文件
  配置核心文件:vim /etc/ha.d/ha.cf

  主要设置下列参数:
  
  debugfile /var/log/ha-debug
  logfile /var/log/ha-log
  logfacility   local0
  keepalive 1000ms
  deadtime 6
  warntime 2
  initdead 20
  udpport 694
  bcast   eth0   # Linux
  auto_failback on
  node node2.jerry.com
  node node3.jerry.com
  crm on
  ping 192.168.26.199
  compression   bz2

  compression_threshold 2

  编辑配置文件:vim /etc/ha.d/resources
  主要设置下列项:
  node2.jerry.com 192.168.27.210 Filesystem::192.168.25.209:/data/www::/var/www/html::nfs httpd #指定主接点和VIP以及资源代理


  把配置文件复制到节点3:
  scp authkeys ha.cf haresources node3:/etc/ha.d/
  

  启动两个结点heartbeat:
  


  测试访问vip:192.168.27.210
  


  


  停掉主节点node2观察
  


  VIP 转移了

  NFS也转移了
  


  仍然可以正常访问:
  


  


  恢复主节点node2观察:/etc/init.d/heartbeat start
  vip转移回原节点

  vip与NFS挂载都转移了


  

  

  




页: [1]
查看完整版本: heartbeat+nfs+apache(web)