First, check the version of the local centos
[root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)
Description: architecture forests is a focus on architecture blog, address: https://www.cnblogs.com/architectforest
The corresponding source code can be accessed here for: https://github.com/liuhongdi/
Description: Author: Liu association E-mail: [email protected]
Two, fastdfs download and install
See centos8 installation of a cluster approach fastdfs6.06: Download and install Address: https://www.cnblogs.com/architectforest/p/12388972.html
Three, tracker installation / configuration / operation
See centos8 install fastdfs6.06 cluster of two ways: installation / configuration / tracker's run address: HTTPS: // www.cnblogs.com/architectforest/p/12389095.html
Fourth, the four storage: generation start fastdfs default configuration file
[root@localhost fastdfs-6.06]# cd /etc/fdfs/ [root@localhost fdfs]# cp storage.conf.sample storage.conf [root@localhost fdfs]# cp client.conf.sample client.conf
Description: no need to generate tracker.conf, because the service is no longer running tracker on storage
Fifth, the four storage: install nginx and fastdfs-nginx-module
1, extract nginx:
[root@localhost source]# tar -zxvf nginx-1.17.8.tar.gz
3, extract the fastdfs-nginx-module
[root@localhost source]# tar -zxvf V1.22.tar.gz
4, modify the config file, replace the / usr / local to / usr
[root@localhost source]# cd fastdfs-nginx-module-1.22/ [root@localhost fastdfs-nginx-module-1.22]# cd src [root@localhost src]# vi config
5, nginx configuration, adding fastdfs-nginx-module and module http_stub_status_module
[root@localhost fdfs]# cd /usr/local/source/nginx-1.17.8/ [root@localhost nginx-1.17.8]# ./configure --prefix=/usr/local/soft/nginx --with-http_stub_status_module --add-module=/usr/local/source/fastdfs-nginx-module-1.22/src/
6, compile and install nginx
[root@localhost nginx-1.17.8]# make && make install
7, check the installation was successful?
[root@localhost nginx-1.17.8]# ls /usr/local/soft/ | grep nginx nginx
Check whether the parameters specified compiler works?
[root@localhost fdfs]# /usr/local/soft/nginx/sbin/nginx -V nginx version: nginx/1.17.8 built by gcc 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC) configure arguments: --prefix=/usr/local/soft/nginx --with-http_stub_status_module --add-module=/usr/local/source/fastdfs-nginx-module-1.22/src/
Sixth, the four storage: Configure and start the storage service
1, create the required storage service catalog
[root@localhost fdfs]# mkdir /data/fastdfs/storage [root@localhost fdfs]# chmod 777 /data/fastdfs/storage/
2, the configuration storage service
Edit storage profiles:
[Root @ localhost FDF] # we /etc/fdfs/storage.conf
Each configuration items include:
= GROUP_NAME named group1 base_path = / Data / FastDFS / storage // configured base_path storage directory is created above store_path0 = / Data / FastDFS / storage // above store_path: catalog store is located, may be provided a plurality of, attention from zero = tracker_server 172.17 . 0.2 : 22122 tracker_server = 172.17 . 0.3 : 22122 // the above is the ip and port tracker_server http.server_port = 80 // the above specified http service port
Description: // followed me add comments, do not write the configuration file
Description: Different from the configuration:
172.17.0.4 group_name = group1 172.17.0.5 group_name = group1 172.17.0.6 group_name = group2 172.17.0.7 group_name = group2
Description: We can see from the above, storage_server when you start to be registered to tracker_server,
In order to achieve its scheduled by tracker_server
3, start the storage service
[root @ localhost FDFS] # /etc/init.d/ fdfs_storaged Start
Starting fdfs_storaged (via systemctl): [OK]
4, check the storage service startup success?
[root @ localhost FDF] # ps auxfww | grep FDF root 15630 0.0 0.0 12320 972 pts / 0 S + 15 : 46 0 : 00 | | \ _ Grep --color = auto FDF root 15026 0.0 0.1 155 696 6964 ? SL 15 : 13 0 : 00 / usr / bin / fdfs_trackerd / etc / FDF / tracker.conf root 15573 2.7 1.7 150736 66292 ? Sl 15:45 0:02 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
Description: see fdfs_storaged, represents storage service starts successfully
5, check the storage service is already bound to port: 23000?
[root @ localhost FDF] # netstat -ANP | grep 23000 tcp 0 0 0.0 . 0.0 : 23000 0.0 . 0.0 : * LISTEN 15573 / fdfs_storaged
Description: 23000 port is defined in the configuration file /etc/fdfs/storage.conf follows:
# the storage server port port = 23000
Seven, the four storage server: Configuring fastdfs-nginx-module
1, generates configuration file:
[root@localhost nginx-1.17.8]# cp /usr/local/source/fastdfs-nginx-module-1.22/src/mod_fastdfs.conf /etc/fdfs/
2, edit the configuration file:
[root@localhost nginx-1.17.8]# vi /etc/fdfs/mod_fastdfs.conf
Configure the following items
group_name=group1 connect_timeout=10 tracker_server=172.17.0.2:22122 tracker_server=172.17.0.3:22122 url_have_group_name = true store_path0=/data/fastdfs/storage group_count = 2 [group1] group_name=group1 storage_server_port=23000 store_path_count=1 store_path0=/data/fastdfs/storage [group2] group_name=group2 storage_server_port=23000 store_path_count=1 store_path0=/data/fastdfs/storage
Description: The top group_name
When the machine belonging to this group group1, is group1
When the machine belonging to this group group2, is group2
说明:url_have_group_name = true
Do not miss this one, it will lead to nginx does not work
3. Copy the other two web access configuration file used to fdfs configuration directory:
[root@d5d19e99e782 /]# cp /usr/local/source/fastdfs-6.06/conf/http.conf /etc/fdfs/ [root@d5d19e99e782 /]# cp /usr/local/source/fastdfs-6.06/conf/mime.types /etc/fdfs/
Eight, the four storage server: Configuring nginx
Edit the nginx configuration file:
[root@localhost conf]# vi /usr/local/soft/nginx/conf/nginx.conf
Disposed beneath the server listen 80 of the server,
Add a location
location ~/group([0-9]) { root /data/fastdfs/storage/data; ngx_fastdfs_module; }
Nine, the four storage server: Start nginx
1 Start
[root@localhost storage]# /usr/local/soft/nginx/sbin/nginx
2, check whether nginx started successfully
[root@localhost storage]# ps auxfww | grep nginx root 24590 0.0 0.0 12320 980 pts/0 S+ 16:44 0:00 | | \_ grep --color=auto nginx root 24568 0.0 0.0 41044 428 ? Ss 16:44 0:00 \_ nginx: master process /usr/local/soft/nginx/sbin/nginx nobody 24569 0.0 0.1 74516 4940 ? S 16:44 0:00 \_ nginx: worker process