FastDFS installation tutorial (Single Version)

Learning "studies on" when needed fastdfs, what is not said, are the tears, security for two days to get it, here draws on the writings of two big God will eventually attach and get started

Preparation Before Installation

(1) Environmental CentOS7, first download all the tools needed

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

(2) all of the tools built screenshots

Link: https: //pan.baidu.com/s/1t-ZwmqtanT4Q4LHrQaQzhA extraction code: o7xv 

(3) create a good tracker and storage folders

mkdir -p /home/mm/fastdfs/tracker
mkdir -p /home/mm/fastdfs/storage

start installation

I put all the files are uploaded to the / usr / local again, and all of you

(1) Installation libfastcommon

unzip libfastcommon-master.zip

cd libfastcommon-master

Compile make.sh

The installation make.sh install

 

Perform a soft link

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


(2) Installation FastDFS

Back to / usr / local

Implementation of tar -zxvf fastdfs-5.11.tar.gz

cd fastdfs-5.11

./make.sh

./make.sh install

 

View executable commands

ls -la /usr/bin/fdfs*

Next, continue

[root@localhost sbin]# cd /etc/fdfs/
[root@localhost fdfs]# ll
-rw-r--r--. 1 root root  1461 6月  24 13:19 client.conf.sample
-rw-r--r--. 1 root root  7927 6月  24 13:19 storage.conf.sample
-rw-r--r--. 1 root root  7389 6月  24 13:19 tracker.conf.sample

 

We need these three examples to copy a document, remove the sample

cp client.conf.sample client.conf
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf

This ~ FastDFS end of the installation. 

(3) Configuration Service Tracker

Edit tracker.conf: vi tracker.conf, modify the relevant parameters

base_path=/home/mm/fastdfs/tracker  #tracker存储data和log的跟路径,必须提前创建好
http.server_port=80 #http端口,需要和nginx相同

Start tracker command is as follows.

service fdfs_trackerd start

If you can not successfully started, you can order through systemctl

systemctl start fdfs_trackerd

 

After the success can be seen

[root@localhost fdfs]# service fdfs_trackerd start
Starting fdfs_trackerd (via systemctl):                    [  OK  ]

 

So then we can not always start tracker, we need to join startup tracker

We first need to execute permissions,

chmod + x /etc/rc.d/rc.local
then start to modify rc.local


vi /etc/rc.d/rc.local
In the last increase under the last sentence to profile

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
service fdfs_trackerd start


Save, and then view the tracker port listening situation

[root @ localhost fastdfs_tracker] # netstat -unltp | grep FDFS
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 7850 / fdfs_trackerd
this port 22122 listens success.

(4) Configuration Storage Service

vi /etc/fdfs/storage.conf, modify the relevant parameters:

base_path=/home/mm/fastdfs/storage   #storage存储data和log的跟路径,必须提前创建好
store_path0=/home/mm/fastdfs/storage  #如果为空,则使用base_path
tracker_server=192.168.1.134:22122 #配置该storage监听的tracker的ip和port

Create a soft references after saving

ln -s /usr/bin/fdfs_storaged /usr/local/bin

Start storage

service fdfs_storaged start


Similarly, if the command can not be started can be represented by the following

systemctl start fdfs_storaged


Success should be as follows

[root@localhost fdfs]# service fdfs_stroaged start
Starting fdfs_storaged (via systemctl):                    [  OK  ]

Also set the boot

Modify rc.local

vim /etc/rc.d/rc.local

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
service fdfs_trackerd start
service fdfs_storaged start


Also see if the service starts

[root@localhost 00]# netstat -unltp | grep fdfs
tcp        0      0 0.0.0.0:22122           0.0.0.0:*               LISTEN      7850/fdfs_trackerd  
tcp        0      0 0.0.0.0:23000           0.0.0.0:*               LISTEN      8077/fdfs_storaged


Service starts, this fastdfs has been done! Finally, we again confirm, storage is registered to the tracker to go. 

/ usr / bin / fdfs_monitor /etc/fdfs/storage.conf
After the success can be seen: 

 

= 192.168.150.132 ip_addr (localhost.localdomain)  the ACTIVE words
 

 

Guess you like

Origin blog.csdn.net/lil_a/article/details/94720875