- 版本介绍
安装fastdfs共需要俩个安装包
fastdfs-5.05.tar.gz
libfastcommon-1.0.7.tar.gz - 编译安装 libfastcommon
tar -xvf libfastcommon-1.0.7.tar.gz
cd libfastcommon-1.0.7
make.sh
make.sh install
3. 设置软链接
libfastcommon.so默认安装到了/usr/lib64/libfastcommon.so,而FastDFS主程序设置的lib目录是/usr/local/lib。
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
- 编译安装安装FastDFS
tar -xvf fastdfs-5.05.tar.gz
cd fastdfs-5.05
./make.sh
./make.sh install
- 创建软连接
FastDFS 服务脚本设置的 bin 目录是 /usr/local/bin, 但实际命令安装在 /usr/bin/ 下
ln -s /usr/bin/fdfs_trackerd /usr/local/bin
ln -s /usr/bin/fdfs_storaged /usr/local/bin
ln -s /usr/bin/stop.sh /usr/local/bin
ln -s /usr/bin/restart.sh /usr/local/bin
- 创建数据存储目录
后面用于配置文件中
mkdir -p /bonc/install/fastdfdata/client
mkdir -p /data/install/fastdfdata/storage
mkdir -p /data/install/fastdfdata/tracker
- 修改配置文件tracker
cd /etc/fdfs
cp tracker.conf.sample tracker.conf
vim tracker.conf
需要特别关注修改的四个参数为bind_add,port,base_path,http.server_port
bind_addr=172.0.0.1 #实际IP地址
port=22122
base_path=/data/install/fastdfdata/tracker
http.server_port=801
- 修改配置文件storage
cp storage.conf.sample storage.conf
vim storage.conf
需要特别关注修改的五个参数为bind_addr,base_path,port,tracker_server,http.server_port
bind_addr=172.0.0.1 #实际IP地址
base_path=/data/install/fastdfdata/storage
store_path0=/data/install/fastdfdata/storage
port=23000
tracker_server=172.0.0.1:22122 #实际IP地址
http.server_port=801/bonc
- 修改配置文件client
cp client.conf.sample client.conf
vim client.conf
需要特别关注修改的三个参数为base_path,tracker_server,http.tracker_server_port
base_path=/data/install/fastdfdata/client
tracker_server=172.0.0.1:22122 #实际IP地址
http.tracker_server_port=801
- 启动服务
/etc/init.d/fdfs_trackerd start
/etc/init.d/fdfs_storaged start
netstat -unltp|grep fdfs
11. 上传文件测试
在任意目录下,创建一个测试文件 test.txt
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.txt
12. nginx配置-到这里就结束啦
server {listen 801;charset utf-8;location /group1/M00 {alias /data/install/fastdfdata/storage/data/;}
}
如果有需要帮忙请留言,祝工作愉快😊