【第二步】負(fù)載均衡EasySLB文件服務(wù)器部署、設(shè)置,及數(shù)據(jù)庫服務(wù)器主要分linux和windows操作系統(tǒng)。 Linux使用nfs服務(wù);windows使用自帶文件共享服務(wù)。 一、linux文件共享設(shè)置 1.NFS服務(wù)器端(文件服務(wù)器): (1)安裝 yum -y install nfs-utils rpcbind chkconfig nfs on chkconfig rpcbind on 注意:centos7使用下面命令設(shè)置服務(wù)開機(jī)自動(dòng)啟動(dòng) systemctl enable rpcbind systemctl enable nfs-server systemctl enable /usr/lib/systemd/system/rpc-statd.service systemctl enable /usr/lib/systemd/system/nfs-idmapd.service ubuntu18.xx使用以下命令 apt-get install nfs-kernel-server nfs-common /etc/init.d/nfs-kernel-server start (2)配置 vi /etc/exports #注意:文件內(nèi)容請(qǐng)根據(jù)實(shí)際情況寫入,主要是ip地址要填寫web服務(wù)器的內(nèi)網(wǎng)ip,示例中兩臺(tái)web分別是192.168.236.154和192.168.236.155 /home/wwwroot 192.168.236.154(rw,async,root_squash) 192.168.236.155(rw,async,root_squash) /home/wddata/vhost 192.168.236.154(rw,async,root_squash) 192.168.236.155(rw,async,root_squash) (3)啟動(dòng)NFS服務(wù)程序 service rpcbind start service nfs start 注意:centos7使用下面命令啟動(dòng)服務(wù) systemctl restart rpcbind 注意: centos7中請(qǐng)使用systemctl 操作服務(wù) 如:關(guān)閉iptables應(yīng)使用 systemctl stop iptables、systemctl stop firewalld 2.NFS客戶端(即web處理服務(wù)器): (1)安裝 yum -y install nfs-utils rpcbind centos6執(zhí)行以下命令 chkconfig rpcbind on service rpcbind start /etc/init.d/rpcidmapd start chkconfig --add rpcidmapd chkconfig rpcidmapd on centos7中請(qǐng)使用systemctl 操作服務(wù) systemctl restart rpcbind systemctl start nfs-idmap systemctl enable rpcbind systemctl enable /usr/lib/systemd/system/nfs-idmapd.service ubuntu18.xx使用以下命令 apt-get install nfs-common /etc/init.d/nfs-common start (2)自動(dòng)掛載 vim /etc/fstab #注意:這里的192.168.236.1是指NFS服務(wù)器的內(nèi)網(wǎng)ip, 請(qǐng)以實(shí)際情況為準(zhǔn) #nfsvers=3,這里用v3版本,v4存在一個(gè)seq id序列號(hào)瓶頸問題,會(huì)導(dǎo)致load升高,但cpu不高的情況出現(xiàn) 192.168.236.1:/home/wwwroot /home/wwwroot nfs defaults,_netdev,nodiratime,noatime,nfsvers=3 0 0 192.168.236.1:/home/wddata/vhost /home/wddata/vhost nfs defaults,_netdev,nodiratime,noatime,nfsvers=3 0 0 #保存以后執(zhí)行下面命令,掛載一直無響應(yīng)請(qǐng)關(guān)閉服務(wù)器防火墻 mount -a #注意:每臺(tái)web服務(wù)器都需要安裝和掛載 (3)文件存儲(chǔ)在nfs文件服務(wù)器的/home/wwwroot上,而每臺(tái) web服務(wù)器已通過nfs掛載文件服務(wù)器路徑,在web服務(wù)(比如apache)中直接調(diào)用/home/wwwroot此地址即可。 二、windows文件共享設(shè)置 ③.文件服務(wù)器和web服務(wù)器的server 和 workstation 服務(wù)需要開啟,并設(shè)置成自動(dòng)啟動(dòng)。
見windows2003系統(tǒng)共享截圖
2.然后登錄每一臺(tái)要提供WEB服務(wù)的服務(wù)器,執(zhí)行以下相同步驟。 到web服務(wù)器使用建站助手建立站點(diǎn),之后點(diǎn)站點(diǎn)屬性》主目錄手工修改路徑,調(diào)用選擇“另一臺(tái)計(jì)算機(jī)上的共享”,地址寫“\\192.168.236.148\test\wwwroot”。見截圖
注意:站點(diǎn)運(yùn)行用戶名和密碼就是統(tǒng)一建立的此用戶名和密碼,例如教程中用戶為test
數(shù)據(jù)庫服務(wù)器 一般建議數(shù)據(jù)庫放文件服務(wù)器上,使用同一臺(tái)服務(wù)器,注意程序里面需使用內(nèi)網(wǎng)192.168.x.x調(diào)用,不可使用localhost。 如果文件服務(wù)器負(fù)荷過高,數(shù)據(jù)庫服務(wù)器單獨(dú)一臺(tái)服務(wù)器,通過內(nèi)網(wǎng)IP地址連接調(diào)用。 相關(guān)鏈接:【第三步】負(fù)載均衡EasySLB建站
|
|||||
| >> 相關(guān)文章 | |||||
|
|
|||||