1. 程式人生 > >FastDFS安裝與nginx反向代理配置

FastDFS安裝與nginx反向代理配置

nginx相關軟體

FastDFS相關軟體

tracker的安裝與配置

以下操作是在 tracker 10.10.10.80上操作。 
通過rz工具或者FileZilla,把軟體上傳到Ubuntu的/usr/local/src目錄下。

安裝libfastcommon

root@tracker:/usr/local/src# unzip libfastcommon-master.zip 
root@tracker:/usr/local/src# cd libfastcommon-master
root@tracker:/usr/local/src/libfastcommon-master# ls
HISTORY INSTALL libfastcommon.spec make.sh php-fastcommon README src root@tracker:/usr/local/src/libfastcommon-master# ./make.sh root@tracker:/usr/local/src/libfastcommon-master# ./make.sh install
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

安裝FastDFS (FastDFS_v5.08.tar.gz)

root@tracker:/usr/local/src# tar zxvf FastDFS_v5.08.tar.gz 
root@tracker
:/usr/local/src# cd FastDFS root@tracker:/usr/local/src/FastDFS# ./make.sh root@tracker:/usr/local/src/FastDFS# ./make.sh install
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

到這裡FastDFS在 tracker上安裝完成,所有的可執行檔案位於 /usr/bin 目錄下,以fdfs開頭的檔案:

[email protected]:~$ ll /usr/bin/fdfs_*
-rwxr-xr-x 1 root root  379725 Jun 16 19:25 /usr/bin/fdfs_appender_test*
-rwxr
-xr-x 1 root root 375174 Jun 16 19:25 /usr/bin/fdfs_appender_test1* -rwxr-xr-x 1 root root 356800 Jun 16 19:25 /usr/bin/fdfs_append_file* -rwxr-xr-x 1 root root 356994 Jun 16 19:25 /usr/bin/fdfs_crc32* -rwxr-xr-x 1 root root 356827 Jun 16 19:25 /usr/bin/fdfs_delete_file* -rwxr-xr-x 1 root root 357754 Jun 16 19:25 /usr/bin/fdfs_download_file* -rwxr-xr-x 1 root root 357928 Jun 16 19:25 /usr/bin/fdfs_file_info* -rwxr-xr-x 1 root root 377621 Jun 16 19:25 /usr/bin/fdfs_monitor* -rwxr-xr-x 1 root root 1313605 Jun 16 19:25 /usr/bin/fdfs_storaged* -rwxr-xr-x 1 root root 389327 Jun 16 19:25 /usr/bin/fdfs_test* -rwxr-xr-x 1 root root 387896 Jun 16 19:25 /usr/bin/fdfs_test1* -rwxr-xr-x 1 root root 539675 Jun 16 19:25 /usr/bin/fdfs_trackerd* -rwxr-xr-x 1 root root 357728 Jun 16 19:25 /usr/bin/fdfs_upload_appender* -rwxr-xr-x 1 root root 363268 Jun 16 19:25 /usr/bin/fdfs_upload_file*
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

所有的配置檔案在 /etc/fdfs/ 目錄下:

[email protected]:~$ ll /etc/fdfs/
total 28
drwxr-xr-x   2 root root 4096 Jun 16 19:33 ./
drwxr-xr-x 117 root root 4096 Jun 16 19:44 ../
-rwxr-xr-x   1 root root 1463 Jun 16 19:32 client.conf.sample
-rwxr-xr-x   1 root root 7927 Jun 16 19:25 storage.conf.sample
-rwxr-xr-x   1 root root 7202 Jun 16 19:33 tracker.conf.sample
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

配置

①進入到 /etc/fdfs 目錄下,將tracker.conf.sample重新命名為tracker.conf。

root@tracker:/etc/fdfs# mv tracker.conf.sample tracker.conf
  • 1
  • 1

②建立資料檔案和日誌檔案目錄

root@tracker:/etc/fdfs# mkdir -pv /data/fastdfs/tracker
mkdir: 已建立目錄 "/data"
mkdir: 已建立目錄 "/data/fastdfs"
mkdir: 已建立目錄 "/data/fastdfs/tracker"
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

③編輯 tracker.conf 檔案,測試的時候只需要修改以下引數即可

disabled=false                        #啟用配置檔案
port=22122                            #設定 tracker 的埠號
base_path=/data/fastdfs/tracker       #設定 tracker 的資料檔案和日誌目錄(需預先建立)
http.server_port=8888                 #設定 http 埠號
這個http.server_port=8888 指的是在tracker伺服器上啟動http服務程序,如:apache或者nginx 啟動時所監聽的埠
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

執行

直接使用 fdfs_trackerd 來啟動tracker程序,然後使用netstat 檢視埠是否起來。

root@tracker:/etc/fdfs# fdfs_trackerd /etc/fdfs/tracker.conf restart
root@tracker:/etc/fdfs# netstat -antp | grep trackerd
tcp   0  0 0.0.0.0:22122   0.0.0.0:*   LISTEN   14520/fdfs_trackerd 
root@tracker:/etc/fdfs# 
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

也可以檢視日誌看服務是否正常執行:

root@tracker:~# cat /data/fastdfs/tracker/logs/trackerd.log
  • 1
  • 1
[2016-06-28 11:55:55] INFO - FastDFS v5.08, base_path=/data/fastdfs/tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=2048, accept_threads=1, work_threads=4, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=0, id_type_in_filename=ip, storage_id_count=0, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, log_file_keep_days=0, store_slave_file_use_link=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
[2016-06-28 11:56:01] INFO - file: tracker_relationship.c, line: 383, selecting leader...
[2016-06-28 11:56:02] INFO - file: tracker_relationship.c, line: 401, I am the new tracker leader 10.10.10.80:22122
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

⑤設定開機自動啟動

root@tracker:/etc# vi rc.local 
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
  • 1
  • 2
  • 1
  • 2

至此tracker上的安裝與配置結束。

storage的安裝與配置

兩臺機器(10.10.10.81, 10.10.10.82)配置完全一樣,以81為例。

安裝

利用上傳 FastDFS_v5.08.tar.gz 和 libfastcommon-master.zip 至 storage伺服器的/usr/local/src 目錄下,解壓安裝 libfastcommon,這個和前面安裝tracker一樣。

安裝libfastcommon
root@storage1:/usr/local/src# unzip libfastcommon-master.zip 
root@storage1:/usr/local/src# cd libfastcommon-master
root@storage1:/usr/local/src/libfastcommon-master# ls
HISTORY  INSTALL  libfastcommon.spec  make.sh  php-fastcommon  README  src
root@storage1:/usr/local/src/libfastcommon-master# ./make.sh 
root@storage1:/usr/local/src/libfastcommon-master# ./make.sh install
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
安裝FastDFS
FastDFS_v5.08.tar.gz
root@storage1:/usr/local/src# tar zxvf FastDFS_v5.08.tar.gz 
root@storage1:/usr/local/src# cd FastDFS
root@storage1:/usr/local/src/FastDFS# ./make.sh
root@storage1:/usr/local/src/FastDFS# ./make.sh install 
  • 相關推薦

    FastDFS安裝nginx反向代理配置

    nginx相關軟體 FastDFS相關軟體 tracker的安裝與配置 以下操作是在 tracker 10.10.10.80上操作。  通過rz工具或者FileZilla,把軟體上傳到Ubuntu的/usr/local/src目錄下。

    nginx反向代理配置

    nginx反向代理配置1.修改nginx.conf配置文件,在 location / {這個行下添加反向代理 location / { proxy_pass http://192.168.2.140:8080/;#就是這行代碼 auth_basic off; auth_basic_us

    CentOS 6下Nginx反向代理配置

    nginxCentOS 6下Nginx反向代理配置By:老寧一、環境介紹Client01:內部服務器Nginx Server:互聯網出口代理服務器二、環境配置Nginx Server配置:[root@Nginx-Server / ]#vim /usr/local/nginx/nginx.confserver{

    nginx反向代理配置詳解

    nginx反向代理配置詳解反向代理配置修改部署目錄下conf子目錄的nginx.conf文件(如/opt/nginx/conf/nginx.conf)內容,可調整相關配置。將默認配置裏面帶#號註釋內容去掉grep -v "#" /opt/nginx/conf/nginx.conf > /opt/ngin

    Nginx反向代理配置(解決跨域問題)

    一. 跨域    指的是瀏覽器不能執行其他網站的指令碼。它是由瀏覽器的同源策略造成的,是瀏覽器對 JavaScript 施加的安全限制。 實際開發過程中表現為,如果本地的Html程式碼未提交到伺服器,本地是不能直接呼叫伺服器 API 獲取資料的。 二. Nginx

    CORS跨域Nginx反向代理

    最近的專案都是關於前後端分離的,當我們把專案橫向分層前後端分離後,由於瀏覽器安全限制會發現請求出現異常,主要原因是瀏覽器的同源策略(協議、域名和埠)是否相同。 解決方案: 解決跨域的方法有很多,如 (1)通過jsonp跨域 (2)通過修改document.domain來跨子域 (3)

    最簡單的nginx反向代理配置

    最簡單的nginx反向代理 server { listen 80; server_name google.ha97.com; location / { proxy_pass http://www.google.com/; proxy_redirect off; proxy_set_h

    Nginx反向代理配置使用筆記

    ubuntu下安裝nginx sudo apt-get install nginx 配置nginx.conf指令碼檔案 新增配置檔案,檔案未位置在/etc/nginx/conf.d 如果要配置https服務,證書也檔案也放在這個檔案目錄下 nginx.conf內容如下:

    Nginx(6) nginx反向代理配置websocket,以及配置後websocket連線後立即斷開的解決方法

    用 proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade"; 配置nginx使之支援websockt的反響代理後,發現websockt連線上就立即斷開了 最後查到原因是proxy_rea

    nginx反向代理配置(包括ssl,https永久跳轉)

    1、web機器配置nginx檔案 worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type applicatio

    Nodejs繫結域名Nginx反向代理

    開啟conf目錄裡的nginx.conf 檔案 –> 新增一段upstream upstream nodejs{ server 127.0.0.1:3000;//你的Express專案埠# server 127.0.0.1:3001;

    使用python自動生成docker nginx反向代理配置

    由於在測試環境上用docker部署了多個應用,而且他們的埠有的相同,有的又不相同,數量也比較多,在使用jenkins發版本的時候,不好配置,於是想要寫一個指令碼,能在docker 容器建立、停止的時候,自動生成nginx反向代理,然後reload nginx

    當“伺服器上部署多個Web應用”,使用Nginx反向代理配置

    當同一伺服器上部署了多個不同的web應用時,可以使用Nginx進行管理配置。 舉個例子:假如 www.aabbccdd.com 站點有好幾個web  App(web應用): finance(金融)、product(產品)、admin(使用者中心)。 訪問這些應用的方式通過

    nginx反向代理配置多個後端服務時的session問題

    今天在部署nginx的時候出現了一個問題: 當nginx中中只部署一個後端服務的時候可以正常登入,但是當部署兩個後端服務的時候,就會出現登入失敗的問題。 一開始查詢,從控制檯檢視,登入使用者名稱傳了個亂碼過去,從而設定了charset屬性,但是還是登入不上去。但將負載均衡

    nginx反向代理配置兩個不同伺服器

    1. 什麼是反向代理: 反向代理伺服器架設在伺服器端,通過緩衝經常被請求的頁面來緩解伺服器的工作量,將客戶機請求轉發給內部網路上的目標伺服器;並將從伺服器上得到的結果返回給Internet上請求連線的客戶端,此時代理伺服器與目標主機一起對外表現為一個伺服器。

    nginx反向代理配置去除字首

    開發十年,就只剩下這套架構體系了! >>>   

    nginx反向代理、負載均衡配置linux環境下的安裝及通過ip和域名訪問nginx

    本文主題: 一、什麼是nginx 二、nginx的應用場景 三、linux環境下nigix的安裝 四、nginx配置虛擬機器(ip、域名) 五、nginx實現反向代理 六、nginx實現負載均衡 一、什麼是nginx 1、http伺服器(通過nginx配置檔案配置

    Linux下的Nginx反向代理安裝配置使用

    本Nginx的安裝配置所在系統是RedHat系的CentOS,下列步驟都預設在root許可權下 Nginx的簡介:Nginx是一款輕量級Web伺服器、也是一款反向代理伺服器,Nginx可直接支援Rails和PHP的程式、可作為HTTP反向代理伺服器、可作為負載均衡伺服器、作

    在centos 7中安裝nginx配置nginx反向代理

    nginx linux proxy 反向代理 Nginx是一款輕量級的Web 服務器/反向代理服務器及電子郵件(IMAP/POP3)代理服務器,並在一個BSD-like 協議下發行。其特點是占有內存少,並發能力強,事實上nginx的並發能力確實在同類型的網頁服務器中表現較好,中國大陸使用ngi

    nginx反向代理服務器以及負載均衡,從安裝配置

    配置文件 scripts 退出vim 錯誤碼 重啟 cal logs 點擊 listening nginx的具體作用不用細說,很強大,做負載均衡、反向代理服務器解決前端跨域問題等等。下面是nginx的安裝過程 首先nginx主要的依賴: 1 pcre、 pcre-d