本文共 2037 字,大约阅读时间需要 6 分钟。
最近开始搞的项目涉及到 fastdfs,工欲善其事,必先利其器,于是我自己搭了一台 fastdfs 服务器。坑已经帮大家都踩过了。按照该教程100%能安装成功。
一个centos7
一个FastDFS_v5.05.tar.gz一个libfastcommon(1)安装gcc
yum install gcc-c++
(2)安装libevent
yum -y install libevent
(3)安装libfastcommon
将libfastcommonV1.0.7.tar.gz拷贝至/usr/local/下cd /usr/local
tar -zxvf libfastcommonV1.0.7.tar.gz
cd libfastcommon-1.0.7
./make.sh
./make.sh install
注意如果./make.sh失败,报perl未找到,执行下方的方法。
yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget
(4)将/usr/lib64下的库文件libfastcommon.so拷贝至/usr/lib下
(5)将FastDFS_v5.05.tar.gz拷贝至/usr/local/下tar -zxvf FastDFS_v5.05.tar.gzcd FastDFS./make.sh./make.sh install
安装成功将安装目录下的conf下的文件拷贝到/etc/fdfs/下。
client,http,mime,storage,storage_ids,tracker(6)安装成功后进入/etc/fdfs目录:拷贝一份新的tracker配置文件:cp tracker.conf.sample tracker.conf
修改tracker.conf
vi tracker.confbase_path=/home/yuqing/FastDFS 改为:base_path=/home/FastDFS(7)启动/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
(8)设置开机自动启动
vim /etc/rc.d/rc.local
将运行命令行添加进文件:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
(0)如果在一台服务器上,之前的tracker,libevent,libfastcommon
解压 fastdfs,这些步骤可以不用进行,如果两台的话,需要进行。(1)安装成功后进入/etc/fdfs目录拷贝一份新的storage配置文件:cp storage.conf.sample storage.conf(2)修改storage.conf
vi storage.conf
group_name=group1
base_path=/home/yuqing/FastDFS改为:base_path=/home/FastDFS
store_path0=/home/yuqing/FastDFS改为:store_path0=/home/FastDFS/fdfs_storage
/#如果有多个挂载磁盘则定义多个store_path,如下
/#store_path1=...../#store_path2=......tracker_server=192.168.101.3:22122 #配置tracker服务器:IP/#如果有多个则配置多个trackertracker_server=192.168.20.1:22122上面的地址写你自己的详细地址。(3)启动/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart(4)设置开机启动vim /etc/rc.d/rc.local
将运行命令行添加进文件
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
修改/etc/fdfs/client.conf
base_path=/home/fastdfs
tracker_server=192.168.20.1:22122
使用格式:
/usr/bin/fdfs_test 客户端配置文件地址 upload 上传文件
比如将/home下的图片上传到FastDFS中:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/1.png
转载地址:http://lquyz.baihongyu.com/