(轉)fastdfs group通過添加硬盤擴容


 

通過給group的機器添加硬盤的方式,實現某個group的擴容。

 

fastdfs在一台服務器支持多個store_path,每個store_path指向一個存儲路徑。url “M00/3F/E1/oYYBAFXfyuOABOf5AAAHoDwhqE0491.txt”中M00表示使用store_path0,如果沒有配置store_path,就使用base_path的路徑。

 

添加了硬盤后,通過把新的store_path指向新硬盤的掛載點,再修改配置文件,就能實現group的擴容。


原來的fdfs的base_path路徑為/data/fdfs_store
現在假設添加了一個硬盤,掛載到/data1上,指定/data1/fdfs_store為store_path1

如果有fdfs相關的定時任務先關掉。

 

修改/etc/fdfs/storage.conf:

 

[plain]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. # path(disk or mount point) count, default value is 1  
  2. store_path_count=2  
  3.   
  4. # store_path#, based 0, if store_path0 not exists, it's value is base_path  
  5. # the paths must be exist  
  6. store_path0=/data/fdfs_store  
  7. store_path1=/data1/fdfs_store  


修改/etc/fdfs/mod_fastdfs.conf:

 

 

[plain]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. # path(disk or mount point) count, default value is 1  
  2. store_path_count=2  
  3.   
  4. # store_path#, based 0, if store_path0 not exists, it's value is base_path  
  5. # the paths must be exist  
  6. store_path0=/data/fdfs_store  
  7. store_path1=/data1/fdfs_store  


在nginx的配置文件中添加新store_path的路徑:

 

 

[plain]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. location ~* /M01 {  
  2.         root  /data1/fdfs_store/data;  
  3.         ngx_fastdfs_module;  
  4. }  

 

 

 

 

重啟服務:

 

[plain]  view plain  copy
 
 在CODE上查看代碼片派生到我的代碼片
  1. killall fdfs_storaged  
  2. killall fdfs_trackerd  
  3. /usr/local/fastdfs-5.05/tracker/fdfs_trackerd /etc/fdfs/tracker.conf    
  4. /usr/local/fastdfs-5.05/storage/fdfs_storaged /etc/fdfs/storage.conf  

 

 

如果有問題,試着刪除 fastdfs服務器data目錄 下的數據。

 

完成后也要重啟nginx,這樣才能訪問新的store_path的文件。

 

注意,有時候通過fdfs_monitor 發現store_path的配置不生效,這時,必須要刪除tracker目錄下的兩個文件:storage_groups_new.dat,storage_servers_new.dat再重啟服務。

cat storage_servers_new.dat

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM