FastDFS Learning - Installation and Configuration

Keywords: github encoding socket

Download and Installation

Download and install libfast common

Introduction: Libfast common is an open source C-based library, which is a C-based library separated from the FastDFS project. This library is very simple and stable. Functions include: string, recorder, chain, hash, socket, ini file reader, base64 encoding/decoding, url encoding/decoding, fast timer, skiplist, object pool, etc. See the C header file for details.


tar -xvf V1.0.7.tar.gz//decompression
cd libfastcommon-1.0.7//Enter folder

//Compile and install
./ install

//Creating Soft Links
ln -s /usr/lib64/ /usr/local/lib/
ln -s /usr/lib64/ /usr/lib/
ln -s /usr/lib64/ /usr/local/lib/
ln -s /usr/lib64/ /usr/lib/ 

Download and install FastDFS


tar -xvf V5.05.tar.gz //decompression
cd fastdfs-5.05   //Enter folder

//Compile and install
./ install

To configure

After successful installation, the relevant configuration path of FastDFS is / etc/fdfs /, under which there are three. sample files, which are provided by fastDFS; tracker.conf.sample and storage.conf.sample are needed.

//tracker server tracing service configuration file
cp tracker.conf.sample tracker.conf 
//storage server storage service configuration file
cp storage.conf.sample storage.conf

Tracker configuration

vi tracker.conf

Key configuration parameters

# Whether the configuration file is not valid, false is valid

# Ports to provide services

# Tracker Data and Log Directory Address

# HTTP Service Port

After the configuration is completed:

//After configuring, you need to create the corresponding data and log directory folders, otherwise the startup will report an error.
mkidr -p /home/fastdfs

//Establishing Soft Links with Ln-S
ln -s /usr/bin/fdfs_trackerd /usr/local/bin
ln -s /usr/bin/ /usr/local/bin
ln -s /usr/bin/ /usr/local/bin

//Start up service
service fdfs_trackerd start

//View monitor
netstat -unltp|grep fdfs

Seeing the information on port 22122 represents successful startup

And the following file structure is generated under the specified path {base_path}

| |__storage_groups.dat: Storing grouping information
| |__storage_servers.dat: Storage server list
| |__trackerd.log: tracker server log file

Storage configuration

vi storage.conf

Key configuration

# Whether the configuration file is not valid, false is valid

# Specify the group (volume) for this storage server

# storage server service port

# The interval between heartbeats in seconds (in this case, to actively send a heartbeat to tracker server)

# Storage data and log directory address (root directory must exist, subdirectory will be generated automatically)

# storage server supports multiple paths when storing files. Here you configure the number of base paths to store files, usually with only one directory.

# Configure store_path_count paths one by one, with index numbers based on 0.
# If store_path0 is not configured, it will be the same path as base_path.

# FastDFS uses two levels of directory to store files. Here configure the number of directories where files are stored. 
# If this parameter is only N (e.g. 256), then the storage server automatically creates N* N subdirectories of the stored files under store_path when it first runs.

# The list of tracker_server will actively connect to tracker_server
# When there are multiple tracker servers, each tracker server writes a line

# Time period allowed for system synchronization (default is full day). It is usually set to avoid some problems caused by peak synchronization.

After configuring

//Create store_path0 specified address file, otherwise start error reporting
mkidr -p /home/fastdfs/storage

//Establishing Soft Links with Ln-S
ln -s /usr/bin/fdfs_storaged /usr/local/bin

//Start up service
service fdfs_storaged start

//View monitor
netstat -unltp|grep fdfs

See that fdfs_storage corresponds to port 23000 for successful startup

Check if Storage and Tracker are communicating

/usr/bin/fdfs_monitor /etc/fdfs/storage.conf

Posted by mikeyinsane on Tue, 08 Oct 2019 23:22:07 -0700