fastdfs虚拟机单机版搭建
说明:github搭建步骤:https://github.com/happyfish100/fastdfs/wiki#trackermkdir /home/dfs #创建数据存储目录 cd /usr/local/src #切换到安装目录准备下载安装包
安装libfatscommon
git clone https://github.com/happyfish100/libfastcommon.git --depth 1 cd libfastcommon/ ./make.sh && ./make.sh install #编译安装 安装FastDFS cd ../ #返回上一级目录 git clone https://github.com/happyfish100/fastdfs.git --depth 1 cd fastdfs/ ./make.sh && ./make.sh install #编译安装 #配置文件准备 cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf #客户端文件,测试用 cp /usr/local/src/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用 cp /usr/local/src/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用 安装fastdfs-nginx-module cd ../ #返回上一级目录 git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1 cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs 安装nginx wget http://nginx.org/download/nginx-1.15.4.tar.gz #下载nginx压缩包 tar -zxvf nginx-1.15.4.tar.gz #解压 cd nginx-1.15.4/ #添加fastdfs-nginx-module模块#注意这句命令会报错,因为电脑环境原因 ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ 如果报错执行 缺少编译相关的环境yum -y install pcre-develyum -y install zlib-devel make && make install #编译安装 单机部署 tracker配置 #服务器ip为 192.168.138.52 #我建议用ftp下载下来这些文件 本地修改 vim /etc/fdfs/tracker.conf #需要修改的内容如下 port=22122 # tracker服务器端口(默认22122,一般不修改) base_path=/home/dfs # 存储日志和数据的根目录
storage配置
vim /etc/fdfs/storage.conf #需要修改的内容如下 port=23000 # storage服务端口(默认23000,一般不修改) base_path=/home/dfs # 数据和日志文件存储根目录 store_path0=/home/dfs # 第一个存储目录 tracker_server=192.168.138.52:22122 # tracker服务器IP和端口 http.server_port=8888 # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)
client测试
vim /etc/fdfs/client.conf #需要修改的内容如下 base_path=/home/dfs tracker_server=192.168.138.52:22122 #tracker服务器IP和端口 #保存后测试,返回ID表示成功 如:group1/M00/00/00/xx.tar.gz#使配置生效/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart#上传文件测试 新建一个文件在/usr/local/file/text.txtfdfs_upload_file /etc/fdfs/client.conf /usr/local/file/test.txt 配置nginx访问 vim /etc/fdfs/mod_fastdfs.conf #需要修改的内容如下 tracker_server=192.168.138.52:22122 #tracker服务器IP和端口 url_have_group_name=true store_path0=/home/dfs #配置nginx.config vim /usr/local/nginx/conf/nginx.conf #添加如下配置 server { listen 8888; ## 该端口为storage.conf中的http.server_port相同 server_name 192.1168.138.52;##不是localhost是你的虚拟主机ip location ~/group[0-9]/ { ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }#启动nginx#yum install net-tools#ss -lntpd|grep :23000 查看端口暂用/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf #测试下载,用外部浏览器访问刚才已传过的nginx安装包,引用返回的ID #上传图片测试 fdfs_upload_file /etc/fdfs/client.conf /usr/local/file/4.jpg
相关推荐
joynet00 2020-06-21
zhangskd 2020-06-21
loviezhang 2020-05-30
wqbala 2020-05-10
isHooky 2020-05-05
tianlong 2020-05-01
diediexiaomi 2020-04-19
liusaisoso 2020-04-18
Cheetahcubs 2020-03-01
zhangll00 2020-02-12
baixiaoshi 2020-01-29
tianlong 2020-01-29
我爱熊猫 2020-01-28
CSDNMrWang 2013-06-27
憧憬 2019-12-20
咻咻ing 2019-12-21