分布式存储fastdfs安装使用

简介: 分布式存储fastdfs安装使用

1.下载地址https://github.com/happyfish100/fastdfs
https://github.com/happyfish100/fastdfs/wiki安装辅助说明文档
2.安装编译环境
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y
三台主机:
172.18.224.100(tracker,client)
172.18.224.101(storage)
172.18.224.100(storage)
3.创建数据存储目录
mkdir /dfs
4.安装libfatscommon
git clone https://github.com/happyfish100/libfastcommon.git --depth 1
cd libfastcommon/
./make.sh && ./make.sh install #编译安装
1
5.安装FastDFS
git clone https://github.com/happyfish100/fastdfs.git --depth 1
./make.sh && ./make.sh install #编译安装
cd fastdfs/conf
2
6.复制两个nginx访问时使用到的配置文件
cp http.conf /etc/fdfs/
cp mime.types /etc/fdfs/
7.
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf #客户端文件,测试用
8.172.18.224.100编辑/etc/fdfs/tracker.conf:
base_path=/dfs/tracker ###自己定义的tracker目录
mkdir /dfs/tracker start
/etc/init.d/fdfs_trackerd start
9.172.18.224.101,172.18.224.102 编辑/etc/fdfs/storage.conf
base_path=/dfs/storage ###storage主目录
store_path0=/dfs/storage/0 ###存贮目录
tracker_server=172.18.224.100:22122
http.server_port=8080 ##与tracker文件保持一致
/etc/init.d/fdfs_storaged start ##启动storaged
3
10.查看fdfs是否安装成功:
fdfs_monitor /etc/fdfs/storage.conf4
11.编辑client端配置文件:
vim /etc/fdfs/client.conf
base_path=/dfs/client
mkdir -pv /dfs/clinet
12.上传文件:
fdfs_upload_file
5
fdfs_upload_file /etc/fdfs/client.conf /etc/fstab
查看文件信息fdfs_file_info /etc/fdfs/client.conf group1/M00/00/00/rBLgZVwwaiqAFIG_AAABOWqC2ow1549165
13.下载文件
fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/rBLgZVwwaiqAFIG_AAABOWqC2ow1549165 /tmp/fs
14.172.18.224.101,102安装fastdfs-nginx-module
git clone https://github.com/happyfish100/fastdfs-nginx-module.git
/root/fastdfs-nginx-module/src
cp mod_fastdfs.conf /etc/fdfs/
15.安装nginx:
yum install pcre-devel openssl-devel ##安装依赖包
wget http://nginx.org/download/nginx-1.15.4.tar.gz ##下载nginx
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ #添加fastdfs-nginx-module模块
make && make install #编译安装
16.配置nginx:
vim /etc/fdfs/mod_fastdfs.conf

需要修改的内容如下

tracker_server=192.168.52.1:22122 #tracker服务器IP和端口
url_have_group_name=true
store_path0=/home/dfs

配置nginx.config

vim /usr/local/nginx/conf/nginx.conf

添加如下配置

server {

listen       8888;    ## 该端口为storage.conf中的http.server_port相同
server_name  localhost;
location ~/group[0-9]/ {
    ngx_fastdfs_module;
}

}
如果服务器存在多个nginx:
/usr/local/nginx/sbin/nginx -c /usr/local/src/nginx-1.15.4/conf/nginc.conf

注意,必须要保证已经从fastdfs/conf复制了http.conf与mime.types文件至/etc/fdfs/

6
17.使用curl命令验证fastdfs存储的文件是否可以通过http协议访问:
先随便上传一个文件 fdfs_upload_file /etc/fdfs/client.conf /etc/fstab

curl http://172.18.224.101:8888/group1/M00/00/00/rBLgZlwwd9OAWZztAAABOWqC2ow7681129
7
验证成功。

目录
相关文章
|
存储 负载均衡 架构师
分布式存储FastDFS介绍
分布式存储FastDFS介绍
898 0
分布式存储FastDFS介绍
|
3月前
|
存储 负载均衡 应用服务中间件
FastDFS单机版环境搭建
FastDFS单机版环境搭建
59 0
|
存储 负载均衡 网络协议
fastdfs部署
FastDFS 是一个开源的高性能分布式文件系统。它的主要功能包括:文件存储、文件同步和文件访问(文件上传和文件下载),它可以解决高容量和负载均衡问题。FastDFS应该能满足图片分享网站、视频分享网站等以文件为基础服务的网站的要求。 FastDFS有两个角色:tracker和storage。跟踪器负责文件访问的调度和负载均衡。storage 存储文件,其功能是文件管理,包括:文件存储,文件同步,提供文件访问接口。它还管理元数据,这些元数据是表示文件键值对的属性。例如:width=1024,键为“width”,值为“1024”
295 0
fastdfs部署
|
存储 应用服务中间件 网络安全
分布式文件存储系统fastdfs安装教程(下)
分布式文件存储系统fastdfs安装教程
分布式文件存储系统fastdfs安装教程(下)
|
存储 负载均衡 调度
分布式文件服务器FastDFS介绍
分布式文件服务器FastDFS介绍
329 0
分布式文件服务器FastDFS介绍
|
存储 应用服务中间件 Linux
CentOS7中 nginx 搭建 FastDFS 分布式文件存储系统
CentOS7中 nginx 搭建 FastDFS 分布式文件存储系统
CentOS7中 nginx 搭建 FastDFS 分布式文件存储系统
|
存储 分布式计算 Hadoop
【FastDFS】FastDFS 分布式文件系统的安装与使用,看这一篇就够了!!
有不少小伙伴在实际工作中,对于如何存储文件(图片、视频、音频等)没有一个很好的解决思路。都明白不能将文件存储在单台服务器的磁盘上,也知道需要将文件进行副本备份。如果自己手动写文件的副本机制,那就太麻烦了,这会涉及冗余副本机制、服务器的调度、副本检测、服务器节点检测、文件副本存放策略、网络环境检测等等一系列的难题。了解Hadoop的小伙伴,会自然而然的想到HDFS,
305 0
【FastDFS】FastDFS 分布式文件系统的安装与使用,看这一篇就够了!!
FastDFS - 开源的分布式文件系统
FastDFS 是一个开源的分布式文件系统,她对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等
842 0
|
存储 应用服务中间件 开发工具
FastDFS部署及使用简介
整理了近期在项目上做的一些技术研究,希望与大家共同探讨交流。 在项目中经常推荐客户选择分布式文件存储服务,并且使用阿里云的OSS服务,但也遇到过客户是私有云无法使用OSS或者客户要求必须提供非阿里云方案的情况。
7395 0