The fastDFS file management system is deployed under linux

1 Overview

        The fastDFS distributed file system includes three main parts: tracker, storage node, and client, which can use file storage, file synchronization, file access and other functions to store large-capacity data

        Storage node cluster:

                Scale out: increase storage capacity

                Vertical expansion: realize data backup

                Implementation: by modifying the configuration file

2. Tool download

        Fastdfs package download website: Releases happyfish100/fastdfs GitHub , official website address                  

        libfastcommon-master package download: 【Download address】

Upload the above two packages to the linux server for decompression

#解压 tar.gz包
tar zxvf + tar.gz包
#解压 zip 包
unzip + zip包

After decompression, enter the decompressed file and execute the following command

#进入到 libfastcommon 文件
./make.sh
sudo ./make.sh install

#进入到 fastdfs 文件
./make.sh
sudo ./make.sh install

3. Configuration file

      Some files that configuration items can resolve: in this blog

        Enter the /etc/fdfs/ directory, there are the following files

       Note: The configured path is created first

 1. Configure tracker information tracker

1.使用命令复制tracker.conf.sample该文件,在tracker.conf里进行配置
cp tracker.conf.sample tracker.conf

        information configuration

2. Configure storage node information storage

使用命令复制storage.conf.sample该文件,在storage.conf里进行配置
cp storage.conf.sample storage.conf

        information configuration

#预留磁盘空间大小的配置项,默认是10%
reserved_storage_space = 10%

         If the reserved space of the reserved_storage_space configuration item is larger than the free space of the virtual machine, the following error will be reported

[2022-08-17 02:13:27] ERROR - file: tracker_proto.c, line: 48, server: 192.168.174.138:22122, response status 28 != 0
[2022-08-17 02:13:27] ERROR - file: ../client/tracker_client.c, line: 907, fdfs_recv_response fail, result: 28
tracker_query_storage fail, error no: 28, error info: No space left on device

That is, the disk space is insufficient, you can use the command df -h * to view the free space

 Modify the reserved_storage_space configuration item according to the free space

 3. Client configuration information client

使用命令复制client.conf.sample该文件,在client.conf里进行配置
cp client.conf.sample client.conf

4. Upload, download and delete files

        1. Start the tracker tracker

启动命令
fdfs_trackerd /etc/fdfs/tracker.conf
关闭命令
fdfs_trackerd /etc/fdfs/tracker.conf stop
重启命令
fdfs_trackerd /etc/fdfs/tracker.conf restart

        2. Start the storage node

启动命令
fdfs_storaged /etc/fdfs/storage.conf
关闭命令
fdfs_storaged /etc/fdfs/storage.conf stop
重启命令
fdfs_storaged /etc/fdfs/storage.conf restart

        3. Status view

There are usually seven states of storage server:

state meaning
INIT Initialization, the source server that has not yet synchronized existing data
WAIT_SYNC Waiting for synchronization, the source server with existing data has been synchronized
SYNCING synchronizing
DELETED Deleted, the server is removed from this group
OFFLINE offline
ONLINE online, service not yet available
ACTIVE online, service available
命令
fdfs_monitor /etc/fdfs/client.conf

       4. Upload, download and delete files

上传命令
fdfs_upload_file /etc/fdfs/client.conf 指定上传的文件路径
下载命令
fdfs_download_file /etc/fdfs/client.conf 指定要下载的文件路径
删除命令
fdfs_delete_file /etc/fdfs/client.conf 指定要删除的文件路径

overall test

         5. Explanation of the file id of the uploaded file

1. group1:

        Indicates which group of the storage node the file is uploaded to

        The name of this group is variable if there are multiple groups

2. M00: is a virtual directory

        There is a mapping with the configuration item of the storage node: store_path0=/home/yuqing/data -> M00

3. 00/00: The actual storage path is variable

Guess you like

Origin blog.csdn.net/weixin_62859191/article/details/130139299