FastDFS is an open source distributed file system lightweight pure C implementation, support for Linux, FreeBSD and other UNIX systems like google FS, not a general purpose file system, can only be accessed via a proprietary API currently provides C, Java and PHP API applications tailored for the Internet, to solve large-capacity file storage problems, the pursuit of high performance and high scalability FastDFS can be seen as the key value pair file-based storage system, known as a distributed file storage service more appropriate.
Installation media:
fastdfs-master.zip
libfastcommon-master.zip
fastdfs-nginx-module-master.zip
download link:
Link: https: //pan.baidu.com/s/1ARGsutCgHw4KJk5G0tw2OQ extraction code: hp7s
or https://github.com/happyfish100/libfastcommon
Or https://download.csdn.net/download/mazhitao1986/12254793
Reliance installation
sudo yum -y install gcc gcc-c++
sudo yum -y install libevent
libfastcommon installation
Decompression libfastcommon-master.zip
unzip libfastcommon-master.zip
Libfastcommon-master directory into the build and install
sudo ./make.sh
sudo ./make.sh install
Create a tracker and storage of data and log directory
cd / data
sudo mkdir fastdfs
Create a tracker and storage directory will be used later in the fastdfs
CD fastdfs
sudo mkdir tracker
sudo mkdir storage
Installation Tracker
Decompression fastdfs-master.zip
unzip fastdfs-master.zip
Into fastdfs-master catalog to compile and install
sudo ./make.sh
sudo ./make.sh install
After a successful installation into the / etc / fdfs directory
The tracker.conf.sample copy named tracker.conf
sudo cp tracker.conf.sample tracker.conf
Edit tracker.conf
sudo vim tracker.conf
Modify the following places
base_path = / data / tracker #tracker log data directory and directory / data / tracker already created above, arranged according to their actual address
http.server_port = 8080 # This according to their needs, do not like conflict and other port services
After configuring, esc key: wq save
Start tracker service
sudo /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
Check whether the service starts successfully
At this point, tracker has been installed!
Storage Installation
Because it is a stand-alone environment, you only need to configure the storage in the same way
Enter / etc / fdfs directory, and copy the storage.conf.sample named storage.conf
Edit storage.conf
sudo vim storage.conf
Modify the following places
group_name=group1
base_path = / data / storage # / data / storage above has been created, the actual path is specified according to your own server
base_path0=/data/storage
tracker_server=tracker_serverip:22122
http.server_port = 8888 # This according to their needs, do not like conflict and other port services
After configuring, esc key: wq save
Start storage service
sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
Check whether the service starts successfully
Can also enter / data / storage / logs directory, view the log as follows storaged.log
So far, storage installation!
FastDFS own testing tools
Into the / etc / fdfs, and designated as the copy client.conf.sample client.conf
Edit client.conf
sudo came client.conf
Modify the following places
base_path = / data / storage # / data / storage above has been created, the actual path is specified according to your own server
tracker_server=tracker_serverip:22122
After configuring, esc key: wq save
Upload a picture test
sudo / usr / bin / fdfs_test /etc/fdfs/client.conf upload /home/mazhitao/test.png
Upload successful, look for the picture based on their specified directory
Test ok
Storage node Nginx installation module and fastdfs-nginx
Install nginx dependence
sudo yum install pcre
sudo yum install pcre-devel
sudo yum install zlib
sudo yum install zlib-devel
sudo yum install openssl
sudo yum install openssl-devel
Decompression fastdfs-nginx-module-master.zip
unzip fastdfs-nginx-module-master.zip
Nginx package into the installation directory, configuration and installation directory specified nginx fastdfs-nginx-module-master source position
sudo ./configure --prefix=/usr/local/nginx --add-module=/home/mazhitao/tool/fastdfs-nginx-module-master/src/
After the installation is finished compiling and
sudo make
sudo make install
Configuration mod_fastdfs.conf
Copy fastdfs-nginx-module-master / src / mod_fastdfs.conf file to the / etc / fdfs directory
Edit mod_fastdfs.conf
sudo vim mod_fastdfs.conf
Modify the following places
b ase_path=/data/storage
tracker_server=tracker_serverip:22122
url_have_group_name=true
store_path0=/data/storage
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/data/storage
Copy fastdfs-master / conf / directory and mime.types http.conf two files to the / etc / fdfs / copy must be activated, otherwise nginx will report baffling wrong
sudo cp http.conf mime.types /etc/fdfs/
Enter / etc / fdfs / catalog
Configuring nginx.conf path /usr/local/nginx/conf/nginx.conf
sudo vim nginx.conf add content red box refers to the storage root directory
Save the edited and start nginx
If you see ngx_http_fastdfs_set this directive is basically successful, access the test browser
Everything ok, this installation all over!