[Step 2] Load Balancing EasySLB File Server Deployment, Configuration, and Database Server

Published: 2015-01-20

```html

Mainly divided into linux and windows operating systems. Linux uses nfs service; windows uses the built-in file sharing service.

I. Linux file sharing setup

1.NFS server side (file server):

(1)Install

yum -y install nfs-utils rpcbind 

chkconfig nfs on 

chkconfig rpcbind on

Note: On centos7, use the following commands to set the services to start automatically on boot

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

For ubuntu18.xx, use the following commands

apt-get install nfs-kernel-server nfs-common

/etc/init.d/nfs-kernel-server start

(2)Configuration

vi /etc/exports

#Note:Please write the file content according to the actual situation,mainly the ip address needs to be filled in with the internal network ip of the web server. In the example, the two web servers are 192.168.236.154 and 192.168.236.155 respectively

/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) Start the NFS service program

service rpcbind  start

service nfs start

Note: On centos7, use the following commands to start the services

systemctl restart rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap


Note: In centos7, please use systemctl to operate services

For example: to stop iptables, use systemctl stop iptables, systemctl stop firewalld


2.NFS client(i.e. web processing server):

(1)Install

yum -y install nfs-utils rpcbind


On centos6, execute the following commands


chkconfig rpcbind on

service rpcbind start

/etc/init.d/rpcidmapd start

chkconfig --add rpcidmapd

chkconfig  rpcidmapd on


In centos7, please use systemctl to operate services

systemctl restart rpcbind

systemctl start nfs-idmap


systemctl enable rpcbind

systemctl enable /usr/lib/systemd/system/nfs-idmapd.service

For ubuntu18.xx, use the following commands

apt-get install nfs-common

/etc/init.d/nfs-common start

(2) Automatic mounting

vim /etc/fstab

#Note:The 192.168.236.1 here refers to the internal network ip of the NFS server, please refer to the actual situation

#nfsvers=3, use v3 here, v4 has a seq id sequence number bottleneck problem, which will cause high load but low 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

#After saving, execute the following command. If mounting remains unresponsive, please turn off the server firewall

mount -a

#Note: Every web server needs to install and mount

(3)Files are stored on the nfs file server at /home/wwwroot, and each web server has already mounted the file server path through nfs. In the web service (such as apache), simply call the address /home/wwwroot directly.

II. Windows file sharing setup
Three mandatory conditions need to be met
①. Both the file server and the web server need to create a normal account with the same name and the same password.
②. Enable the "File and Printer Sharing for Microsoft Networks" service on the network adapters of the file server and web server. By default, our company's servers already have this enabled.

③. The server and workstation services of the file server and web server need to be enabled and set to start automatically.


1. First set it up on the file server. Share the directory where files are stored using the normal account that was created. See the screenshot of windows2008 system. Read and write permissions are required. (Note: Here, first use the management assistant to create the site, because site creation will also create the normal username and password, ftp information, and mysql. After creation, then set up file sharing)

1.jpg

See the windows2003 system sharing screenshot

gongxiang.png



2.Then log in to each server that will provide WEB service and perform the following same steps.

Go to the web server and use the site creation assistant to create a site, then click Site Properties > Home Directory to manually modify the path, for the call select "A shared folder on another computer", and enter the address as "\\192.168.236.148\test\wwwroot". See screenshot

11.png

Note: The site running username and password are the uniformly created username and password, for example, in the tutorial the user is test

 

Database server

It is generally recommended to place the database on the file server, using the same server. Note that in the program it must be called using the internal network 192.168.x.x, and localhost cannot be used.

If the file server load is too high, use a separate server for the database server, connected and called through the internal network IP address.


Related link: [Step 3] Load balancing EasySLB site creation 

```