linux 安装FastDFS,单机配置测试

1.下载安装libfastcommon

git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon/
./make.sh
./make.sh install

2.下载安装fastdfs

wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
tar -zxvf V5.05.tar.gz
cd V5.05
./make.sh
./make.sh install

执行安装后,默认会安装到/usr/bin中,并在/etc/fdfs中添加三个配置文件。

3.修改配置文件

tracker.conf 中修改:
base_path=/home/data/fastdfs/tracker/filelogs  #用于存放日志

storage.conf 中修改:
base_path=/home/data/fastdfs/storage/filelogs   #用于存放日志
store_path0=home/data/fastdfs/storage/filedata   #存放数据
tracker_server=192.168.16.112:22122                #指定tracker服务器地址

client.conf 中同样要修改:
base_path=/usr/lgip_fastdfs/client/logs    #用于存放日志。
tracker_server=192.168.16.112:22122                #指定tracker服务器地址

注:以上的base_path、store_path0的路径均需要进行手动创建。

4.启动tracker和storage

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

5.重启tracker和storage

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

6.停止tracker和storage

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

7.启动成功,测试服务是否正常运行:

上传:/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/upload/123.jpg


下载:/usr/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKgQcFubc46AQX6cAAK7Sl0TZt0735.jpg /home/upload/10002.jpg


删除:/usr/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgQcFubc46AQX6cAAK7Sl0TZt0735.jpg

8.启动测试效果图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 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、付费专栏及课程。

余额充值