FastDFS environment construction

1. Description

1) Install tracker (tracking server) and storage (storage server) on two Linux servers respectively.
Tracker: 192.168.48.128
storage: 192.168.48.129
2) Install resource package list
FastDFS_v5.08.tar.gz
libfastcommon-master.zip
fastdfs -nginx-module_v1.16.tar.gz
nginx-1.8.0.tar.gz
3) The installation packages are uploaded to the current user temp/ directory
4) Tracker Server and Storage Server installation steps are the same

Two, FastDFS basic environment installation

2.1, installation dependencies

yum install -y make cmake gcc gcc-c++

2.2. Decompress the FastDFS core library

cd /root/temp 
unzip libfastcommon-master.zip -d /usr/local/fastdfs

2.3, compile and install

cd /usr/local/fastdfs/libfastcommon-master
./make.sh
./make.sh install

2.4, create a soft connection

ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/local/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/local/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so

2.5. Decompress the FastDFS main program

cd /root/temp
tar -zxf FastDFS_v5.08.tar.gz -C /usr/local/fastdfs

2.6, configuration modification

cd /usr/local/fastdfs/FastDFS
vi /usr/local/fastdfs/FastDFS/make.sh

TARGET_PREFIX=$DESTDIR/usrTo TARGET_PREFIX=$DESTDIR/usr/local
this alternative, the default installation path installed in a cluster environment;

2.7, compile and install

./make.sh
./make.sh instal

Note: After
installation, the location of the main FastDFS program is as follows
/usr/local/bin: the location of the executable file (installed in /usr/bin by
/etc/fdfsdefault);: the location of the configuration file (default location)
/usr/local/lib64;: the location of the main program code (default in /usr/ bin)
/usr/local/include/fastdfs;: the location of some included plug-in groups (default in /usr/include/fastdfs);

2.8, resource view

2.8.1, service script

In the /etc/init.d/ directory, the script files are-fdfs-storaged and fdfs-trackerd

ls /etc/init.d/ | grep fdfs

2.8.2, configuration file template

In the /etc/fdfs/ directory, the configuration file is as follows
client.conf.sample (command line client, you can test the validity of FastDFS through the command line)
storage.conf.sample
tracker.conf.sample

ls /etc/fdfs/

2.8.3, built-in commands

/usr/local/bin/ directory. There are several commands, and FastDFS can be accessed on the console through commands;

ls /usr/local/bin/ | grep fdfs

Three, tracker basic configuration

3.1, create a tracking service configuration file

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

3.2, modify the configuration file

vi /etc/fdfs/tracker.conf

base_path=/home/yuqing/fastdfsbase_path=/fastdfs/tracker
Change to base_path to be the root directory used after FastDFSTracker is started to store data and logs; the
default service port is 22122;

3.3, create a custom directory

Back to the root directory

mkdir -p /fastdfs/tracker

3.4, modify the startup service script

vi /etc/init.d/fdfs_trackerd

PRG=/usr/bin/fdfs_trackerdToPRG=/usr/local/bin/fdfs_trackerd

3.5, commonly used commands

3.5.1, start the service

/etc/init.d/fdfs_trackerd start

After a successful startup, the FastDFS service-related data directories (data directory, logs directory) appear in the directory pointed to by base_path in the configuration file

3.5.2, view service status

/etc/init.d/fdfs_trackerd status
ps aux | grep fdfs

3.5.3, stop service

/etc/init.d/fdfs_trackerd stop

3.5.4, restart the service

/etc/init.d/fdfs_trackerd restart

3.5.5, set boot up

vi /etc/rc.d/rc.local

New content: /etc/init.d/fdfs_trackerd start

Four, storage basic configuration

4.1. Create a storage service configuration file

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

4.2, modify the configuration file

vi /etc/fdfs/storage.conf

base_path=/home/yuqing/fastdfsInstead base_path=/fastdfs/storage/base
store_path0=/home/yuqing/fastdfschanged to store_path0=/fastdfs/storage/store
tracker_server=192.168.2.109:22122read tracker_server=tracker 服务 IP:22122
base_path: the base path for storing basic data storage server log directory content and content;
store_path0: storage path, for storing files in the directory FastDFS save, is to create a 256 * 256 subdirectories Location; base_path and store_path0 can use the same directory;
tracker_server: tracking server location, that is, tracking server's ip and port

4.3, create a custom directory

Back to the root directory

mkdir -p /fastdfs/storage/base
mkdir -p /fastdfs/storage/store

4.4, modify the service script

vi /etc/init.d/fdfs_storaged

PRG=/usr/bin/fdfs_storagedToPRG=/usr/local/bin/fdfs_storaged

4.5. Common commands

4.5.1 Start the service

1) The tracker service must be started;
2) Ensure that the port firewalls of the two servers are enabled;
firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --reload

/etc/init.d/fdfs_storaged start

4.5.2, view service status

/etc/init.d/fdfs_storaged status
ps aux | grep fdfs

4.5.3, stop service

/etc/init.d/fdfs_storaged stop

4.5.4, restart the service

/etc/init.d/fdfs_storaged restart

4.5.5, set to start automatically

vi /etc/rc.d/rc.local

New content /etc/init.d/fdfs_storaged start (because the prerequisite for startup is that the tracker service must be started, it is not recommended to enable self-starting)

Guess you like

Origin blog.csdn.net/shaixinxin/article/details/107903897