安装FastDFS

Sakura 发布于 2023-05-15 284 次阅读


wget https://github.com/happyfish100/libfastcommon/archive/refs/tags/V1.0.66.zip unzip V1.0.66.zip cd libfastcommon-1.0.66 ./make.sh ./make.sh install

wget https://github.com/happyfish100/libserverframe/archive/refs/tags/V1.1.25.zip unzip V1.1.25.zip cd libserverframe-1.1.25 ./make.sh ./make.sh install

wget https://github.com/happyfish100/fastdfs/archive/refs/tags/V6.9.4.zip unzip V6.9.4.zip cd fastdfs-6.9.4/ ./make.sh ./make.sh install ./setup.sh

vim /etc/fdfs/tracker.conf

# tracker追踪者服务器端口
port=22122
# 存储数据和日志文件的基础目录(Tracker运行时会向此目录存储storage的管理数据)
# base_path=/home/yuqing/fastdfs
base_path=/home/fastdfs

vim /etc/fdfs/storage.conf

# 配置组名
# 此存储服务器所属的组的名称。
# 注释或删除从tracker服务器获取的该项,此时在tracker.conf中必须将use_storage_id设置为true,并且必须正确配置storage_ids.conf
group_name=group1
# storage存储服务器端口
port=23000
# 向tracker心跳间隔(秒)
heart_beat_interval=30
# storage基础目录(目录不存在,需要自行创建)
# base_path=/home/yuqing/fastdfs
base_path=/home/fastdfs
# store存放文件的位置(store_path)。可以理解一个磁盘一个store_path,多个磁盘多个store_path
# store_path0=/home/yuqing/fastdfs
store_path0=/home/fastdfs/fdfs_storage
# 如果有多个挂载磁盘,则定义多个store_path*属性,如下:
# store_path1=...
# store_path2=...
# 配置tracker服务器IP
tracker_server=192.168.230.131:22122
# 如果有多个则配置多个tracker
# tracker_server=192.168.230.xxx:22122

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

整合nginx wget https://github.com/happyfish100/fastdfs-nginx-module/archive/refs/tags/V1.23.zip

unzip V1.23.zip --add-module=/data/software/fastdfs/fastdfs-nginx-module-1.23/src

cp /data/software/fastdfs/fastdfs-nginx-module-1.23/src/mod_fastdfs.conf /etc/fdfs/

vim /etc/fdfs/mod_fastdfs.conf
tracker_server=192.168.230.xxx:22122
url_have_group_name=true
store_path0=/home/yuqing/fastdfs

location ~/group[0-9]/ { ngx_fastdfs_module; } nginx -s reload