centos8 mounting fastdfs6.06 (single mode)

First, download fastdfs6.06

1, the official address

https://github.com/happyfish100

2. Description: The current version: a total of three sub-modules

fastdfs v6.06
libfastcommon v1.0.43
fastdfs-nginx-module   v 1.22

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]

 

3, Download

[root@localhost source]# wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz
[root@localhost source]# wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz
[root@localhost source]# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz

 

Second, download nginx

1, the official website address:

http://nginx.org/

2, download nginx

[root@localhost source]# wget http://nginx.org/download/nginx-1.17.8.tar.gz

 

Third, the required installation package fastdfs

[root@localhost dest]# yum install gcc gcc-c++
[root@localhost dest]# yum install libtool zlib zlib-devel openssl openssl-devel
[root@localhost dest]# yum -y install pcre pcre-devel libevent libevent-devel perl unzip net-tools wget

Description: When an error occurs when compiling fastdfs will be used to install these packages, to avoid compilation

 

Four, libfastcommon installation

 

1, decompression of compressed libfastcommon

 [root@localhost source]# tar -zxvf V1.0.43.tar.gz

 

2, compile and install

[root@localhost source]# cd libfastcommon-1.0.43/
[root@localhost libfastcommon-1.0.43]# ./make.sh && ./make.sh install

 

3, the results of checks carried out to see whether the installation was successful:

[root@localhost libfastcommon-1.0.43]# ls /usr/lib64|grep libfastcommon
libfastcommon.so
[root@localhost libfastcommon-1.0.43]# ls /usr/lib|grep libfastcommon
libfastcommon.so

 

Note: If you can see libfastcommon.so, the installation is successful

 

Fifth, compile and install fastdfs

1, extract fastdfs

[root@localhost source]# tar -zxvf V6.06.tar.gz

 

2, installation fastdfs

[root@localhost source]# cd fastdfs-6.06/
[root@localhost fastdfs-6.06]# ./make.sh && ./make.sh install

 

3, fastdfs check whether the installation was successful?

[root @ localhost fastdfs- 6.06 ] # ls / usr / bin | grep FDF 
fdfs_appender_test 
fdfs_appender_test1 
fdfs_append_file 
fdfs_crc32 
fdfs_delete_file 
fdfs_download_file 
fdfs_file_info 
fdfs_monitor 
fdfs_regenerate_filename 
fdfs_storaged 
fdfs_test 
fdfs_test1 
fdfs_trackerd 
fdfs_upload_appender 
fdfs_upload_file

 

Description: Can you see these programs fdfs_ starts, it indicates that the installation was successful

Sixth, to generate the desired profile start fastdfs

[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
[root@localhost fdfs]# cp tracker.conf.sample tracker.conf

 

Seven, start tracker service

1, create a tracker needed services directory

[root @ localhost FDF] # mkdir / data / fastdfs 
[root @ localhost FDF] # mkdir / data / fastdfs / tracker 
[root @ localhost FDF] # chmod  777 / data / fastdfs / tracker

 

2, the configuration tracker service,

   Modify tracker.conf file

[root @ localhost FDF] # we /etc/fdfs/tracker.conf

  Modify the value base_path only one in our catalog can be created above

  base_path = /data/fastdfs/tracker

 

 3, start the tracker service

[Root @ localhost FDF] # /etc/init.d/fdfs_trackerd start

 

4, check the tracker service is successful start

[root @ localhost FDF] # ps auxfww | grep FDF 
root       15067   0.0   0.0   12320    964 pts / 0     S +    15 : 14    0 : 00   | | \ _ Grep --color = auto FDF 
root       15026   0.0   0.1   90 160   5940 ? Psalm    15 : 13    0 : 00 / usr / bin / fdfs_trackerd /etc/fdfs/tracker.conf

 

Can see fdfs_trackerd, expressed tracker service starts successfully

 

5, check the tracker service is already bound port 22122?

[root@localhost dest]# netstat -anp | grep 22122
tcp        0      0 0.0.0.0:22122           0.0.0.0:*               LISTEN      15026/fdfs_trackerd 

Description: 22122 /etc/fdfs/tracker.conf port is defined in,

          as follows:

# the tracker server port
port = 22122

 

 Eight start 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:

Configuring base_path created for the above storage directory

base_path = /data/fastdfs/storage
store_path0 = /data/fastdfs/storage

// above store_path: catalog store is located, you can set up multiple, attention from zero

tracker_server = 192.168.3.172:22122 

// The above is tracker_server the ip and port

http.server_port = 80

Http // above is designated port services

 

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

 

Nine, configure the client to use fastdfs profile

1, configure the client to use client.conf

[root @ localhost FDF] # we /etc/fdfs/client.conf

The following two configurations used tracker directory server address and port

base_path = /data/fastdfs/tracker
tracker_server = 192.168.3.172:22122

2, the client configuration can be seen: the client only needs to know the information tracker_server

   Tracker server role is what load balancing and scheduling

 

3, Storage server role is to document storage, client upload files stored on the final Storage Server

 

Ten, install nginx and fastdfs-nginx-module

1, extract nginx:

[root@localhost source]# tar -zxvf nginx-1.17.8.tar.gz

2, extract fastdfs-nginx-module

[root@localhost source]# tar -zxvf V1.22.tar.gz

 

3, 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

 

4, 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/

 

5, compile and install nginx 

[root@localhost nginx-1.17.8]# make && make install

6. Check the installation was successful?

[root@localhost nginx-1.17.8]# ls /usr/local/soft/ | grep nginx
nginx

 

7. 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/

 

XI configuration 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

connect_timeout=10
tracker_server=192.168.3.172:22122
url_have_group_name = true
store_path0=/data/fastdfs/storage

 

3. Copy the other two web access configuration file used to fdfs configuration directory:

[root@localhost nginx-1.17.8]# cd /usr/local/source/fastdfs-6.06/conf/
[root@localhost conf]# cp http.conf /etc/fdfs/
[root@localhost conf]# cp mime.types /etc/fdfs/

 

XII configuration 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;
        }

 

Thirteen, 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

 

Fourth, test upload an image

1. Prepare a picture and upload

[root@localhost storage]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/liuhongdi/image/nginx.jpg
group1/M00/00/00/wKgDrF5U32GAZAo1AAAyP-hllUI402.jpg

 

Note fdfs address returned, we need to use this address to access

 

2, open the browser: visit this address:

http://192.168.3.172/group1/M00/00/00/wKgDrF5U32GAZAo1AAAyP-hllUI402.jpg

You can see the picture

 

3, Description: 192.168.3.172 is a local server ip stitching

 

4, the actual picture in the file system in what position?

[root@localhost data]# pwd
/data/fastdfs/storage/data
[root@localhost data]#
ls 00/00 wKgDrF5U32GAZAo1AAAyP-hllUI402.jpg

 

Visible / group1 / M00 these two directories is managed by the fdfs generated directory:

They represent fdfs generated by the group name and disk

 

Fifth, check the version of fdfs

[root@localhost data]# fdfs_monitor /etc/fdfs/client.conf | grep version
[2020-02-25 16:58:01] DEBUG - base_path=/data/fastdfs/tracker, connect_timeout=5, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0

version = 6.06

 

XVI operational status monitoring fdfs

[Root @ localhost data] # fdfs_monitor /etc/fdfs/client.conf

 

XVII view the local version centos

[root@localhost lib]# cat /etc/redhat-release 
CentOS Linux release 8.1.1911 (Core) 

 

Guess you like

Origin www.cnblogs.com/architectforest/p/12388851.html