Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Distributed file system fastDFS deployment

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Deployment environment: (CentOS 6.9)

Tracker server:10.10.1.105

Storage server:10.10.1.106 10.10.1.107

Client:10.10.1.105

2. FastDFS: open source lightweight distributed file system

Three roles:

Tracker server: tracking servers, scheduling, recording status information of all storage groups and storage servers in memory; tracker.conf

Storage server: storage server, file (data) and file attributes (metadata), a set of servers; storage.conf

Client: the client, the initiator of the business request, interacts with tracker and storage server based on the TCP protocol through a dedicated interface; client.conf

Storage:

Group_name/M##/&&/&&/file_name

Group_name: the group name of the storage group. After the upload is completed, the client needs to save it.

Masking #: the virtual path of the server configuration, corresponding to the disk option store_path#

A two-level directory with two-digit hexadecimal names

File name: it is different from the original file name; it is generated by storage server according to specific information. The file name includes the IP address of the source storage server, file creation timestamp, file size, random number and file extension, etc.

III. Installation

1. Install the dependency package libfastcommon

2. Install fastDFS

3. Iptables and selinux need to be closed.

Installation method 1:

# git clone https://github.com/happyfish200/fastdfs.git

# git clone https://github.com/happyfish200/libfastcommon.git

# git clone https://github.com/happyfish200/fastdfs-nginx-module.git

Mv libfastcommon libfastcommon-1.0.36

Tar zcf libfastcommon-1.0.36.tar.gz libfastcommon-1.0.36

Mv fastdfs fastdfs-5.0.10

Tar zcf fastdfs-5.0.10.tar.gz fastdfs-5.0.10

Mkdir rpmbuild/ {SOURCES,SPECS}-pv

Cp / tools/libfastcommon-1.0.36.tar.gz rpmbuild/SOURCES/

Cp / tools/fastdfs-5.0.10.tar.gz rpmbuild/SOURCES/

Cp / tools/libfastcommon-1.0.36/libfastcommon.spec rpmbuild/SPECS/

Cp / tools/fastdfs-5.0.10/fastdfs.spec rpmbuild/SPECS/

Yum install rpm-build

Rpmbuild-ba libfastcommon.spec

Rpmbuild-ba fastdfs.spec

Generate rpm package and install it directly.

Installation method 2:

Tar xzf libfastcommon_v1.23.tar.gz

Cd libfastcommon

. / make.sh

. / make.sh install

Tar xzf FastDFS_v5.08.tar.gz

Cd FastDFS

. / make.sh

. / make.sh install

Test upload after the configuration of tracker and storage is completed:

# fdfs_upload_file. / client.conf / usr/share/backgrounds/centos_2048x1536_logoonly.jpg

Group1/M00/00/00/CgoBalkG2PmAThTWAAD_7aV8rDY985.jpg

Install fastdfs-nginx-module module and access files through http protocol

Note: the following two files need to be copied to the storage directory

Cp fastdfs-5.0.10/conf/ {http.conf,mime.types} / etc/fdfs/

Installing this module requires recompiling nginx

1. / configure-user=www-group=www-prefix=/usr/local/nginx-with-http_stub_status_module-with-http_ssl_module-with-http_gzip_static_module-with-http_sub_module-add-module=/root/soft/fastdfs-nginx-module/src

2. Add the following configuration to the nginx.conf file

Location ~ / group [0-9] + / M00 {

Root / home/fastdfs/data

Ngx_fastdfs_module

}

3. Ln-s / home/fastdfs/data/ home/fastdfs/data/M00

4. Configure the mod_fastdfs.conf file

Cp / root/soft/fastdfs-nginx-module/src/mod_fastdfs.conf / etc/fdfs/

Mod_fastdfs.conf key configuration items:

Tracker_server=10.10.1.105:22122

Url_have_group_name = true * enable group name access

Group_count = 1

[group1]

Group_name=group1

Storage_server_port=23000

Store_path_count=1

Store_path0=/home/fastdfs

5. Reload the nginx server

When accessing under a group name:

Location ~ / group [0-9] + / M00 {

Root / home/fastdfs/data

Ngx_fastdfs_module

}

Https://cache.yisu.com/upload/information/20200309/32/49826.jpg

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report