fastdfs編譯安裝

docker部署

tracker安裝(192.168.1.177)

  [root@localhost usr]# unzip libfastcommon-master.zip
  [root@localhost usr]# cd libfastcommon-master
  [root@localhost usr]# ./make.sh
  [root@localhost usr]# ./make.sh install
  [root@localhost usr]# yum install perl 
  • 編譯安裝fastdfs
 [root@localhost usr] # tar -zxvf fastdfs-5.08.tar.gz
  [root@localhost usr] # cd fastdfs-5.08
  [root@localhost fastdfs-5.08] # ./make.sh
  [root@localhost fastdfs-5.08] # ./make.sh  install
  [root@localhost fastdfs-5.08]# ./make.sh  install
  mkdir -p /usr/bin
  mkdir -p /etc/fdfs
  cp -f fdfs_trackerd /usr/bin
  if [ ! -f /etc/fdfs/tracker.conf.sample ]; then cp -f ../conf/tracker.conf /etc/fdfs/tracker.conf.sample; fi
  mkdir -p /usr/bin
  mkdir -p /etc/fdfs
  cp -f fdfs_storaged  /usr/bin
  if [ ! -f /etc/fdfs/storage.conf.sample ]; then cp -f ../conf/storage.conf /etc/fdfs/storage.conf.sample; fi
  mkdir -p /usr/bin
  mkdir -p /etc/fdfs
  mkdir -p /usr/lib64
  mkdir -p /usr/lib
  cp -f fdfs_monitor fdfs_test fdfs_test1 fdfs_crc32 fdfs_upload_file fdfs_download_file fdfs_delete_file fdfs_file_info fdfs_appender_test fdfs_appender_test1 fdfs_append_file fdfs_upload_appender /usr/bin
  if [ 0 -eq 1 ]; then cp -f libfdfsclient.a /usr/lib64; cp -f libfdfsclient.a /usr/lib/;fi
  if [ 1 -eq 1 ]; then cp -f libfdfsclient.so /usr/lib64; cp -f libfdfsclient.so /usr/lib/;fi
  mkdir -p /usr/include/fastdfs
  cp -f ../common/fdfs_define.h ../common/fdfs_global.h ../common/mime_file_parser.h ../common/fdfs_http_shared.h ../tracker/tracker_types.h ../tracker/tracker_proto.h ../tracker/fdfs_shared_func.h ../storage/trunk_mgr/trunk_shared.h tracker_client.h storage_client.h storage_client1.h client_func.h client_global.h fdfs_client.h /usr/include/fastdfs
  if [ ! -f /etc/fdfs/client.conf.sample ]; then cp -f ../conf/client.conf /etc/fdfs/client.conf.sample; fi

如出現(xiàn)以上信息,說明安裝成功。

fastDFS命令目錄:/usr/bin

fastDFS配置文件目錄:/etc/fdfs

  • 創(chuàng)建fastdfs數(shù)據(jù)目錄
  mkdir -pv /data/fastdfs/tracker
  • 修改tracker.conf中的 base_path=/data/fastdfs/tracker,即剛才配置的數(shù)據(jù)文件目錄
 cp etc/fdfs/tracker.conf.sample etc/fdfs/tracker.conf
 vi  etc/fdfs/tracker.conf
  • 啟動(dòng)FASTDFS
  cd  /usr/bin
  fdfs_trackerd /etc/fdfs/tracker.conf restart
  • 驗(yàn)證,默認(rèn)端口是22122
  [root@localhost bin]# netstat -antp|grep trackerd
  tcp        0      0 0.0.0.0:22122           0.0.0.0:*               LISTEN      31046/fdfs_trackerd 

storage安裝(192.168.1.188,192.168.1.189)

storage的安裝與tracker安裝類似,首先編譯安裝fastdfs,然后修改配置文件。

  • 創(chuàng)建配置文件
  cp etc/fdfs/storage.conf.sample etc/fdfs/storage.conf
  vi  etc/fdfs/storage.conf
  • 修改tracker.conf中的
  disabled=false #啟用配置文件
  group_name=group1 #組名,根據(jù)實(shí)際情況修改
  port=23000 #設(shè)置 storage 的端口號
  base_path=/data/fastdfs/storage #設(shè)置 storage 的日志目錄(需預(yù)先創(chuàng)建)
  store_path_count=1 #存儲路徑個(gè)數(shù),需要和 store_path 個(gè)數(shù)匹配
  store_path0=/data/fastdfs/storage #存儲路徑
  tracker_server=192.168.1.177:22122 #tracker 服務(wù)器的 IP 地址和端口號
  • 啟動(dòng)
 cd /usr/bin
  ./fdfs_storaged  /etc/fdfs/storage.conf restart

在storage節(jié)點(diǎn)上安裝nginx,增加http下載支持

  • 編譯安裝nginx,下載prce、zlib、fastdfs-nginx-module依賴支持,上傳到storage的usr/local/src目錄下。fastdfs-nginx-module主要用于解決同一組內(nèi)文件同步不及時(shí)的問題。

修改 fastdfs-nginx-module-1.20/src/config文件 整個(gè)文件改成如下

ngx_addon_name=ngx_http_fastdfs_module

if test -n "${ngx_module_link}"; then
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
else
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
fi
  • 復(fù)制 fastdfs/conf/http.conf mime.types 兩個(gè)文件到/etc/fdfs/
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容