设为首页收藏本站

LinuxTone | 运维专家网论坛 - 最棒的Linux运维与开源架构技术交流社区!

 找回密码
 注册

QQ登录

只需一步,快速开始

#公告#抱歉,网站将关闭,不再开放。由于PC时代已远逝 。在这个后移动互联网时代,我们继续携手前行,保持对技术的热情。共同构建linuxtone知识星球欢迎加入,一起讨论技术、招聘人才、分享资源。请新老linuxtone人 扫码移步到 知识星球:linuxtone

学习是一种信仰!分享是一种快乐!能力= 心态 * 沟通 * 知识 (你的每一天需要正能量!)

 网站的发展需要你贡献一份力量!希望你能每天坚持看贴1小时,并回答网友的问题!祝你在浏览论坛的过程中取得进步!谢谢!linuxtone加油!大家加油! 友情提示: 你今天学习了吗?你今天进步了吗?少一点抱怨!多一点进步!Life is short ! Why not linuxtone ?  

网站的发展、感谢每位坛友的努力!

查看: 3613|回复: 0

[高可用性] pacemaker+httpd+nfs+mysql [复制链接]

Rank: 7Rank: 7Rank: 7

签到
988
注册时间
2008-11-26
最后登录
2017-9-11
在线时间
627 小时
阅读权限
100
积分
93417
帖子
450
主题
18
精华
1
UID
618
发表于 2012-7-3 14:30:07 |显示全部楼层
服务器
A:192.168.14.11---WEB1
B:192.168.14.12---WEB2
C:192.168.14.13---NFS

C:
yum install portmap
/etc/init.d/portmap start
/etc/init.d/nfs start
service portmap status
service nfs status
chkconfig nfs on
chkconfig portmap on


mkdir /data
mkdir /data/web
mkdir /data/mysql
vi /etc/exports
/data *(rw,sync,no_root_squash)

exportfs -rv
showmount -e 127.0.0.1

A&B:
AMP:
yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-adodb php-xml php-mbstring php-ldap php-pear php-xmlrpc libtool-ltdl libtool-ltdl-devel mysql-connector-odbc mysql-devel libdbi-dbd-mysql

chkconfig httpd off
chkconfig mysqld off

A:
mkdir /data
mount -t nfs 192.168.14.13:/data /data

vi /etc/my.cnf
datadir=/data/mysql
socket=/data/mysql/mysql.sock
最后添加
[client]
socket=/data/mysql/mysql.sock


vi /etc/init.d/mysqld
get_mysql_option mysqld datadir "/data/mysql" //数据库路径


vi /etc/httpd/conf/httpd.conf
修改:
DocumentRoot "/data/web"

/etc/init.d/mysqld start
/etc/init.d/httpd start


scp /etc/my.cnf root@192.168.14.12:/etc/my.cnf
scp /etc/init.d/mysqld root@192.168.14.12:/etc/init.d/mysqld
scp /etc/httpd/conf/httpd.conf root@192.168.14.12:/etc/httpd/conf/httpd.conf

/etc/init.d/mysqld stop
/etc/init.d/httpd stop
umount /data



B:
mkdir /data
mount -t nfs 192.168.14.13:/data /data

/etc/init.d/mysqld start
/etc/init.d/httpd start
如果正常开启,那就OK了,
/etc/init.d/mysqld stop
/etc/init.d/httpd stop
umount /data



pacemaker安装
A&B:
rpm -Uvh http://dl.fedoraproject.org/pub/ ... ease-5-4.noarch.rpm
wget http://www.clusterlabs.org/rpm/epel-5/clusterlabs.repo -O /etc/yum.repos.d/pacemaker.repo
yum install -y pacemaker corosync

vi /etc/hosts
192.168.14.11   akin.com        akin   
192.168.14.12   akin2.com       akin2


A:
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub root@akin2

B:
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub root@akin

A:
cd /etc/corosync/
cp corosync.conf.example corosync.conf
sed -i "s#192.168.1.1#192.168.14.0#g" corosync.conf

vi corosync.conf
...
service        {
        ver: 0
        name: pacemaker
}
aisexec        {
        user: root
        group: root
}

mkdir -p /var/log/cluster
corosync-keygen

scp corosync.conf authkey akin2:/etc/corosync/
ssh akin2 -- mkdir -p /var/log/cluster

/etc/init.d/corosync start
ssh akin2 -- /etc/init.d/corosync start

crm status

//crm_verify -L
crm configure property stonith-enabled=false


crm configure property no-quorum-policy=ignore
防止资源在节点恢复后移动
crm configure rsc_defaults resource-stickiness=100

配置VIP:
crm configure primitive VIP ocf:heartbeat:IPaddr2 params ip=192.168.14.15 cidr_netmask=32 op monitor interval=30s
配置NFS
crm configure primitive NFS ocf:heartbeat:Filesystem params device=192.168.14.13:/data directory=/data fstype=nfs
配置MYSQL
crm configure primitive MYSQL lsb:mysqld
配置HTTP:
crm configure primitive HTTP lsb:httpd
新建组
crm configure group WebCluster VIP NFS MYSQL HTTP

启动顺序:
crm configure order ip_fs_mysql_web inf: VIP NFS MYSQL HTTP


您需要登录后才可以回帖 登录 | 注册

IT运维专家网感谢您的支持

合作联系: QQ:67888954/MSN:cnseek@msn.com/mail:netseek@linuxtone.org

Archiver|手机版|感谢所有关心和支持过LinuxTone的朋友们 转载本站内容请注明原作者名及出处 ( 京ICP备08103151 )   |

GMT+8, 2020-1-23 23:08 , Processed in 0.018722 second(s), 14 queries , Apc On.

Powered by Discuz! X2 Licensed

© 2001-2011 Comsenz Inc.

回顶部