corosync+pacemaker+drbd 實現lamp叢集(Discuz)

來源:互聯網
上載者:User

標籤:lamp   高可用叢集   corosync   

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/37/C6/wKioL1OvrZKw1D9-AAEDaobD9Aw534.jpg" title="1.jpg" alt="wKioL1OvrZKw1D9-AAEDaobD9Aw534.jpg" />

實驗平台:

CentOS 6.4


實現功能:

利用corosync+pacemaker+drbd完成lamp平台的高可用,並安裝Discuz論壇進行測試


實驗步驟:

1、

同步雙方hosts檔案,加入node6與node7的解析

10.32.9.56 node6

10.32.9.57 node7


實現SSH雙機互信

node1ssh-keygen -t rsa --- 產生一對公私密金鑰檔案,預設放在/root/.ssh/id_rsa目錄下ssh-copy-id [email protected]預設將/root/.ssh/id_rsa的公開金鑰檔案發送的對端相應目錄node2ssh-keygen -t rsa ssh-copy-id [email protected]


高可用叢集各節點時間需同步

ntpdate 0.centos.pool.ntp.org  ----調整時間為ntp伺服器ntpdate 0.centos.pool.ntp.org上的時間

生產環境時間建議使用ntpd加快時間步伐進行調整,使用ntpdate改時間容易出現問題


2、分別為雙機提供lamp的平台

yum install -y httpd  ------------ 安裝apache服務yum install -y mysql.x86_64 mysql-server.x86_64 php-mysql.x86_64  mysql-devel.x86_64 mysql-libs.x86_64 -y  ---- 安裝mysql服務yum install -y php-mysql.x86_64 php.x86_64 php-devel.x86_64 php-mbstring.x86_64 ---安裝php服務

確保httpd mysqld伺服器不會開機自動啟動



3、node6 node7分別建立兩個相等大小的分區,這裡使用添加新硬碟並建立分區的方式。

/dev/sdb1 -- 作為web網站存放路徑

/dev/sdb2 -- 作為mysql資料存放路徑



4、安裝drbd並定義drbd資源和屬性   

在CentOS6.4上編譯安裝DRBD

安裝使用者空間工具

yum -y install gcc kernel-devel kernel-headers flex

wget http://oss.linbit.com/drbd/8.4/drbd-8.4.1.tar.gz  ---- 下載源碼包

tar xzf drbd-8.4.1.tar.gz

./configure --prefix=/usr/local/drbd --with-km

make KDIR=/usr/src/kernels/2.6.32-358.el6.x86_64/

make install

mkdir -p /usr/local/drbd/var/run/drbd

cp /usr/local/drbd/etc/rc.d/init.d/drbd /etc/rc.d/init.d ---- 複製SysV啟動指令碼


安裝核心模組

至解壓後的原始碼目錄下

make clean

make KDIR=/usr/src/kernels/2.6.32-358.el6.x86_64/

cp drbd.ko /lib/modules/`uname -r`/kernel/lib/

depmod

modprobe drbd 裝載drbd模組

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.