Using FastDFS under Linux

1, What is FastDFS

Is an open source lightweight distributed file system for file management.

Function:
File storage, file access, file upload and download.

Single storage size:
4k–500M

Benefits:
A large number of storage and load balancing problems are solved.

Use:
Suitable for file online services, such as video website, Tencent video, photo album, picture worm.

2, Single node deployment FastDFS

GCC is used to compile and run C language code. Use the yum command to install:

yum -y install gcc
The decompression command will be used later( unzip),So it can be used here yum hold unzip Install it, too
yum install -y unzip zip

Install libevent

yum -y install libevent

Install libfastcommon master

Unzip the just uploaded libfastcommon-master.zip
unzip libfastcommon-master.zip

Enter the extracted directory
cd libfastcommon-master

Compile and install:
./make.sh 
./make.sh install

Installing fastdfs

tar -zxvf FastDFS_v5.08.tar.gz

cd FastDFS

./make.sh 

./make.sh install

If this error occurs

Do the following

yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget

If the following problems occur

Recompile installation

./make.sh clean 
./make.sh 
./make.sh intall 

Check whether the installation is successful. If the installation is successful, you will see / etc / init D / see the provided script file below:

 fdfs_ Tracker is the tracker startup script

fdfs_ Stored is the storage startup script

ll /etc/fdfs/
  • tarcker.conf.sample is the configuration file template of the tracker

  • storage.conf.sample is the configuration file template for storage

  • client.conf.sample is the configuration file template for the client

 

Configure and start the tracker service

The tracker and storage of astDFS have been installed in the just installation process, so we install these two roles in the same way. The difference is that the two require different configuration files.

If we want to start the tracker, we need to modify the launcher we just saw Conf and start FDFS_ The tracker script is sufficient.

1) First copy the template file

cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf

2) Modify the copied configuration file:

vim /etc/fdfs/tracker.conf 

#The revised contents are as follows:

base_path=/nc/tracker                 # The root directory where logs and data are stored

3) New directory:

mkdir -p /nc/tracker

Note: turn off the firewall:

chkconfig iptables off

4) Start and stop

Start the tracker server: / etc / init d/fdfs_ trackerd start

Stop the tracker server: / etc / init d/fdfs_ trackerd stop

However, during the installation process, fdfs has been set as a system service. We can use the familiar service startup method:

service fdfs_trackerd start # Start FDFS_ Tracker service, stop using stop

Check whether the FastDFS Tracker Server started successfully:

ps -ef | grep fdfs_trackerd

Set the tracker service startup:

chkconfig fdfs_trackerd on

1.1.6. Configure and start the storage service

1) First copy the template file

cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf

2) Modify the copied configuration file:

vim /etc/fdfs/storage.conf

#The amendments are as follows:

base_path=/nc/storage                 # Data and log file storage root directory 
​
store_path0=/nc/storage           # First storage directory 
​
tracker_server=192.168.83.11:22122       #  tracker server IP and port 

3) New directory:

mkdir -p /nc/storage

Note: close the firewall: chkconfig iptables off

4) Start and stop

Start the storage server: / etc / init d/fdfs_ storaged start

Stop the storage server: / etc / init d/fdfs_ storaged stop

Recommended:

service fdfs_storaged start  # Start FDFS_ Stored service, stop

Set storage service startup:

chkconfig fdfs_storaged on

ps -ef | grep fdfs

Keywords: Linux FastDFS tracker

Added by rockyracoon on Mon, 03 Jan 2022 11:30:33 +0200