Guest string: hacker form artifacts, database issues
Object-oriented Sublimation: object-oriented cognition-new first cognition, object-oriented imagination-sleepwalking (1), object-oriented cognition-how to find a class
PHP project start point: teach you how to make a keyword match project (search engine) ---- the first day of the latest: teach you how to make a keyword match project (search engine) ---- 21st days
Server Load balancer-File Service Policy
Similar articles: Server Load balancer-concepts, Server Load balancer-Configuration)
The last time I mentioned so many servers, where are the files they need together?
Then we need the file server, where the file server comes from. Let's take a look at the figure to understand:
Figure 1
Bytes ---------------------------------------------------------------------------------------------------------------
Figure 2
Both figure 1 and figure 2 can solve the problem.
When you give the two images to the boss for approval, the boss will select figure 2.
This involves high-level issues, so we don't have to worry about it. Today, our main content is the file service policy.
The file service policies introduced today are divided into three types (Linux ):
1. File Sharing
2. file synchronization
3. Distributed File System
Three Advantages and disadvantages.
1. File Sharing
See figure 2. Pa is the file server, which stores files on the server.
Run the following commands on P1, P2, and P3:
mount -o rw 192.168.2.2:/storage /storage
Note: Pa, P1, P2, and P3/storage are file paths.
2. file synchronizationArticle
Pa install rsync server, How to install see: http://rsync.samba.org/
2.1 install the software package
Sudo apt-Get install rsync # online installation methods such as Debian and Ubuntu; online installation methods such as Yum install rsync # fedora and RedHat; rpm-IVH rsync # Install RPM packages such as fedora and RedHat;
2.2 configuration file
Rsync mainly includes the following three configuration files:/etc/rsyncd. conf (main configuration file),/etc/rsyncd. secrets (password file),/etc/rsyncd. motd (rysnc Server Information)
Note: The File Attribute of the rsyncd. Secrets password file is set to root and the permission must be set to 600. Otherwise, the backup will fail!
/Etc/rsyncd. conf:
pid file = /var/run/rsyncd.pid port = 873address = 192.168.1.171 uid = rootgid = rootuse chroot = yes read only = yes #limit access to private LANshosts allow=192.168.2.0/255.255.255.0 hosts deny=*max connections = 5 #motd file = /etc/rsyncd.motd#This will give you a separate log file#log file = /var/log/rsync.log#This will log every file transferred - up to 85,000+ per user, per sync#transfer logging = yeslog format = %t %a %m %f %bsyslog facility = local3timeout = 300[storage] path = /storagelist=yes ignore errors auth users = rootsecrets file = /etc/rsyncd.secrets
Rsyncd. Secrets:
root:[email protected]
2.3 start the service
/etc/init.d/xinetd reload
Rsync is also installed in P1, P2, and P3.
Run the crontab command to synchronize data every few minutes. Run the following command:
rsync -vzrtopg --delete [email protected]192.168.2.2::storage --password-file=/etc/rsync.pass
To avoid entering a password, add/etc/rsync. pass to the password.
[email protected]
3. Distributed File System
See the figure before you start.
First, let's take a look at the following concepts:
1. PA: Master File Server (master server)
2. P1, P2, P3: Chunk File Server (file storage server)
The document also introduces the use of moosefs, Official Website: http://www.moosefs.org/reference-guide.html#making-and-installing
There is a Chinese document in it, which is quite reliable.
3.1 install moosefs master
wget http://ncu.dl.sourceforge.net/project/moosefs/moosefs/1.6.11/mfs-1.6.11.tar.gztar zxvf mfs-1.6.11.tar.gzcd mfs-1.6.11useradd mfs -s /sbin/nologin./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfsmakemake install
Copy the master configuration file:
cd /usr/local/mfs/etc/cp mfsmaster.cfg.dist mfsmaster.cfgcp mfsexports.cfg.dist mfsexports.cfg
Start and pause commands
/usr/local/mfs/sbin/mfsmaster start/usr/local/mfs/sbin/mfsmaster –s
Master mfsexports. cfg Configuration
192.168.2.0/24 . rw192.168.2.0/24 / rw
Set the number of copies. Three copies are recommended.
/usr/local/mfs/bin/mfssetgoal -r 3
3.2 install moosefs chunk server on P1, P2, and p3
wget http://ncu.dl.sourceforge.net/project/moosefs/moosefs/1.6.11/mfs-1.6.11.tar.gztar zxvf mfs-1.6.11.tar.gz cd mfs-1.6.11useradd mfs -s /sbin/nologin./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfsmakemake install
Copy the chunk server configuration file:
cd /usr/local/mfs/etc/cp mfschunkserver.cfg.dist mfschunkserver.cfgcp mfshdd.cfg.dist mfshdd.cfg
Start and pause commands
/usr/local/mfs/sbin/mfschunkserver start/usr/local/mfs/sbin/mfschunkserver stop
Mfshdd. cfg Configuration
/Data/MFs # file storage path
3.3 moosefs Client installation
Install Pa, P1, P2, and P3 as follows:
wget http://ncu.dl.sourceforge.net/project/moosefs/moosefs/1.6.11/mfs-1.6.11.tar.gztar zxvf mfs-1.6.11.tar.gz cd mfs-1.6.11useradd mfs -s /sbin/nologin./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs--enable-mfsmountmakemake install
Mount file systems for Pa, P1, P2, and P3:
/usr/local/mfs/bin/mfsmount /storage -H 192.168.2.2
Summary:All right, the three solutions have been introduced, and the whole process is very simple. Come and select a suitable solution. Try it on your own!
Of course, all three solutions have their own advantages and disadvantages.RecommendationAnswer these questions!
Server Load balancer-File Service Policy