【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
下载libfastcommon包(libfastcommon-1.0.39.tar.gz )
https://github.com/happyfish100/libfastcommon/releases
下载fastdfs源码包(fastdfs-5.11.tar.gz)
https://github.com/happyfish100/fastdfs/releases
安装libfastcommon
tar xf libfastcommon-1.0.7.tar.gz //解压
cd libfastcommon-1.0.7
./make.sh
./make.sh install
安装fastdfs
tar xf fastdfs-5.09.tar.gz
cd fastdfs-5.09
./make.sh
./make.sh install
配置文件默认在/etc/fdfs下
默认脚本在/etc/init.d下
创建两个目录,用来存放数据
mkdir -p /data/fdfs/tracker
mkdir -p /data/fdfs/storage
mkdir -p /data/fdfs/storage/base
mkdir -p /data/fdfs/storage/storage0
复制配置文件
cd /etc/fdfs
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf
跟踪器的配置文件 vim tracker.conf
#绑定IP
bind_addr=192.168.112.132
#日志数据路径
base_path=/data/fdfs/tracker
配置文件 vim storage.conf
#绑定IP
bind_addr=192.168.112.132
#日志数据路径
base_path=/data/fdfs/storage
store_path_count=1
#根据store_path_count的值,就要有storage0到storage(N-1)个
store_path0=/data/fdfs/storage
#跟踪服务器
tracker_server=192.168.1.222:22122
启动服务
/etc/init.d/fdfs_trackerd start
/etc/init.d/fdfs_storaged start
查看服务是否启动
ps -ef|grep fdfs
测试fastdfs
创建client目录
mkdir -p /data/fdfs/client
配置client文件
cd /etc/fdfs
cp client.conf.sample client.conf
vim client.conf 修改下面信息
base_path=/data/fdfs/client
tracker_server=192.168.112.132:22122
并修改
vi /etc/fdfs/mod_fastdfs.conf
base_path=/data/fdfs/storage
tracker_server=192.168.112.132:22122
#tracker_server=192.168.112.132:22122 #(多个tracker配置多行)
url_have_group_name=true #url中包含group名称
store_path0=/data/fdfs/storage #指定文件存储路径(上面配置的store路径)
nginx中加入fastdfs-nginx-module
./configure --prefix=/usr/local/nginx-1.17.2 --add-module=/usr/local/fastdfs-nginx-module-1.20/src/
启动nginx
/usr/local/nginx-1.17.2/sbin/nginx
来源:oschina
链接:https://my.oschina.net/lion1220/blog/3149342