【第二步】負載均衡EasySLB文件服務器部署、設置,及數據庫服務器主要分linux和windows操作系統。 Linux使用nfs服務;windows使用自帶文件共享服務。 一、linux文件共享設置 1.NFS服務器端(文件服務器): (1)安裝 yum -y install nfs-utils rpcbind chkconfig nfs on chkconfig rpcbind on 注意:centos7使用下面命令設置服務開機自動啟動 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 #注意:文件內容請根據實際情況寫入,主要是ip地址要填寫web服務器的內網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服務程序 service rpcbind start service nfs start 注意:centos7使用下面命令啟動服務 systemctl restart rpcbind 注意: centos7中請使用systemctl 操作服務 如:關閉iptables應使用 systemctl stop iptables、systemctl stop firewalld 2.NFS客戶端(即web處理服務器): (1)安裝 yum -y install nfs-utils rpcbind centos6執行以下命令 chkconfig rpcbind on service rpcbind start /etc/init.d/rpcidmapd start chkconfig --add rpcidmapd chkconfig rpcidmapd on centos7中請使用systemctl 操作服務 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服務器的內網ip, 請以實際情況為準 #nfsvers=3,這里用v3版本,v4存在一個seq id序列號瓶頸問題,會導致load升高,但cpu不高的情況出現 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 #保存以后執行下面命令,掛載一直無響應請關閉服務器防火墻 mount -a #注意:每臺web服務器都需要安裝和掛載 (3)文件存儲在nfs文件服務器的/home/wwwroot上,而每臺 web服務器已通過nfs掛載文件服務器路徑,在web服務(比如apache)中直接調用/home/wwwroot此地址即可。 二、windows文件共享設置 ③.文件服務器和web服務器的server 和 workstation 服務需要開啟,并設置成自動啟動。
見windows2003系統共享截圖
2.然后登錄每一臺要提供WEB服務的服務器,執行以下相同步驟。 到web服務器使用建站助手建立站點,之后點站點屬性》主目錄手工修改路徑,調用選擇“另一臺計算機上的共享”,地址寫“\\192.168.236.148\test\wwwroot”。見截圖
注意:站點運行用戶名和密碼就是統一建立的此用戶名和密碼,例如教程中用戶為test
數據庫服務器 一般建議數據庫放文件服務器上,使用同一臺服務器,注意程序里面需使用內網192.168.x.x調用,不可使用localhost。 如果文件服務器負荷過高,數據庫服務器單獨一臺服務器,通過內網IP地址連接調用。 相關鏈接:【第三步】負載均衡EasySLB建站
|
|||||
| >> 相關文章 | |||||
|
|
|||||