(?)企业部分之corosync未完缺图

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(?)企业部分之corosync未完缺图相关的知识,希望对你有一定的参考价值。

需要一个纯净的虚拟机,需要重新编译内核;为了提高编译速度,4CPU2048内存。


内核源码   linux-2.6.32-220.23.1.el6.x86_64

使用dvd.repoyum

所需软件包:kernel-2.6.32-220.23.1.el6.src.rpm  Lvs-fullnat-synproxy.tar.gz

解决依赖性:asciidoc-8.4.5-4.1.el6.noarch.rpm newt-devel-0.52.11-3.el6.x86_64.rpm slang-devel-2.2.1-1.el6.x86_64.rpm

 

rpm -ivh kernel-2.6.32-220.23.1.el6.src.rpm 
yum install -y rpm-build

uname -r
cd rpmbuild/SPECS/

yum install -y gcc redhat-rpm-config patchutils xmlto asciidoc elfutils-libelf-devel zlib-devel binutils-devel newt-devel python-devel perl-ExtUtils-Embed hmaccalc

cd
yum install asciidoc-8.4.5-4.1.el6.noarch.rpm newt-devel-0.52.11-3.el6.x86_64.rpm slang-devel-2.2.1-1.el6.x86_64.rpm -y

rpmbuild -bp kerbel.spec    ##较长时间,可通过rngd -r /dev/urando解决(安装 rngd-tools)


cd /root/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/
tar zxf Lvs-fullnat-synproxy.tar.gz

cd lvs-fullnat-synproxy/
cp lvs-2.6.32-220.23.1.el6.patch ../linux-2.6.32-220.23.1.el6.x86_64/

cd ..
cd linux-2.6.32-220.23.1.el6.x86_64/
yum install -y patch
patch -p1 < lvs-2.6.32-220.23.1.el6.patch 

vim .config
vim Makefile

uname -r

cd configs/
diff kernel-2.6.32-x86_64.config ../.config


 

增加一个20G的虚拟硬盘

fdisk -cu /dev/vdc
pvcreate /dev/vdc1
vgextend VolGroup /dev/vdc1
lvextend -L +20G /dev/VolGroup/lv_root 
lvextend -l +5119 /dev/VolGroup/lv_root 
resize2fs  /dev/VolGroup/lv_root
df -h


cd /root/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64

make -j4
make modules_install
make install

cd /boot/grub/
vim grub.conf
reboot
uname -r    ##2.6.32-220.23.1.el6


cd rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/lvs-fullnat-synproxy/
cp lvs-tools.tar.gz  /root

tar zxf lvs-tools.tar.gz
cd tools/keepalived/

yum install openssl-devel popt-devel -y
./configure --with-kernel-dir="/lib/modules/`uname -r`/build"
make
make install

which keepalived

cd ..
cd ipvsadm/
yum install -y ipvsadm

make
make install

ipvsadm --help
ipvsadm -l


所需软件包:crmsh-1.2.6-0.rc2.2.1.x86_64.rpm pssh-2.3.1-2.1.x86_64.rpm

 

 

使用有集群环境的虚拟机

先确定有没有其它软件在运行

server1

ps ax    ##将cman等服务关掉
/etc/init.d/ldirectord stop
chkconfig ldirectord off
yum install -y pacemaker    ##server1/server2
rpm -q corosync
/etc/init.d/keepalived status
/etc/init.d/heartbeat status
/etc/init.d/cman status    ##没关掉的关掉
cd /etc/corosync/
cp corosync.conf.example corosync.conf
vim corosync.conf

/etc/init.d/corosync status
/etc/init.d/pacemaker status

scp corosync.conf [email protected]:/etc/corosync
/etc/init.d/corosync start
tail -f /var/log/messages
crm_verify -L
crm_verify -LV
cd
yum install crmsh-1.2.6-0.rc2.2.1.x86_64.rpm pssh-2.3.1-2.1.x86_64.rpm -y
crm

status

show

property stonith-enabled=false

show

commit

quit

crm configure show
crm

configure

primitive vip ocf:heartbeat:IPaddr2 params ip=172.25.19.100 cidr_netmask=32 op monitor interval=30s

show

commit

bye

 /etc/init.d/corosync start
crm

property no-quorum-policy=ignore

commit

quit

 

/etc/init.d/corosync stop
 
/etc/init.d/corosync start
vim /etc/httpd/conf/httpd.conf
rpm -q httpd
 
crm

primitive website ocf:heartbeat:apache params configfile=/etc/httpd/conf/httpd.conf op monitor interval=60s

commit

collocation website-with-ip inf: website vip

commit

show

delete website-with-ip

commit

group apache vip website

commit

show

cd

node

show

standby server2.example.com

online server2.example.com

quit

 

cat /proc/drbd
drbdadm primary sqldata
 
mount /dev/drbd1 /var/lib/mysql/
df -h
umount /var/lib/mysql/
 
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
 
crm

resource

show

stop apache

bye

 

/etc/init.d/corosync start
 
crm

configure

show

delete apache

delete website

show

commit

Ctrl-C, leaving

 

cd /etc/cluster/
ls
stonith_admin  -I
stonith_admin  -M -a fence_xvm
 
crm

configure

property stonith-enabled=true

commit

primitive vmfence stonith:fence_xvm params pcmk_host_map="server1.example.com:vm1;server2.example.com:vm2" op monitor interval=1min

commit

bye

 

ip addr show
ip addr del 172.25.19.100/32 dev eth0
/etc/init.d/network stop
 
 
/etc/init.d/corosync start
 
  【server2】
/etc/init.d/ldirectord stop
chkconfig ldirectord off
yum install -y pacemaker
/etc/init.d/corosync start
cd
ls
 yum install -y *
crm
crm_mon 
rpm -q httpd
vim /etc/httpd/conf/httpd.conf
crm_mon

【物理机】

systemctl  status fence_virtd
systemctl  start fence_virtd
systemctl  status fence_virtd
netstat -anulp | grep 1229 
 
 未完。图练习时补上

以上是关于(?)企业部分之corosync未完缺图的主要内容,如果未能解决你的问题,请参考以下文章

(?)企业部分之ganglia(未完)

(?)企业部分之nagios(未完)

(?)企业部分之HA集群未完

企业部分之PHP(未完)

Linux的企业-高可用集群Haproxy+corosync+pacemaker+fence

Linux的企业-Mfs高可用corosync+pacemaker+fence+iscci