FastDFS公网访问

2020-05-07

FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。

1、安装cat 5ins_fastfds.sh
#!/bin/sh

LNMP=/opt/LNMP
IP=$(ifconfig eth0|grep inet|awk '{print $2}')
cd ${LNMP}
#yum -y install gcc gcc-c++ libevent libevent-devel git
#yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel perl wget
#git clone https://github.com/happyfish100/libfastcommon.git
#wget -c https://github.com/happyfish100/libfastcommon/archive/V1.0.39.tar.gz -SO untar/libfastcommon.tar.gz
#wget -c https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz -SO untar/fastdfs-6.06.tar.gz
#wget -c https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz -SO untar/fastdfs-nginx-module.tar.gz

mkdir -p /data/{fastdfs,files}

#tar zxf untar/libfastcommon.tar.gz
#tar zxf untar/fastdfs-6.06.tar.gz

pushd libfastcommon
sh make.sh
sh make.sh install
popd
ln -sf /usr/lib64/liblibfastcommon.so /usr/lib

pushd fastdfs-6.06
sh make.sh
sh make.sh install
popd

#/bin/cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
#/bin/cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
#/bin/cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
#/bin/cp /etc/fdfs/storage_ids.conf.sample /etc/fdfs/storage_ids.conf

sed -i "s/home\/yuqing/medellion/g" /etc/fdfs/*.conf
sed -i "s/192.168.209.121/${IP}/g" /etc/fdfs/*.conf
sed -i "s/192.168.0.197/${IP}/g" /etc/fdfs/*.conf
2、Nginx增加fastdfs模块
pushd nginx-1.16.1
./configure --prefix=/data/nginx \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_flv_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-ld-opt=-Wl,-rpath,/usr/local/lib \
--add-module=../fastdfs-nginx-module/src
make;
make install;
3、FastDFS公网访问

vim /etc/fdfs/tracker.conf

http.server_port = 8080
use_storage_id = false

vim /etc/fdfs/storage.conf

http.server_port = 8888
tracker_server = 公网IP:22122

vim /etc/fdfs/storage_ids.conf

100001 group1 公网IP
vim /etc/fdfs/mod_fastdfs.conf

use_storage_id = false
tracker_server = 公网地址:22122

vim /etc/fdfs/client.conf

use_storage_id = false
http.tracker_server_port = 80
tracker_server = 内网地址:22122

vim /fastdfs/storage/data/.data_init_flag

last_ip_addr = 内网IP
last_server_port = 23000
last_http_port = 8888

vim /fastdfs/tracker/data/storage_sync_timestamp.dat

group1,内网地址,0,0
group1,公网IP,0,0

分类:Linux | 标签: |

相关日志

评论被关闭!