8
8
8
DRBD 的安装和配置。
目前流行的Linux中只有Centos有预编译好的安装包和对应内核。
如果不想用Centos可以选择从源码安装。DRBD有两种安装模式:直接编译进内核,作为一个可加载的内核模块编译。 无论哪种方式都是有些痛苦的 – 解决各种依赖,准备内核源码树。我是根据官方文档http://www.drbd.org/users-guide/s-build-from-source.html 一步一安装的。依赖的软件或库make, gcc, the glibc development libraries, 和 flex。GCC必须和你编译内核使用的是同一版本。
本文使用的是Centos
1. 准备分区
在两台机器上划分等大的分区供DRBD使用。不要格式化也不要mount.我使用的是/dev/hda2
2. 安装
只要一行命令;
Yum install DRBD
3. 配置IP地址和主机名。
我的/etc/hosts 文件内容如下
127.0.0.1 localhost.localdomain localhost
192.168.0.113 jack.etop.biz jack
192.168.0.114 rose.etop.biz rose
4. 配置
[teddy@jack]$ vim /etc/drbd.conf
drbd.conf内容如下:
global {
usage-count yes;
}
common {
syncer { rate 40M;}
protocol C;
}
resource r0 {
on jack {
device /dev/drbd1;
disk /dev/hda2;
address 192.168.0.114:7789;
meta-disk internal;
}
on rose {
device /dev/drbd1;
disk /dev/hda2;
address 192.168.0.113:7789;
meta-disk internal;
}
}
每部分的详细含义见官方文档http://www.drbd.org/users-guide/ch-configure.html
然后把上面配置文件拷贝到节点rose的相同目录下 。
scp /etc/drbd.conf teddy@rose:/etc/
5. 激活前面配置的drbd资源“r0”(两个节点都要执行)
drbdadm create-md r0
drbdadm attach r0
drbdadm connect r0
6. 初始化(这步只要在主节点上操作)
drbdadm —overwrite-data-of-peer primary r0
/etc/init.d/drbd start
然后等待同步完成
然后用下面的命令查看DRBD的运行状态
cat /proc/drbd
建立文件系统
mkfs.ext3 /dev/drbd1
加载分区
mkdir /data (两个节点都执行)
mount -o rw /dev/drbd0 /data (只要在主节点上操作)
基本配置到这里就完成了。
7. 测试
写点数据到hda1上
[teddy@jack]$echo “I’m a genie in a bottle baby.” >> /data/test_file
接下来你需要将DRBD的主从机互换一下.
可以执行下面的操作:
在主机上,先要卸载掉DRBD设备.
[teddy@jack]$ umount /data
将主机降级为”备机”.
[teddy@jack]$ drbdadm secondary r0
[teddy@jack]$ cat /proc/drbd
现在,两台主机都是”备机”.
在备机rose上,将它升级为”主机”.
[teddy@rose]$ drbdadm primary r0
[teddy@rose]$ cat /proc/drbd
现在,“rose”成为了”主机”. 察看下/data/下写的数据是有同步过来了。
8
一个诡异的需求, 拿来的iso都是大写文件, 需要弄成小写的
先 zip起来, 然后unzip的时候 -L就使用了小写解压, 幸好没有去写什么垃圾shell, 否则又浪费时间, 总算第一步过关, 看到自符安装界面了.
8
http://drupal.org/project/basic
各有各的好处, 但是绝对不要自己从头写起, 也不要试图修改garland…经验所得
7
Website Grader is a free seo tool that measures the marketing effectiveness of a website. It provides a score that incorporates things like website traffic, SEO, social popularity and other technical factors. It also provides some basic advice on how the website can be improved from a marketing perspective.
http://www.websitegrader.com/
7
本周花了不少时间研究HA集群,在忘记以前赶紧记录下来。 顺便鄙视一下redhatEL,不厚道, 搞了个yum但又不能用。
维持最长的系统正常运行时间对随需应变计算的成功来说越来越重要。不幸的是,很多现成即用(off-the-shelf)的高可用性(high availability,HA)解决方案 价格昂贵,而且需要专门的硬件。
本文介绍的是HA 服务的廉价替代方案--Heartbeat + DRBD + Linux实现一个双节点的高可用集群。假设该HA集群上提供的服务为apache和mysql. 当主节点出现故障时,自动的通过备份节点继续提供服务。
高可用性的概念
高可用性 是在系统、组件或者应用程序发生故障时快速恢复基本服务的系统管理策略。其目的是最大程度地减少服务中断,而不是容错。用来解决关键商务操作的系统执行故障的最常见解决方案是,使用另一个系统来等待并接管出故障的系统的负载,使商务操作继续进行下去。
HA集群构架
HA可以由两台数据同步的linux节点结成, 两个节点通过冗余的私有的物理连接进行数据同步和节点状态监视。
软件组件
- Heartbeat
名为 High-Availability Linux 的开源项目的目标是,通过社区开发努力提供一个提升 Linux 可靠性(reliability)、 可用性(availability)和可服务性(serviceability)(RAS)的群集解决方案。Linux-HA 项目得到了广泛的应用,是很多有 趣的高可用性解决方案的重要组成部分。
heartbeat 是可以从 Linux-HA 项目 Web 站点公开获得的软件包之一。它提供了所有 HA 系统所需要的基本功能,比如 启动和停止资源、监测群集中系统的可用性、在群集中的节点间转移共享 IP 地址的所有者等。它通过串行线、以太网接口 或者同时使用二者来监测特定服务(或多个服务)的健康状况。当前版本支持两节点配置,使用专门的 heartbeat“pings”来检查 服务的状态和可用性。
- DRBD
DRBD 是由LINUX内核模块和相关脚本而构成,用以构建高可用性的集群。其实现方式是通过网络来镜像整个设备。您可以把它看作是一种网络RAID. DRBD 负责接收数据,把数据写到本地磁盘,然后发送给另一个主机。另一个主机再将数据存到自己的磁盘中。
- Linux 什么 ! 不知道是什么东东? 赶快去做几个俯卧撑吧。
硬件
两台普通x86架构的PC机,双网卡,交叉网线。 如果只是为了测试评估,可以使用虚拟机模拟。
待续。。。。。
7
MYSQL High Availability 高可用解决方案对比. http://dev.mysql.com/doc/refman/5.1/en/ha-overview.html
|
Requirements |
MySQL Replication |
MySQL Replication + Heartbeat |
MySQL Heartbeat + DRBD |
MySQL Cluster |
|
Availability |
|
|
|
|
|
Automated IP failover |
No |
Yes |
Yes |
No |
|
Automated database failover |
No |
No |
Yes |
Yes |
|
Typical failover time |
User/script-dependent |
Varies |
< 30 seconds |
< 3 seconds |
|
Automatic resynchronization of data |
No |
No |
Yes |
Yes |
|
Geographic redundancy support |
Yes |
Yes |
Yes, when combined with MySQL Replication |
Yes, when combined with MySQL Replication |
|
Scalability |
|
|
|
|
|
Built-in load balancing |
No |
No |
No |
Yes |
|
Supports Read-intensive applications |
Yes |
Yes |
Yes, when combined with MySQL Replication |
Yes |
|
Supports Write-intensive applications |
No |
No |
Yes |
Yes |
|
Maximum number of nodes per group |
One master, multiple slaves |
One master, multiple slaves |
One active (primary), one passive (secondary) node |
255 |
|
Maximum number of slaves |
Unlimited (reads only) |
Unlimited (reads only) |
One (failover only) |
Unlimited (reads only) |
6
A cluster is two or more computers (called nodes or members) that work together to perform a task. There are four major types of clusters:
- Storage
- High availability
- Load balancing
- High performance
Storage clusters provide a consistent file system image across servers in a cluster, allowing the servers to simultaneously read and write to a single shared file system. A storage cluster simplifies storage administration by limiting the installation and patching of applications to one file system. Also, with a cluster-wide file system, a storage cluster eliminates the need for redundant copies of application data and simplifies backup and disaster recovery.
High-availability clusters provide continuous availability of services by eliminating single points of failure and by failing over services from one cluster node to another in case a node becomes inoperative. Typically, services in a high-availability cluster read and write data (via read-write mounted file systems). Therefore, a high-availability cluster must maintain data integrity as one cluster node takes over control of a service from another cluster node. Node failures in a high-availability cluster are not visible from clients outside the cluster. (High-availability clusters are sometimes referred to as failover clusters.)
Load-balancing clusters dispatch network service requests to multiple cluster nodes to balance the request load among the cluster nodes. Load balancing provides cost-effective scalability because you can match the number of nodes according to load requirements. If a node in a load-balancing cluster becomes inoperative, the load-balancing software detects the failure and redirects requests to other cluster nodes. Node failures in a load-balancing cluster are not visible from clients outside the cluster. LVS (Linux Virtual Server).
High-performance clusters use cluster nodes to perform concurrent calculations. A high-performance cluster allows applications to work in parallel, therefore enhancing the performance of the applications. (High performance clusters are also referred to as computational clusters or grid computing.)
6
之前我发表过一篇文章介绍我们自己的组件/模块生成器,今天在网上偶尔发现国外有一套类似的JOOMLA生成器,他有个显著的特点是生成的类使用extends mosDBTable风格,这样所有的数据库操作都可以使用ORM的方式,并且提交到页面的POST可以直接转化为一个对象,简化所需的操作。这种风格在我们开发过程中应该是积极提倡的。
Joomla Module and Component Maker 演示使用地址:http://www.joomlatexas.com/index.php























