FastDFS图片服务器搭建-支持分布式
来源:互联网 发布:网络推广视频 编辑:程序博客网 时间:2024/05/22 05:00
如果不知道FastDFS是什么鬼的话,先去了解过了,在回来看这篇文章,本文已环境搭建为目的,勿喷!!
安装环境aliyun linux或者CentOS
用到的文件
服务名称介绍:fastdfs-tracker---跟踪服务器/调度服务器
fastdfs-storage---存储服务器
[root@fastdfs-storage ~]
# mkdir -p /home/oldcat/tools
[root@fastdfs-storage ~]
# cd /home/oldcat/tools/
以上目录可自选
1
2
3
4
5
6
7
[root@fastdfs-storage tools]
# wget https://codeload.github.com/happyfish100/libfastcommon/zip/master
[root@fastdfs-storage tools]
# unzip master
[root@fastdfs-storage tools]
# cd libfastcommon-master/
[root@fastdfs-storage libfastcommon-master]
# ls
HISTORY INSTALL libfastcommon.spec
make
.sh php-fastcommon README src
[root@fastdfs-storage libfastcommon-master]
# ./make.sh
[root@fastdfs-storage libfastcommon-master]
# ./make.sh install
1
2
3
4
[root@fastdfs-tracker tools]
# wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20PHP%20Extension%20Source%20Code%20V5.08/FastDFS_v5.08.tar.gz
[root@fastdfs-tracker tools]
# tar xf FastDFS_v5.08.tar.gz
[root@fastdfs-tracker tools]
# cd FastDFS
[root@fastdfs-tracker FastDFS]
# ./make.sh && ./make.sh install
1
2
3
[root@fastdfs-tracker ~]
# ll /etc/init.d/ |grep fdfs
-rwxr-xr-x. 1 root root 918 4月 22 22:08 fdfs_storaged
-rwxr-xr-x. 1 root root 920 4月 22 22:08 fdfs_trackerd
1
2
3
4
5
[root@fastdfs-tracker ~]
# ll /etc/fdfs/
总用量 20
-rw-r--r--. 1 root root 1461 4月 22 22:08 client.conf.sample
-rw-r--r--. 1 root root 7927 4月 22 22:08 storage.conf.sample
-rw-r--r--. 1 root root 7200 4月 22 22:08 tracker.conf.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@fastdfs-tracker ~]
# ll /usr/bin|grep fdfs
-rwxr-xr-x. 1 root root 252272 4月 22 22:08 fdfs_appender_test
-rwxr-xr-x. 1 root root 252225 4月 22 22:08 fdfs_appender_test1
-rwxr-xr-x. 1 root root 242449 4月 22 22:08 fdfs_append_file
-rwxr-xr-x. 1 root root 242013 4月 22 22:08 fdfs_crc32
-rwxr-xr-x. 1 root root 242508 4月 22 22:08 fdfs_delete_file
-rwxr-xr-x. 1 root root 243627 4月 22 22:08 fdfs_download_file
-rwxr-xr-x. 1 root root 243369 4月 22 22:08 fdfs_file_info
-rwxr-xr-x. 1 root root 255657 4月 22 22:08 fdfs_monitor
-rwxr-xr-x. 1 root root 863913 4月 22 22:08 fdfs_storaged
-rwxr-xr-x. 1 root root 258712 4月 22 22:08 fdfs_test
-rwxr-xr-x. 1 root root 257881 4月 22 22:08 fdfs_test1
-rwxr-xr-x. 1 root root 365232 4月 22 22:08 fdfs_trackerd
-rwxr-xr-x. 1 root root 243547 4月 22 22:08 fdfs_upload_appender
-rwxr-xr-x. 1 root root 244453 4月 22 22:08 fdfs_upload_file
1
2
[root@fastdfs-tracker ~]
# cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
[root@fastdfs-storage ~]
# cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
1
2
3
disabled=
false
(默认为
false
,表示是否无效)
port=22122(默认为22122)
base_path=
/data/fastdfs/tracker
1
2
base_path=
/data/fastdfs/tracker
tracker_server=39.108.5.86:22122
1
[root@fastdfs-tracker ~]
# mkdir -p /data/fastdfs/tracker
1
2
3
4
5
6
7
8
[root@fastdfs-tracker ~]
# cd /data/fastdfs/tracker/
[root@fastdfs-tracker tracker]
# ls
[root@fastdfs-tracker tracker]
# /etc/init.d/fdfs_trackerd start
Starting FastDFS tracker server:
[root@fastdfs-tracker tracker]
# ss -lntup|grep 22122
tcp LISTEN 0 128 *:22122 *:*
users
:((
"fdfs_trackerd"
,3785,5))
[root@fastdfs-tracker tracker]
# ls
data logs
1
2
3
[root@fastdfs-tracker tracker]
# /etc/init.d/fdfs_trackerd stop
waiting
for
pid [3785]
exit
...
pid [3785]
exit
.
1
[root@fastdfs-storage ~]
# cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
1
2
3
4
5
6
disabled=
false
(默认为
false
,表示是否无效)
port=23000(默认为23000)
base_path=
/data/fastdfs/storage
tracker_server=39.108.5.86:22122
store_path0=
/data/fastdfs/storage
http.server_port=8888(默认为8888,nginx中配置的监听端口那之一致)
1
[root@fastdfs-storage ~]
# mkdir -p /data/fastdfs/storage
1
2
3
4
5
6
7
8
[root@fastdfs-storage ~]
# cd /data/fastdfs/storage/
[root@fastdfs-storage storage]
# ls
[root@fastdfs-storage storage]
# /etc/init.d/fdfs_storaged start
Starting FastDFS storage server:
[root@fastdfs-storage storage]
# ss -lntup|grep 23000
tcp LISTEN 0 128 *:23000 *:*
users
:((
"fdfs_storaged"
,3786,5))
[root@fastdfs-storage storage]
# ls
data logs
1
2
3
[root@fastdfs-tracker ~]
# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/oldcat/imgs/test.jpg
group1
/M00/00/00/rBIK6VcaP0aARXXvAAHrUgHEviQ394
.jpg
返回文件ID即说明文件已经上传成功
1
2
3
4
5
6
[root@fastdfs-storage tools]
# wget http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
[root@fastdfs-storage tools]
# tar xf fastdfs-nginx-module_v1.16.tar.gz
[root@fastdfs-storage tools]
# cd fastdfs-nginx-module/src/
[root@fastdfs-storage src]
# vim config
编辑config文件,执行如下命令进行批量替换并保存退出
:%s+
/usr/local/
+
/usr/
+g
1
2
3
4
5
6
7
8
9
10
[root@fastdfs-storage ~]
# cp /home/oldcat/tools/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
[root@fastdfs-storage ~]
# vim /etc/fdfs/mod_fastdfs.conf
修改内容如下:
connect_timeout=10
base_path=
/tmp
(默认为
/tmp
)
tracker_server=39.108.5.86:22122
storage_server_port=23000(默认配置为23000)
url_have_group_name =
true
store_path0=
/data/fastdfs/storage
group_name=group1(默认配置为group1)
1
[root@fastdfs-storage nginx-1.8.1]
# yum install -y pcre-devel zlib-devel
1
2
3
4
5
[root@fastdfs-storage tools]
# wget http://nginx.org/download/nginx-1.8.1.tar.gz
[root@fastdfs-storage tools]
# tar xf nginx-1.8.1.tar.gz
[root@fastdfs-storage tools]
# cd nginx-1.8.1
[root@fastdfs-storage nginx-1.8.1]
# ./configure --prefix=/application/nginx/ --add-module=../fastdfs-nginx-module/src/
[root@fastdfs-storage nginx-1.8.1]
# make && make install
1
2
[root@fastdfs-storage ~]
# cp /home/oldcat/tools/FastDFS/conf/http.conf /etc/fdfs/
[root@fastdfs-storage ~]
# cp /home/oldcat/tools/FastDFS/conf/mime.types /etc/fdfs/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@fastdfs-storage ~]
# vim /application/nginx/conf/nginx.conf
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application
/octet-stream
;
sendfile on;
keepalive_timeout 65;
server {
listen 8888;
server_name localhost;
location ~
/group
[0-9]/ {
ngx_fastdfs_module;
}
error_page 500 502 503 504
/50x
.html;
location =
/50x
.html {
root html;
}
}
}
1
2
3
4
[root@fastdfs-storage ~]
# cp /application/nginx/sbin/nginx /etc/init.d/
[root@fastdfs-storage ~]
# /etc/init.d/nginx
[root@fastdfs-storage ~]
# ss -lntup|grep 8888
tcp LISTEN 0 128 *:8888 *:*
users
:((
"nginx"
,7308,6),(
"nginx"
,7309,6))
39.108.5.86:8888/group1
/M00/00/00/rBIK6VcaP0aARXXvAAHrUgHEviQ394
.jpg
配置完成以后就可以在我们的项目里面上传图片到图片服务器了
0 0
- FastDFS图片服务器搭建-支持分布式
- FastDFS分布式文件系统搭建图片服务器
- FastDFS 搭建图片服务器
- fastdfs图片服务器的搭建
- 使用FastDFS搭建图片服务器
- centos6.5 搭建fastdfs分布式存储图片
- fastdfs+nginx+tracker搭建互联网电商分布式图片服务器过程
- 【阿里云】【centOS7】FastDFS分布式图片服务器开发环境搭建过程
- 【FastDFS】搭建一台结构简单的FastDFS图片服务器
- 搭建FastDFS,Nginx,fastdfs-nginx-module图片资源服务器
- 图片服务器fastDFS的搭建以及配置
- Linux下FastDFS图片服务器的搭建
- linux下搭建FastDFS图片服务器
- 1、FastDFS 图片服务器的搭建
- Nginx+FastDFS图片服务器的搭建
- 分布式存储服务器FastDFS
- 分布式存储服务器FastDFS
- FastDFS集群服务器搭建
- 日期格式化(包括日期对象和字符串)
- crontab使用
- lesson6.5集合类vector和Enumeration、Collection和Iterator、Collections
- etckeeper在Ubuntu上的安装和使用
- linux c的内存映像
- FastDFS图片服务器搭建-支持分布式
- 网易之幼儿园小朋友调整队形
- Android Monkey的使用
- 解决build path 中libraries为空
- _attribute__改变段的特性,即section选项
- jquery 单选框选中事件
- 使用async-http 重定向出错 & 文字没有焦点,仍实现自滚动
- 当float和absolute和display搞在一起。。。
- 深入浅出mongoose-----包括mongoose基本所有操作,非常实用!!!!!