【FastDFS】FastDFS在CentOS的搭建
准备安装软件
[root@blog third_package]# cp fastdfs-nginx-module_v1.16.tar.gz FastDFS_v5.08.tar.gz libfastcommon-master.zip nginx-1.8.0.tar.gz /opt
安装libfastcommon-master
[root@blog opt]# unzip /opt/libfastcommon-master.zip
Archive: /opt/libfastcommon-master.zip
[root@blog opt]#
[root@blog opt]# cd libfastcommon-master
[root@blog libfastcommon-master]#
[root@blog libfastcommon-master]# ./make.sh
[root@blog libfastcommon-master]# ./make.sh install
安装FastDFS
[root@blog opt]# tar -zxvf /opt/FastDFS_v5.08.tar.gz
[root@blog opt]# cd FastDFS
[root@blog FastDFS]# ./make.sh
[root@blog FastDFS]# ./make.sh install
拷贝配置文件
[root@blog fdfs]# ll /etc/fdfs/
total 20
-rw-r--r-- 1 root root 1461 May 23 11:02 client.conf.sample
-rw-r--r-- 1 root root 7927 May 23 11:02 storage.conf.sample
-rw-r--r-- 1 root root 7200 May 23 11:02 tracker.conf.sample
[root@blog fdfs]# cp /opt/FastDFS/conf/storage.conf /opt/FastDFS/conf/tracker.conf /etc/fdfs/
[root@blog /]# cp /opt/FastDFS/conf/client.conf /etc/fdfs/
[root@blog conf]# cp /opt/FastDFS/conf/http.conf /etc/fdfs/
[root@blog fdfs]# rm ./*.sample
rm: remove regular file `./client.conf.sample'? y
rm: remove regular file `./storage.conf.sample'? y
rm: remove regular file `./tracker.conf.sample'? y
创建存放数据和日志的文件夹
[root@blog /]# mkdir -p /my_fastdfs/{storage,tracker}
修改后的storage.conf,主要修改base_path、store_path0、tracker_server:
[root@blog /]# grep -v "^#" /etc/fdfs/storage.conf | grep -v "^$"
disabled=false
group_name=group1
bind_addr=
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/my_fastdfs/storage
max_connections=256
buff_size = 256KB
accept_threads=1
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/my_fastdfs/storage
subdir_count_per_path=256
tracker_server=IP:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
file_signature_method=hash
key_namespace=FastDFS
keep_alive=0
use_access_log = false
rotate_access_log = false
access_log_rotate_time=00:00
rotate_error_log = false
error_log_rotate_time=00:00
rotate_access_log_size = 0
rotate_error_log_size = 0
log_file_keep_days = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=8888
修改后的tracker.conf,主要修改base_path:
[root@blog /]# grep -v "^#" /etc/fdfs/tracker.conf | grep -v "^$"
disabled=false
bind_addr=
port=22122
connect_timeout=30
network_timeout=60
base_path=/my_fastdfs/tracker
max_connections=256
accept_threads=1
work_threads=4
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 10%
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
trunk_init_check_occupying = false
trunk_init_reload_from_binlog = false
trunk_compress_binlog_min_interval = 0
use_storage_id = false
storage_ids_filename = storage_ids.conf
id_type_in_filename = ip
store_slave_file_use_link = false
rotate_error_log = false
error_log_rotate_time=00:00
rotate_error_log_size = 0
log_file_keep_days = 0
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html
修改后的client.conf
主要修改base_path、tracker_server:
[root@blog /]# grep -v "^#" /etc/fdfs/client.conf | grep -v "^$"
connect_timeout=30
network_timeout=60
base_path=/my_fastdfs/storage
tracker_server=IP:22122
log_level=info
use_connection_pool = false
connection_pool_max_idle_time = 3600
load_fdfs_parameters_from_tracker=false
use_storage_id = false
storage_ids_filename = storage_ids.conf
http.tracker_server_port=80
启动FastDFS
[root@blog /]# /etc/init.d/fdfs_storaged start
Starting FastDFS storage server:
[root@blog /]# /etc/init.d/fdfs_trackerd start
Starting FastDFS tracker server:
[root@blog /]# ps -ef | grep -E fdfs
root 23485 1 0 11:24 ? 00:00:00 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
root 23596 1 0 11:26 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root 23656 20047 0 11:27 pts/3 00:00:00 grep -E fdfs
测试上传、下载文件
[root@blog tmp]# cd /tmp/ && echo '123' > hello.html
[root@blog tmp]# fdfs_upload_file /etc/fdfs/client.conf hello.html
group1/M00/00/00/rBIlOFkjrW2Ac6TAAAAABFqCAvc47.html
[root@blog tmp]# fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/rBIlOFkjrW2Ac6TAAAAABFqCAvc47.html hello.html.bak
[root@blog tmp]# cat hello.html.bak
123
安装fastdfs-nginx-module
[root@blog opt]# tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
查找fastfds、fastcommon在哪
[root@blog fastdfs-nginx-module]# find /usr/ -name fastdfs
/usr/include/fastdfs
^C
[root@blog fastdfs-nginx-module]# find /usr/ -name fastcommon
/usr/include/fastcommon
根据上述查得的实际路径修改config
[root@blog fastdfs-nginx-module]# cat /opt/fastdfs-nginx-module/src/config
ngx_addon_name=ngx_http_fastdfs_module
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"
安装nginx和添加fastdfs-nginx-module
[root@blog opt]# tar -zxvf nginx-1.8.0.tar.gz
[root@blog opt]# cd nginx-1.8.0
[root@blog nginx-1.8.0]# ./configure --prefix=/usr/local/nginx --add-module=/opt/fastdfs-nginx-module/src
[root@blog nginx-1.8.0]# make
[root@blog nginx-1.8.0]# make install
拷贝、修改mod_fastdfs.conf
主要修改base_path、tracker_server、store_path0、url_have_group_name:
[root@blog nginx-1.8.0]# cp /opt/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
[root@blog nginx-1.8.0]# grep -v "^#" /etc/fdfs/mod_fastdfs.conf | grep -v "^$"
connect_timeout=2
network_timeout=30
base_path=/my_fastdfs/storage
load_fdfs_parameters_from_tracker=true
storage_sync_file_max_delay = 86400
use_storage_id = false
storage_ids_filename = storage_ids.conf
tracker_server=IP:22122
storage_server_port=23000
group_name=group1
url_have_group_name = true
store_path_count=1
store_path0=/my_fastdfs/storage
log_level=info
log_filename=
response_mode=proxy
if_alias_prefix=
flv_support = true
flv_extension = flv
group_count = 0
在/usr/local/nginx/conf/nginx.conf添加此段
location /group1/M00 {
# root html;
ngx_fastdfs_module;
}
启动nginx
拷贝需要的文件
[root@blog conf]# cp /usr/local/nginx/conf/mime.types /etc/fdfs
启动nginx,并查看错误日志是否报错
[root@blog conf]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ngx_http_fastdfs_set pid=27789
[root@blog conf]# less /usr/local/nginx/logs/error.log
查看是否能访问:
http://IP/group1/M00/00/00/rBIlOFkjrW2Ac6TAAAAABFqCAvc47.html
【FastDFS】FastDFS在CentOS的搭建的更多相关文章
- fastDFS 一二事 - 简易服务器搭建(单linux)
什么是FastDFS FastDFS是一个叫余庆的哥们用c语言编写的一款开源的分布式文件系统 功能有冗余备份.负载均衡.线性扩容等,高可用.高性能 可以用FastDFS搭建一套高性能的文件服务器集群提 ...
- FastDFS+nginx+keepalived集群搭建
安装环境 nginx-1.6.2 libfastcommon-master.zip FastDFS_v5.05.tar.gz(http://sourceforge.net/projects/fastd ...
- CentOS下搭建LAMP环境详解
前言:在这里将介绍如何在CentOS下搭建LAMP环境(全部使用源码编译安装),用于web服务器开发. •LAMP: Linux + Apache + PHP + Mysql. •系统: CentOS ...
- CentOs上搭建git服务器
CentOs上搭建git服务器 首先安装setuptools wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0 ...
- Centos下搭建 nginx+uwsgi+python
python做web应用最麻烦的还是配置服务器了,此话不假,光中间件就有好几种选择,fastcgi.wsgi.uwsgi,难 免让人眼花缭乱. 而听说uwsgi的效率是fastcgi和wsgi的10倍 ...
- 在CentOS 上搭建nginx来部署静态页面网站
在centOs 上搭建nginx来部署静态页面网站 一.部署服务器环境 nginx:轻量级.高性能的HTTP及反向代理服务器,占用内存少,并发能力强,相比老牌的apache作为web服务器,性能更加卓 ...
- CentOS 7 搭建PXC 数据库集群
CentOS 7 搭建PXC 数据库集群 PXC( Percona XtraDB Cluster ) 特点如下: 1.同步复制,事务要么在所有节点提交或不提交,保证了数据的强一致性. 2.多主复制,可 ...
- centos上搭建git服务--3
前言:当我们想要实现几个小伙伴合作开发同一个项目,或者建立一个资源分享平台的时候,GIT就是一个很好的选择.当然,既然是一个共有平台,那么把这个平台放到个人计算机上明显是不合适的,因此就要在服务器上搭 ...
- CentOS中搭建Redis伪分布式集群【转】
解压redis 先到官网https://redis.io/下载redis安装包,然后在CentOS操作系统中解压该安装包: tar -zxvf redis-3.2.9.tar.gz 编译redis c ...
- CentOS下搭建LNMP+WordPress+http2.0教程
此文是本人CentOS下搭建WordPress的一些笔记,环境搭建时间::将看过的几篇文章总结下来,形成一条龙长文.不用大家再找来找去. 本文大概分为此几部分: 一.基础命令更新: 二.服务器加速(非 ...
随机推荐
- ios中Pldatabase的用法(3)
#import "ViewController.h" @interface ViewController () @property(nonatomic,retain)PLSqlit ...
- Maven实战——常用Maven插件介绍
maven nexus 库已上传了第三方jar,但就是用mvn compile下不到本地 回答于 2013-06-04 14:40 你是通过何种方式上传到nexus的? 有给pom文件吗? 如果是单纯 ...
- Error 25007.初始化合成时发生错误。安装程序无法使用 LoadLibraryShim() 加载合成。
安装“Microsoft .NET Framework 2.exe”报错如下: c:\windows\microsoft.net\framework\...类似这种错误都因 .NET Framewor ...
- 【Struts2】Struts2获取session的三种方式
1.Map<String,Object> map = ActionContext.getContext().getSession(); 2.HttpSession session = S ...
- 【Spring】SpringMVC之REST编程风格
REST架构是一个抽象的概念,目前主要是基于HTTP协议实现,其目的是为了提高系统的可伸缩性.降低应用之间的耦合度.便于架构分布式处理程序.当使用多种语言进行开发的时候,每一种语言对URL的处理不同, ...
- git web开发版本管理
使用git来管理web开发: 我们需要做的事情 : 1,在服务器建立版本仓库: 2,在服务器建立稳定版本的站点,编写版本仓库的hooks: 3,在开发服务器上提交开发版本: 下面一步一步来:(注意建立 ...
- golang ----map按key排序
实现map遍历有序 1. key有序 思路:对key排序,再遍历key输出value 代码如下:既可以从小到大排序,也可以从大到小排序 package main import ( "fmt& ...
- SeqGAN 原理简述
1. 背景GAN在之前发的文章里已经说过了,虽然现在GAN的变种越来越多,用途广泛,但是它们的对抗思想都是没有变化的.简单来说,就是在生成的过程中加入一个可以鉴别真实数据和生成数据的鉴别器,使生成器G ...
- C#基础第三天-作业答案-集合-冒泡排序-模拟名片
.冒泡排序 Console.WriteLine("对集合里的数进行排序,请输入第一个数:"); int a = int.Parse(Console.ReadLine()); Con ...
- 快学Scala习题解答—第四章 映射和元组
4 映射和元组 4.1 设置一个映射,当中包括你想要的一些装备,以及它们的价格.然后构建还有一个映射.採用同一组键,可是价格上打9折 映射的简单操作 ,"gun"->18 ...