系统管理 维护监控 简单生活
系统管理
DRBD (Distributed Replicated Block Device)
九 3rd
主要说明什么时DRBD
======
转:http://www.drbd.org/home/what-is-drbd/
======
1、架构
DRBD® refers to block devices designed as a building block to form high availability (HA) clusters. This is done by mirroring a whole block device via an assigned network. DRBD can be understood as network based raid-1.
In the illustration above, the two orange boxes represent two servers that form an HA cluster. The boxes contain the usual components of a Linux™ kernel: file system, buffer cache, disk scheduler, disk drivers, TCP/IP stack and network interface card (NIC) driver. The black arrows illustrate the flow of data between these components.
The orange arrows show the flow of data, as DRBD mirrors the data of a high availably service from the active node of the HA cluster to the standby node of the HA cluster.
=========
转:http://www.turbolinux.com.cn/turbo/wiki/doku.php?id=%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86:drbd%E7%9A%84%E4%BD%BF%E7%94%A8
=========
DRBD是一种块设备,可以被用于高可用(HA)之中.它类似于一个网络RAID-1功能.当你将数据写入本地
文件系统时,数据还将会被发送到网络中另一台主机上.以相同的形式记录在一个文件系统中.
本地(主节点)与远程主机(备节点)的数据可以保证实时同步.当本地系统出现故障时,远程主机上还会
保留有一份相同的数据,可以继续使用.
在高可用(HA)中使用DRBD功能,可以代替使用一个共享盘阵.因为数据同时存在于本地主机和远程主机上,
切换时,远程主机只要使用它上面的那份备份数据,就可以继续进行服务了.
centos5 install gfs
八 31st
环境说明:
centos5.2+iscsi+gfs
1、安装centos5.2:
最小化安装系统三台
2、初始化三台系统:
1、关闭不必要的服务
turnseroff( )
{
for ser in `chkconfig --list |grep 3:on |awk '{print $1}'`
do
echo $ser
case $ser in
crond | irqbalance | microcode_ctl | network | random | sendmail \
| sshd | syslog | messagebus | haldaemon | readahead_early \
| apmd | readahead_later | readahead | iptables | lvm2-monitor | xinetd | auditd | cpuspeed )
echo "Base services, Skip"
;;
*)
echo "change $ser to off"
chkconfig --level 3 $ser off
service $ser stop
;;
esac
done
}
turnseroff
2、修改yum 源
#change the yum source
\cp -f /etc/yum.repos.d/CentOS-Base.repo ~/
cat </etc/yum.repos.d/CentOS-Base.repo
[lan]
name=LAN
baseurl=ftp://10.20.2.11/centos52
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5EOF
3、添加vi 语法高亮
aliasvi ()
{
sed -i "8 s/^/alias vi='vim'/" /root/.bashrcsource /root/.bashrc
}
aliasvi
4、关闭防火墙
service iptables stop
chkconfig iptables off
3、安装需要的软件包
yum install -y cman gfs-utils kmod-gfs kmod-dlm cluster-snmp iscsi-initiator-utils lvm2-cluster rgmanager
如查有报错,直接导入KEY 参考:
4、在每个节点上持载iscsi共享存储
有关iscis 相关请参考:
service iscsi restart
iscsiadm --mode discovery --type sendtargets --portal 10.20.15.249
service iscsi restart
fdisk -l 会多一个20.3GB 的sdb
5、在其中一个节点上上创建一个名为gfscg的 LVM 卷组
pvcreate -ff /dev/sdb
vgcreate gfsvg /dev/sdb
列出VG大小:
vgdisplay gfsvg |grep "Total PE "
Total PE 4847
创建lv
lvcreate -l 4847 -n gfs gfsvg
5、在其中一个节点上上创建一个GFS卷
1、确认cluster name
cman_tool status |grep "Cluster Name"
Cluster Name: gfs_cluster
2、创建GFS 文件系统
gfs_mkfs -j 5 -p lock_dlm -t gfs_cluster:gfs /dev/gfsvg/gfs
相关参数请参考:
6、配置节点做集群
1、分别在三台机器上添加主机名到ip的映设
echo "10.20.15.151 clustera" >>/etc/hosts
echo "10.20.15.152 clusterb" >>/etc/hosts
echo "10.20.15.153 clusterc" >>/etc/hosts
2、创建集群配置文件,并分别复制到每个节点上
cat <<EOF >/etc/cluster/cluster.conf
<?xml version="1.0"?>
<cluster alias="gfs_cluster" config_version="2" name="gfs_cluster">
<fence_daemon post_fail_delay="0" post_join_delay="3"/>
<clusternodes>
<clusternode name="clustera" nodeid="1" votes="1">
<fence>
<method name="1"/>
</fence>
</clusternode>
<clusternode name="clusterb" nodeid="2" votes="1">
<fence>
<method name="1"/>
</fence>
</clusternode>
<clusternode name="clusterc" nodeid="3" votes="1">
<fence/>
</clusternode>
</clusternodes>
<cman/>
<fencedevices>
<fencedevice agent="fence_manual" name="manual"/>
</fencedevices>
<rm>
<failoverdomains>
<failoverdomain name="failover" ordered="0" restricted="0"/>
</failoverdomains>
<resources>
<clusterfs device="/dev/gfsvg/gfs" force_unmount="0" fsid="32101" fstype="gfs" mountpoint="/opt/pgfsql" name="gfsmount" options="-t gfs"/>
</resources>
</rm>
</cluster>
EOF
7、在每一个节点上启动相关服务
以下命令在每个节点上执行
for ser in iscis gfs gfs2 cman clvmd
do
chkconfig $ser on
done
for ser in gfs gfs2 cman clvmd
do
service $ser restat
done
8、确认集群各节点的状态
1、clustat 如下图:
[root@pgsqla scripts]# clustat
Cluster Status for gfs_cluster @ Wed Sep 2 23:13:20 2009
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
clustera 1 Online, Local
clusterb 2 Online
clusterc 3 Online
[root@pgsqla scripts]#
Online 说明节点正常,反之为offlice ,可以通过cat /var/log/messages 得到相关信息
9、命令行集群管理工具
1、cman_tool
Usage:
cman_tool <join|leave|kill|expected|votes|version|wait|status|nodes|services|debug> [options]
2、ccs_tool
Usage::
ccs_tool [options] <command>
Options:
-h Print this usage and exit.
-V Print version information and exit.
Commands:
help Print this usage and exit.
update <xml file> Tells ccsd to upgrade to new config file.
upgrade <location> Upgrade old CCS format to new xml format.
addnode <node> Add a node
delnode <node> Delete a node
lsnode List nodes
lsfence List fence devices
addfence <fencedev> Add a new fence device
delfence <fencedev> Delete a fence device
create Create a skeleton config file
addnodeids Assign node ID numbers to all nodes
最新评论