Fastdfs Distributed File System Installation and Configuration ubuntu

**

Fastdfs configuration installed Ubuntu environment

**

FastDFS [A]:
This article Contents:
I. Introduction
two, FastDFS introduce
three, FastDFS download and install
four storage configuration tracker with
five test
VI Summary
a Preface:
This article implements installation, testing FastDFS the
system environment: ubantu16.04
FastDFS version: 5.0.5
two , FastDFS introduce FastDFS is lightweight open source distributed file system implemented by the C language, its file management features include: file storage, file synchronization, file access (file upload, download ) and so on; solve the problem of mass storage and load balancing. Particularly suitable for the carrier to file online services. Such as photo album site, video sites, and more.
// similar distributed file as well as Google's GFS, HDFS (Hadoop), TFS ( Taobao)
// FastDFS has two roles: Tracker (tracker), Storage (storage node)
// Tracker: main job is to dispatch, for load balancing role; and is responsible for managing all of the Storage Group, Storage after each restart will connect Tracker, inform the Group they belong, and keep the heartbeat cycle.
// Storage: storage node, the main and backup capacity to provide services; in Group units, each the Storage Group may have multiple, data backup each other.
Chart official: the
Here Insert Picture Description
paper architecture is two servers: a Tracker, a Storage
Tracker: 172.16.18.64
Storage:172.16.18.58

Three , FastDFS installation (two servers to be installed)
1, download and install libfastcommon
due fastdfs5.0.5 rely libfastcommon, install libfastcommon
Download: Download this article in / opt / fastdfs file, the command:

wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz

Here Insert Picture Description
Decompression libfastcommon, the command:

tar -zxvf V1.0.7.tar.gz

Compiled into libfastcommon-1.0.7 directory, the command:

cd libfastcommon-1.0.7
  ./make.sh

Here Insert Picture Description
Installation, the command:

 ./make.sh install

Here Insert Picture Description
As FIG display, libfastcommon successful installation
provided soft connection, the command:

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. Download and install download FastDFS ,
the command:

wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz

Here Insert Picture Description
Decompression FastDFS, the command:

tar -zxvf V5.05.tar.gz

Compiled into fastfds-5.05 directory, the command:

cd fastdfs-5.05
./make.sh

Here Insert Picture Description
Installation, the command:

./make.sh install

Here Insert Picture Description
As FIG display, the installation was successful FastDFS
four, arranged Tracker and Storage
After FastDFS the installation is successful, the / etc directory will have a directory FDFS into FDFS, .sample suffix you will find three sample file.
1, the configuration Tracker server (herein used 172.16.18.64)
in the / etc / fdfs directory, modify tracker.conf, the command:

cp tracker.conf.sample tracker.conf
   vim tracker.conf

Here Insert Picture Description
Open tracker.conf, at the following modifications:

 # the base path to store data and log files
base_path=/data/fastdfs/tracker

Of course the premise is, you must first create / data / fastdfs / tracker directory, the command:

mkdir -p /data/fastdfs/tracker

Save changes, start the tracker service, the command:

fdfs_trackerd /etc/fdfs/tracker.conf start

Similar command, closing the tracker service:

fdfs_trackerd /etc/fdfs/tracker.conf stop

After starting tracker service, see the monitor, the command:

netstat -unltp|grep fdfs

Here Insert Picture Description
tracker默认端口22122
查看/data/fastdfs/tracker目录文件,发现多出两个文件,用来存放数据和日志的
Here Insert Picture Description
至此tracker跟踪器安装成功。
2、配置Storage服务器(172.16.18.58)
同样进入/etc/fdfs目录下,命令:

cp storage.conf.sample storage.conf
vim storage.conf

Here Insert Picture Description
打开storage.conf,修改如下处:

# the base path to store data and log files
base_path=/data/fastdfs/storage
# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
store_path0=/data/fastdfs/storage
# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
#配置tracker跟踪器ip端口
tracker_server=172.16.18.64:22122

当然前提是,首先要创建/data/fastdfs/storage目录,命令:

mkdir -p /data/fastdfs/storage

修改保存后,启动storage服务,命令:(可能会有点慢)

fdfs_storaged /etc/fdfs/storage.conf start

启动有错误,可以通过/data/fastdfs/storage/logs查看
查看/data/fastdfs/storage下文件内容,生成logs、data两个目录
Here Insert Picture Description
查看下端口监听,命令:

netstat -unltp|grep fdfs

Here Insert Picture Description
storage默认端口23000
至此Storage存储节点安装成功。

所有存储节点都启动之后,可以在任一存储节点上使用如下命令查看集群的状态信息:

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

Here Insert Picture Description
过上两图可以看到,两台storage都为Active,配置成功
五、测试上传文件
台服务器随便选择一台服务器,这里我选择172.16.18.58 服务器
同样进入/etc/fdfs目录,编译client.conf,命令如下:

cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
vim /etc/fdfs/client.conf

修改如下:

# the base path to store log files
base_path=/data/fastdfs/client

# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
#配置tracker跟踪器ip端口
tracker_server=192.168.7.73:22122

同样前提是,首先要创建/data/fastdfs/client目录,命令:

mkdir -p /data/fastdfs/client

上传/opt目录的一张图片(名为:14.jpg,需提前将照片放到目录下),命令:

fdfs_test /etc/fdfs/client.conf upload /opt/14.jpg

Here Insert Picture Description
As shown above, a successful upload,
respectively, into the two storage server directory / data / fastdfs data / 00/ 00 at / storage /, can be found, save the file successfully
Here Insert Picture Description
so far, the test is successful file upload it! ! !

VI Summary Benpian
introduced FastDFS on ubantu installation, testing.
If the bad place where to write, please leave a message or a private letter. . . .

Readily point to praise, it is the traditional Chinese virtues, thank you

Released four original articles · won praise 5 · views 72

Guess you like

Origin blog.csdn.net/weixin_45565155/article/details/103961060