java编程技术FastDFS 安装和配置_java fastdf(1)

2 创建fdfs_storage文件夹

mkdir /opt/fastdfs/fdfs_storage

3 设置启动服务

vim  /etc/init.d/fdfs_storaged

chkconfig  - -add  fdfs_storaged

启动服务

service fdfs_storaged start

4功能文件目录总结说明

/opt/fastdfs/数据文件及日志
/usr/bin/fdfs_trackerd 、 fdfs_storaged启动执行程序
/usr/local/fdfs/ stop.sh 、 restart.sh关闭、重启脚本
/etc/init.d/fdfs_tracked 、fdfs_storaged服务启动脚本
/etc/fdfs/配置文件

5 上传图片测试

FastDFS安装成功可通过/usr/bin/fdfs_test测试上传、下载等操作。

修改/etc/fdfs/client.conf

[root@localhost ~]# vim /etc/fdfs/client.conf

base_path=/opt/fastdfs

tracker_server=192.168.67.163:22122

比如将/root下的日志上传到FastDFS中:

/usr/bin/fdfs_test  /etc/fdfs/client.conf  upload  /root/winteriscoming.jpg

对应的上传路径:

/opt/fastdfs/fdfs_storage/data /00/00/wKhDo1qipbiAJC6iAAB1tayPlqs094_big.jpg

三、FastDFS整合nginx

1 安装前配置fastdfs-nginx-module

上传fastdfs-nginx-module_v1.16.tar.gz上传到 /usr/local,并解压

tar -zxvf fastdfs-nginx-module_v1.16.tar.gz

编辑配置文件:修改config文件将/usr/local/路径改为/usr/

vim fastdfs-nginx-module/src/config

将FastDFS-nginx-module/src下的mod_fastdfs.conf拷贝至/etc/fdfs/下

[root@localhost src]# cp mod_fastdfs.conf /etc/fdfs/

并修改mod_fastdfs.conf的内容:

vim /etc/fdfs/mod_fastdfs.conf

继续修改

继续修改 url中包含group名称

继续修改  #指定文件存储路径

将libfdfsclient.so拷贝至/usr/lib下

[root@localhost src]# cp /usr/lib64/libfdfsclient.so /usr/lib/

2 安装fastdfs-nginx-module

创建nginx/client目录

[root@localhost src]# mkdir -p /var/temp/nginx/client

cd nginx的原始程序目录

./configure \ --prefix=/usr/local/nginx \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/temp/nginx/client \ --http-proxy-temp-path=/var/temp/nginx/proxy \ --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \ --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \ --http-scgi-temp-path=/var/temp/nginx/scgi \ --add-module=/opt/fastdfs-nginx-module/src
./configure --add-module=/opt/fastdfs-nginx-module/src

配置成功

编译

[root@localhost nginx-1.12.2]# make

安装

[root@localhost nginx-1.12.2]# make install

3 编辑nginx.conf

vim /usr/local/nginx/conf/nginx.conf

server {         listen       80;         server_name  file.gmall.com;         #charset koi8-r;         #access_log  logs/host.access.log  main;         location / {             root   html;             index  index.html index.htm;         }         location /group1/M00/ {              ngx_fastdfs_module;         }

启动nginx

/usr/local/nginx/sbin/nginx

设置开机启动

[root@iZ2zednyjjxxq7k3i2dwsfZ nginx-1.12.2]# vim /etc/rc.d/rc.local

需要关闭防火墙

service iptables stop

永久关闭 chkconfig  iptables  off

测试

/usr/bin/fdfs_test /etc/fdfs/client.conf upload /root/ty.jpg

显示结果:

4  问题排查

打开vim /usr/local/nginx/conf/nginx.conf

然后去logs/error.log 查看报错。

四、 附:nginx注册服务脚本

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

图片转存中…(img-ZJRE6OaP-1714155949963)]
[外链图片转存中…(img-ekEKo691-1714155949963)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

  • 26
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是Linux FastDFS安装配置的步骤: 1.下载FastDFS安装包并解压缩: ```shell wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz tar -zxvf V5.11.tar.gz ``` 2.安装libfastcommon: ```shell cd fastdfs-5.11/libfastcommon/ ./make.sh ./make.sh install ``` 3.安装FastDFS: ```shell cd ../fastdfs/ ./make.sh ./make.sh install ``` 4.配置Tracker服务器: ```shell cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf vi /etc/fdfs/tracker.conf ``` 在tracker.conf中修改base_path和http.server_port参数,例如: ``` base_path=/data/fastdfs/tracker http.server_port=8080 ``` 5.配置Storage服务器: ```shell cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf vi /etc/fdfs/storage.conf ``` 在storage.conf中修改base_path、store_path0、tracker_server参数,例如: ``` base_path=/data/fastdfs/storage store_path0=/data/fastdfs/storage tracker_server=192.168.36.100:22122 tracker_server=192.168.36.103:22122 ``` 6.配置客户端: ```shell cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf vi /etc/fdfs/client.conf ``` 在client.conf中修改base_path和tracker_server参数,例如: ``` base_path=/data/fastdfs/client tracker_server=192.168.36.100:22122 tracker_server=192.168.36.103:22122 ``` 7.配置Nginx: ```shell cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak vi /usr/local/nginx/conf/nginx.conf ``` 在http节点下添加如下配置: ``` location /group1/M00 { root /data/fastdfs/storage/data; ngx_fastdfs_module; } ``` 8.启动Tracker和Storage服务器: ```shell /etc/init.d/fdfs_trackerd start /etc/init.d/fdfs_storaged start ``` 9.测试FastDFS: ```shell echo "Hello, FastDFS!" > test.txt /usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.txt ``` 以上是Linux FastDFS安装配置的步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值