Fastdfs安装与卸载

安装

mkdir /webapp/data #创建数据存储目录
/webapp/data/tracker
/webapp/data/storage

cd /webapp/soft #切换到安装目录准备下载安装包

安装libfatscommon

 git clone https://github.com/happyfish100/libfastcommon.git --depth 1
cd libfastcommon/
./make.sh && ./make.sh install #编译安装

安装FastDFS

 

cd ../ #返回上一级目录
git clone https://github.com/happyfish100/fastdfs.git --depth 1
cd fastdfs/
./make.sh && ./make.sh install #编译安装


在运行这个脚本时,会报一个 /common/fdfs_global.h:15:10: fatal error: sf/sf_global.h: No such file or directory 错误
git clone https://github.com/happyfish100/libserverframe.git --depth 1
./make.sh && ./make.sh install


#配置文件准备 (应该是有了)  
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 


#供nginx访问使用
cp /webapp/soft/fastdfs/conf/http.conf /etc/fdfs/ 
#供nginx访问使用
cp /webapp/soft/fastdfs/conf/mime.types /etc/fdfs/ 
 

安装fastdfs-nginx-module

 cd ../ #返回上一级目录
git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1
cp /webapp/soft/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

安装Nginx

这里我已经安装上了nginx,所以就没有贴流程图了 但是要进行添加模块!!!  

wget http://nginx.org/download/nginx-1.15.4.tar.gz #下载nginx压缩包
tar -zxvf nginx-1.15.4.tar.gz #解压
cd nginx-1.15.4/


#添加fastdfs-nginx-module模块----------------------------重点
#安装了nginx 可以到这个目录
cd /www/server/nginx/src
./configure --add-module=/webapp/soft/fastdfs-nginx-module/src/ 
#编译安装
make && make install 

 

单机部署

tracker配置  

#查看当前服务器ip为 192.168.52.1
#我建议用ftp下载下来这些文件 本地修改
vim /etc/fdfs/tracker.conf
#需要修改的内容如下
port=22122  # tracker服务器端口(默认22122,一般不修改)
base_path=/home/dfs  # 存储日志和数据的根目录 

storage配置  

vim /etc/fdfs/storage.conf
#需要修改的内容如下
port=23000  # storage服务端口(默认23000,一般不修改)
base_path=/home/dfs  # 数据和日志文件存储根目录
store_path0=/home/dfs  # 第一个存储目录
tracker_server=192.168.52.1:22122  # tracker服务器IP和端口
http.server_port=8888  # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致) 

client配置  

vim /etc/fdfs/client.conf
#需要修改的内容如下
base_path=/home/dfs
tracker_server=192.168.52.1:22122    #tracker服务器IP和端口 

tracker启动  

/etc/init.d/fdfs_trackerd start 
/etc/init.d/fdfs_trackerd restart #重启动tracker服务
/etc/init.d/fdfs_trackerd stop #停止tracker服务
chkconfig fdfs_trackerd on #自启动tracker服务

#启动tracker服务
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf

 

storage启动  

/etc/init.d/fdfs_storaged start 
/etc/init.d/fdfs_storaged restart #重动storage服务
/etc/init.d/fdfs_storaged stop #停止动storage服务
chkconfig fdfs_storaged on #自启动storage服务

#启动storage服务
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf

 

配置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;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   html;
    }
}
 

nginx启动

/usr/local/nginx/sbin/nginx #启动nginx
/usr/local/nginx/sbin/nginx -s reload #重启nginx
/usr/local/nginx/sbin/nginx -s stop #停止nginx
 

测试下载

#用外部浏览器访问刚才已传过的nginx安装包,引用返回的ID
http://192.168.52.1:8888/group1/M00/00/00/wKgAQ1pysxmAaqhAAA76tz-dVgg.tar.gz 

  • 21
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是Linux FastDFS安装与配置的步骤: 1.下载FastDFS安装包并解压缩: ```shell wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz tar -zxvf V5.11.tar.gz ``` 2.安装libfastcommon: ```shell cd fastdfs-5.11/libfastcommon/ ./make.sh ./make.sh install ``` 3.安装FastDFS: ```shell cd ../fastdfs/ ./make.sh ./make.sh install ``` 4.配置Tracker服务器: ```shell cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf vi /etc/fdfs/tracker.conf ``` 在tracker.conf中修改base_path和http.server_port参数,例如: ``` base_path=/data/fastdfs/tracker http.server_port=8080 ``` 5.配置Storage服务器: ```shell cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf vi /etc/fdfs/storage.conf ``` 在storage.conf中修改base_path、store_path0、tracker_server参数,例如: ``` base_path=/data/fastdfs/storage store_path0=/data/fastdfs/storage tracker_server=192.168.36.100:22122 tracker_server=192.168.36.103:22122 ``` 6.配置客户端: ```shell cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf vi /etc/fdfs/client.conf ``` 在client.conf中修改base_path和tracker_server参数,例如: ``` base_path=/data/fastdfs/client tracker_server=192.168.36.100:22122 tracker_server=192.168.36.103:22122 ``` 7.配置Nginx: ```shell cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak vi /usr/local/nginx/conf/nginx.conf ``` 在http节点下添加如下配置: ``` location /group1/M00 { root /data/fastdfs/storage/data; ngx_fastdfs_module; } ``` 8.启动Tracker和Storage服务器: ```shell /etc/init.d/fdfs_trackerd start /etc/init.d/fdfs_storaged start ``` 9.测试FastDFS: ```shell echo "Hello, FastDFS!" > test.txt /usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.txt ``` 以上是Linux FastDFS安装与配置的步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值