FastDFS Distributed file system

1. FastDFS architecture

2. FastDFS is configured in CentOS

Prepare two VMS: one is a Tracker Server and the other is a Storage Server.

1. Configure VMS. (Perform the following operations on the two VMS.)

1.1 Uploading Relevant files

1.2 installing the c++ environmentyum install -y gcc gcc-c++

1.3 Installing the Libevent Environmentyum install -y libevent

1.4 installation libfastcommon – 1.0.42

  • The tar - ZXVF libfastcommon - 1.0.42. Tar. GzDecompress the installation package
  • CD libfastcommon - 1.0.42Go to the directory
  • ./make.shCompiling the environment
  • ./make.sh installThe installation

1.5 Installing fastdFS

  • Tar - ZXVF fastdfs 6.04. Tar. GzDecompress the installation package
  • CD fastdfs - 6.04Go to the directory
  • ./make.shCompiling the environment
  • ./make.sh installThe installation
  • Cp/home/software/fastdfs - 6.04 / conf / * / etc/FDFS /Copy the configuration file to /etc/fdfs

Ps: View the generated startup command

2. Configure the Tracker service (153 server nodes)

  • cd /etc/fdfs/Go to the configuration file directory
  • vim tracker.confModify the tracker. Conf

  • mkdir /usr/local/fsatdfs/tracker -pCreate the base path directory
  • /usr/bin/fdfs_trackerd /etc/fdfs/tracker.confStart the FastDFS Tracker service

3. Configure the Storage Service (152 Server Nodes)

  • cd /etc/fdfs/Go to the configuration file directory
  • vim storage.confModify storage. Conf

  • mkdir /usr/local/fastdfs/storage -pCreating a Base folder

  • Keep out of
  • /usr/bin/fdfs_storaged /etc/fdfs/storage.confStart the Storage Server

4. After starting the two services, configure and test file uploading

4.1 configuration

  • Configure the client.conf file of the storage node

cd /etc/fdfs/ vim client.conf

  • mkdir /usr/local/fastdfs/client -pCreating a Base folder

4.2 test

  • wget https://img-blog.csdnimg.cn/20210328103402865.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224

Yum -y install wget yum -y install wget

  • ls 20*View the downloaded images
  • mv 20210328103402865.jpg\?x-oss-process\=image%2Fresize\,m_fixed\,h_224\,w_224 20210328103402865.jpgChange the name
  • mv 20210328103402865.jpg /home/Mobile location

Upload the image:

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/20210328103402865.jpg

  • cd /usr/local/fastdfs/storage/data/00/00

PS pay attention to item

  1. You must start the Tracker Server first and then the Storage Server. If the order is reversed, the Storage Server heartbeat cannot be sent to the Tracker Server.
  2. The default port number of the Storage Server is 8888
  3. The default port number of the Tracker Server is 22122