【第二步】負載均衡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ù)開機自動啟動 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)容請根據(jù)實際情況寫入,主要是ip地址要填寫web服務(wù)器的內(nèi)網(wǎng)ip,示例中兩臺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)啟動NFS服務(wù)程序 service rpcbind start service nfs start 注意:centos7使用下面命令啟動服務(wù) systemctl restart rpcbind 注意: centos7中請使用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中請使用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)自動掛載 vim /etc/fstab #注意:這里的192.168.236.1是指NFS服務(wù)器的內(nèi)網(wǎng)ip, 請以實際情況為準 #nfsvers=3,這里用v3版本,v4存在一個seq id序列號瓶頸問題,會導(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)請關(guān)閉服務(wù)器防火墻 mount -a #注意:每臺web服務(wù)器都需要安裝和掛載 (3)文件存儲在nfs文件服務(wù)器的/home/wwwroot上,而每臺 web服務(wù)器已通過nfs掛載文件服務(wù)器路徑,在web服務(wù)(比如apache)中直接調(diào)用/home/wwwroot此地址即可。 二、windows文件共享設(shè)置 ③.文件服務(wù)器和web服務(wù)器的server 和 workstation 服務(wù)需要開啟,并設(shè)置成自動啟動。
見windows2003系統(tǒng)共享截圖
2.然后登錄每一臺要提供WEB服務(wù)的服務(wù)器,執(zhí)行以下相同步驟。 到web服務(wù)器使用建站助手建立站點,之后點站點屬性》主目錄手工修改路徑,調(diào)用選擇“另一臺計算機上的共享”,地址寫“\\192.168.236.148\test\wwwroot”。見截圖
注意:站點運行用戶名和密碼就是統(tǒng)一建立的此用戶名和密碼,例如教程中用戶為test
數(shù)據(jù)庫服務(wù)器 一般建議數(shù)據(jù)庫放文件服務(wù)器上,使用同一臺服務(wù)器,注意程序里面需使用內(nèi)網(wǎng)192.168.x.x調(diào)用,不可使用localhost。 如果文件服務(wù)器負荷過高,數(shù)據(jù)庫服務(wù)器單獨一臺服務(wù)器,通過內(nèi)網(wǎng)IP地址連接調(diào)用。 相關(guān)鏈接:【第三步】負載均衡EasySLB建站
|
|||||
| >> 相關(guān)文章 | |||||
|
|
|||||