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則說明文件上傳成功。

結尾

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