Mac 安装FastDFS说明

说明:暂时使用几台mac作为服务器, 和linux上边安装配置基本一样, 由于mac环境已经安装了依赖, 则可以直接安装FastDFS对应的包;

首先我们需要下载相对应的安装包:

1.安装libfastcommon

  • 我们进入到libfastcommon-master目录中执行./make.shsudo ./make.sh install,具体代码如下:

1、cd /Users/username/Desktop/libfastcommon
2、./make.sh
3、sudo ./make.sh install

2.安装FastDFS

同安装libfastcommon一样,我们先进入到fastdfs-master目录中,执行./make.shsudo ./make.sh install,具体代码如下:

1、cd /Users/username/Desktop/fastdfs
2、./make.sh
3、sudo ./make.sh install

3.配置

安装完成后我们要进行一些配置

  • 配置跟踪服务器tracker
  1. 拷贝tracker配置文件

 

sudo cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf

2.在/home/python/目录中创建目录 fastdfs/tracker

 

mkdir -p /Users/Batac/Desktop/fastdfs/tracker/

3.编辑/etc/fdfs/tracker.conf配置文件

 

sudo vim /etc/fdfs/tracker.conf

修改其中的base_path

 

 base_path=/Users/Batac/Desktop/fastdfs/tracker
  • 配置存储服务器storage
  1. 拷贝storage配置文件

 

sudo cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf

2.在/home/python/目录中创建目录 fastdfs/storage

 

mkdir -p /Users/jincaozhongyao/Desktop/fastdfs/storage

3.编辑/etc/fdfs/storage.conf 配置文件

 

sudo vim /etc/fdfs/storage.conf

修改其中的base_pathstore_path0tracker_server

 

base_path=/Users/Batac/Desktop/fastdfs/storage
store_path0=/Users/Batac/Desktop/fastdfs/storage
tracker_server=Mac的IP地址:22122
  • 启动tracker和storage

 

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

查看是否启动成功

 

ps aux|grep fdfs

 

username   7884   0.0  0.0  4268056    808 s004  S+    8:28下午   0:00.00 grep fdfs
root              7868   0.0  0.4  4383916  66792   ??  S     8:27下午   0:02.14 fdfs_storaged /etc/fdfs/storage.conf restart
root              7855   0.0  0.0  4323576    988   ??  S     8:27下午   0:00.01 fdfs_trackerd /etc/fdfs/tracker.conf restart

如上述显示,则表示启动成功。

  • 测试是否安装成功
  1. 拷贝client配置文件

 

sudo cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf

2.修改client配置文件

 

sudo vim /etc/fdfs/client.conf

修改内容:

 

base_path=/Users/Batac/Desktop/fastdfs/tracker
tracker_server=Mac的IP地址:22122
  1. 上传文件测试

 

 fdfs_upload_file /etc/fdfs/client.conf  要上传的图片 //如:dfs_upload_file /etc/fdfs/client.conf /Users/username/Desktop/batac.png

如果返回类似group1/M00/00/00/wKgATl6C6COAcDjSAAEvbVpTKSU578.png的文件id则说明文件上传成功。

结尾

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章