下面由centos教程栏目给大家介绍关于centos7 fastdfs部署,希望对需要的朋友有所帮助!
centos7 fastdfs部署
### start from here ## 前置准备依赖c++ : yum -y install libevent libevent-devel perl make gcc zlib zlib-devel pcre pcre-devel gcc-c++ openssl-devel
1.安装libfastcommon
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz mv V1.0.43.tar.gz libfastcommon-1.0.43.tar.gz && tar -xvf libfastcommon-1.0.43.tar.gz cd libfastcommon-1.0.43 && ./make.sh && ./make.sh install
2.安装fastdfs # 注意conf 的mine.types和http.conf 一定要复制过去,其次下载本版本建议6.x不然安装会有兼容问题
wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz mv V6.06.tar.gz fdfs6.06.tar.gz && tar -xvf fdfs6.06.tar.gz cd cd fastdfs-6.06 && ./make.sh && ./make.sh install cp -r conf/* /etc/fdfs && rm -f *.sample . 在$base_path 下新建data 和logs目录(存储trackerd.log 和storaged.log) cd $base_path && mkdir -p data && mkdir logs
3.修改配置
1.修改 vi tracker.conf
port=22122 # tracker服务器端口(默认22122,一般不修改) base_path=/etc/fdfs # 存储日志和数据的根目录
2.修改 vi storage.conf
port=23000 # storage服务端口(默认23000,一般不修改) base_path=/etc/fdfs # 数据和日志文件存储根目录 store_path0=/etc/fdfs # 第一个存储目录 tracker_server=192.168.110.151:22122 # tracker也就是fdfs服务器IP和端口 http.server_port=8888 # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)
3.修改 vi client.conf
base_path=/etc/fdfs tracker_server=192.168.110.151:22122 #tracker服务器IP和端口
4.启动服务:
sh fastfdfs_services.sh
或者使用:
/etc/init.d/fdfs_trackerd start/stop/restart /etc/init.d/fdfs_storaged start/stop/restart
6.测试fastfdfs上传服务:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload $filename
看到如下类似表示服务ok
example file url: http://192.168.110.151/group1/M00/00/00/wKhul1-qhhKAO3ywAAABcxvxSxw5288_big.jpg
7.nginx整合,由于现在还没有和nginx整合无法使用http下载
7.1 安装fastdfs-nginx-module安装fastdfs-nginx-module:
wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
配置nginx moudle:
vim /etc/fdfs/mod_fastdfs.conf tracker_server=192.168.0.104:22122 #tracker服务器IP和端口 url_have_group_name=true store_path0=/home/dfs
安装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/ ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ # 添加fastdfs-nginx-module模块 make && make install
7.2#配置nginx.config
touch /usr/local/nginx/logs/nginx.pid && chmod a+w /usr/local/nginx/logs/nginx.pid vim /usr/local/nginx/conf/nginx.conf #添加如下配置 pid /usr/local/nginx/logs/nginx.pid; server { listen 8888; ## 该端口为storage.conf中的http.server_port相同 server_name 192.168.110.151; location ~/group[0-9]/ { ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
8.关闭防火墙:
systemctl stop firewalld.service
9.nginx 启动停止
./nginx -c /usr/local/nginx/conf/nginx.conf # 根据配置启动 /usr/local/nginx/sbin/nginx #启动nginx /usr/local/nginx/sbin/nginx -s reload #重启nginx /usr/local/nginx/sbin/nginx -s stop #停止nginx
10.测试访问:
nginx访问 访问:http://192.168.0.104:8888/group1/M00/00/00/wKgAaFyMoNKAUNcVAAWjVxW4v70993.jpg
以上就是关于centos7 fastdfs部署的详细内容,更多请关注php中文网其它相关文章!
已抢111424个
抢已抢47249个
抢已抢133902个
抢已抢32462个
抢已抢326个
抢已抢736个
抢