分布式存储fastdfs安装使用

news/2024/7/1 4:13:49

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
验证成功。


http://lihuaxi.xjx100.cn/news/236508.html

相关文章

vue中子组件和子组件之间怎么通信_vue.js组件之间如何通信?

vue.js组件之间如何通信?下面本篇文章就来给大家介绍一下Vue.js组件间通信方式。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。平时在使用Vue框架的业务开发中,组件不仅仅要把模板的内容进行复用,更…

mysql++读写BLOB数据

mysql读写BLOB数据 1、使用sql_create_n宏函数,建立数据库表字段与对象。 #define sql_create_2(NAME, CMP, CONTR, T1, I1, T2, I2) \ sql_create_complete_2(NAME, CMP, CONTR, T1, I1, #I1, T2, I2, #I2) \ //NAME:表名&#xff1…

Hibernate学习(九)———— 二级缓存和事务级别详讲

序言 这算是hibernate的最后一篇文章了,下一系列会讲解Struts2的东西,然后说完Struts2,在到Spring,然后在写一个SSH如何整合的案例。之后就会在去讲SSM,在之后我自己的个人博客应该也差不多可以做出来了。基本上先这样…

最大斑块指数怎么算_教你一个看血管硬化指数的精准公式!

随着生理年龄的增长,胆固醇、甘油三酯等成分在血管壁上越积越多,血管壁的柔韧性降低,血管硬化,血液流动受阻,最终因缺血而引起心脑血管疾病。这就是人到中老年后易与冠心病、脑中风等心脑血管病结缘的症结所在。如果你…

python爬虫知识点总结(二十三)Scrapy中Download Middleware的用法

待更新转载于:https://www.cnblogs.com/cthon/p/9424551.html

别得意,你只是假装收藏了而已

今天分享我在看罗振宇的《2018 时间的朋友》演讲视频记下的一些思考。跨年演讲中有过这样的一个来自印象笔记的片段,列举了几组对比来说明: 『你在朋友圈里又佛又丧,你在收藏夹里偷偷地积极向上。』 扎心了,这不就是说我吗&#x…

mysql 无法登陆_MySQL root用户无法登录原因及解决办法

MySQL root密码正确,却怎么也bai无法du从本地登录MySQL登录提示ERROR 1045 (28000): Access denied for user rootlocalhost (using password: YES)可能原因是mysql库中bai的user表缺少一个root指向host:localhost的数据项,只有一个root指向h…

dede 后台 mysql_织梦dedecms使用Mysql8.0无法登录后台的解决办法

1//只允许用户名和密码用0-9,a-z,A-Z,,_,.,-这些字符2$this->userName preg_replace("/[^0-9a-zA-Z_!\.-]/", , $username);3$this->userPwd preg_replace("/[^0-9a-zA-Z_!\.-]/", , $userpwd);4$pwd substr(md5($this->userPwd), 5, 20);56$d…