FastDFS 安装部署

简介:

#

#FastDFS Github地址:https://github.com/happyfish100/fastdfs

#FastDFS 简介:http://www.oschina.net/p/fastdfs/

#分布式文件系统及FastDFS : https://chulung.com/article/22

#分布式架构高可用架构篇:http://www.cnblogs.com/hujihon/p/5709556.html

#实验拓扑图(逻辑图)

wKiom1jzKKzTSFoMAAAV-CMt4xg915.png



#软件下载

#

#libfastcommon  下载地址: https://github.com/happyfish100/libfastcommon/archive/master.zip

#FastDFS:下载地址: https://github.com/happyfish100/fastdfs/archive/master.zip

#


安装(三台主机都要安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@Storage_1  ~] # yum install -y gcc-c++
[root@Storage_1 ~] #  wget https://github.com/happyfish100/libfastcommon/archive/master.zip
[root@Storage_1 ~] # unzip master.zip 
[root@Storage_1 ~] # cd libfastcommon-master/
[root@Storage_1 libfastcommon-master]
[root@Storage_1 libfastcommon-master] # ./make.sh 
[root@Storage_1 libfastcommon-master] # ./make.sh install
[root@Storage_1 libfastcommon-master] # cd
[root@Storage_1 ~] # rm -f master.zip 
[root@Storage_1 ~] # wget https://github.com/happyfish100/fastdfs/archive/master.zip 
[root@Storage_1 ~] # unzip master.zip 
[root@Storage_1 ~] # cd fastdfs-master/
[root@Storage_1 fastdfs-master] # ./make.sh 
[root@Storage_1 fastdfs-master] # ./make.sh install



#修改配置文件

#

#

#备份Trcaker文件

#在tracker 上操作

1
2
[root@Tracker ~] # cp  /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
[root@Tracker ~] # cp /etc/fdfs/tracker.conf.sample  /etc/fdfs/tracker.conf

#修改tracker

1
2
3
4
[root@Tracker ~] # vim /etc/fdfs/tracker.conf
#修改如下值
base_path= /data/fdfs/Tracker     #第22行
http.server_port=80        #第260行
1
[root@Tracker ~] # mkdir /data/fdfs/Tracker -p


#修改客户端

1
2
3
4
[root@Tracker ~] # vim /etc/fdfs/client.conf
base_path=  /data/fdfs/client           #第11行
tracker_server=192.168.174.136:22122      #第15行
[root@Tracker ~] # mkdir /data/fdfs/client -p


#启动服务

1
[root@Tracker ~] # service fdfs_trackerd start




#在storage上操作(两台Storage上同时操作

1
2
3
4
5
6
7
8
[root@Storage_2 ~] # cp  /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
[root@Storage_2 ~] # vim /etc/fdfs/storage.conf
#修改为如下
base_path= /data/fdfs/Storage     #第41行
store_path0= /data/fdfs/Storage         #第109行
tracker_server=192.168.174.136:22122    #第118行
[root@Storage_2 ~] # mkdir /data/fdfs/Storage -p
[root@Storage_2 ~] # service  fdfs_storaged  start



#检查状态

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
[root@Tracker ~] # fdfs_monitor /etc/fdfs/client.conf 
[2017-04-16 21:42:51] DEBUG - base_path= /data/fdfs/client , connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server  id  count: 0
server_count=1, server_index=0
tracker server is 192.168.174.136:22122
group count: 1
Group 1:
group name = group1
disk total space = 17718 MB
disk  free  space = 16341 MB
trunk  free  space = 0 MB
storage server count = 2
active server count = 2
storage server port = 23000
storage HTTP port = 8888
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk  file  id  = 0
Storage 1:
id  = 192.168.174.137
ip_addr = 192.168.174.137 (Storage_1)  ACTIVE
http domain = 
version = 5.10
join  time  = 2017-04-16 21:12:37
up  time  = 2017-04-16 21:12:37
total storage = 17718 MB
free  storage = 16341 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source  storage  id 
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 1
connection.max_count = 1
total_upload_count = 0
success_upload_count = 0
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 0
success_upload_bytes = 0
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 0
success_sync_in_bytes = 0
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 0
success_file_open_count = 0
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 0
success_file_write_count = 0
last_heart_beat_time = 2017-04-16 21:42:36
last_source_update = 1970-01-01 08:00:00
last_sync_update = 1970-01-01 08:00:00
last_synced_timestamp = 1970-01-01 08:00:00 
Storage 2:
id  = 192.168.174.138
ip_addr = 192.168.174.138 (Storage_2)  ACTIVE
http domain = 
version = 5.10
join  time  = 2017-04-17 06:13:42
up  time  = 2017-04-17 06:13:42
total storage = 17718 MB
free  storage = 16432 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source  storage  id  = 192.168.174.137
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 1
connection.max_count = 1
total_upload_count = 0
success_upload_count = 0
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 0
success_upload_bytes = 0
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 0
success_sync_in_bytes = 0
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 0
success_file_open_count = 0
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 0
success_file_write_count = 0
last_heart_beat_time = 2017-04-16 21:42:46
last_source_update = 1970-01-01 08:00:00
last_sync_update = 1970-01-01 08:00:00
last_synced_timestamp = 1970-01-01 08:00:00


#测试上传

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@Tracker ~] # fdfs_test /etc/fdfs/client.conf upload /root/text.txt 
This is FastDFS client  test  program v5.10
Copyright (C) 2008, Happy Fish / YuQing
FastDFS may be copied only under the terms of the GNU General
Public License V3,  which  may be found  in  the FastDFS  source  kit.
Please visit the FastDFS Home Page http: //www .csource.org/ 
for  more  detail.
[2017-04-16 21:45:44] DEBUG - base_path= /data/fdfs/client , connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server  id  count: 0
tracker_query_storage_store_list_without_group: 
server 1. group_name=, ip_addr=192.168.174.137, port=23000
server 2. group_name=, ip_addr=192.168.174.138, port=23000
group_name=group1, ip_addr=192.168.174.137, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00 /00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656 .txt
source  ip address: 192.168.174.137
file  timestamp=2017-04-16 21:46:18
file  size=6
file  crc32=1998380320
example  file  url: http: //192 .168.174.137 /group1/M00/00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656 .txt
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00 /00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656_big .txt
source  ip address: 192.168.174.137
file  timestamp=2017-04-16 21:46:18
file  size=6
file  crc32=1998380320
example  file  url: http: //192 .168.174.137 /group1/M00/00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656_big .txt

#从上面的输出可以看到文件被上传到了 00/00目录下面,可以去看一下

1
2
3
4
5
[root@Storage_1 ~] # cd /data/fdfs/Storage/data/
[root@Storage_1 data] # ls
[root@Storage_1 data] # cd 00
[root@Storage_1 00] # cd 00
[root@Storage_1 00] # ls










本文转自 chaunceyjiang  51CTO博客,原文链接:http://blog.51cto.com/cqwujiang/1916493,如需转载请自行联系原作者
目录
相关文章
|
3月前
|
存储 负载均衡 应用服务中间件
FastDFS单机版环境搭建
FastDFS单机版环境搭建
59 0
|
1月前
|
存储 负载均衡 容灾
Fastdfs安装与配置
Fastdfs安装与配置
|
存储 应用服务中间件 Linux
CentOS7 部署安装FastDFS多机版(二)——分布式配置FastDFS
CentOS7 部署安装FastDFS多机版(二)——分布式配置FastDFS
110 0
CentOS7 部署安装FastDFS多机版(二)——分布式配置FastDFS
|
存储 负载均衡 应用服务中间件
CentOS7 部署安装FastDFS多机版(一)——安装FastDFS
CentOS7 部署安装FastDFS多机版(一)——安装FastDFS
179 0
CentOS7 部署安装FastDFS多机版(一)——安装FastDFS
|
存储 负载均衡 网络协议
fastdfs部署
FastDFS 是一个开源的高性能分布式文件系统。它的主要功能包括:文件存储、文件同步和文件访问(文件上传和文件下载),它可以解决高容量和负载均衡问题。FastDFS应该能满足图片分享网站、视频分享网站等以文件为基础服务的网站的要求。 FastDFS有两个角色:tracker和storage。跟踪器负责文件访问的调度和负载均衡。storage 存储文件,其功能是文件管理,包括:文件存储,文件同步,提供文件访问接口。它还管理元数据,这些元数据是表示文件键值对的属性。例如:width=1024,键为“width”,值为“1024”
295 0
fastdfs部署
|
存储 Java Linux
FastDFS 安装与配置| 学习笔记
快速学习 FastDFS 安装与配置。
125 0
FastDFS 安装与配置| 学习笔记
|
应用服务中间件 nginx
FastDFS&Nginx分布式文件系统安装教程
FastDFS&Nginx分布式文件系统安装教程
301 0
FastDFS&Nginx分布式文件系统安装教程
|
存储 应用服务中间件 Linux
CentOS7中 nginx 搭建 FastDFS 分布式文件存储系统
CentOS7中 nginx 搭建 FastDFS 分布式文件存储系统
CentOS7中 nginx 搭建 FastDFS 分布式文件存储系统
|
存储 负载均衡 应用服务中间件
【FastDFS】小伙伴们说在CentOS 8服务器上搭建FastDFS环境总报错?
在【冰河技术】微信公众号的【分布式存储】专题中,我们分别搭建了单节点FastDFS环境和高可用FastDFS集群环境。但是,之前的环境都是基于CentOS 6.8服务器进行搭建的。很多小伙伴反馈说:自己在CentOS 8服务器上,按照我写的文章搭建FastDFS环境时,会失败!看到小伙伴们的这些问题,我今天就给大家分享下如何在CentOS 8服务器上搭建FastDFS环境。
179 0
【FastDFS】小伙伴们说在CentOS 8服务器上搭建FastDFS环境总报错?
|
存储 应用服务中间件 开发工具
FastDFS部署及使用简介
整理了近期在项目上做的一些技术研究,希望与大家共同探讨交流。 在项目中经常推荐客户选择分布式文件存储服务,并且使用阿里云的OSS服务,但也遇到过客户是私有云无法使用OSS或者客户要求必须提供非阿里云方案的情况。
7394 0