購買了阿里雲,部署了雙物理設備、雙tracker、雙storage,系統盤空間不夠,需要額外購買磁盤擴容。新磁盤掛載在/mnt目錄。
步驟1:掛在新的磁盤或存儲到文件服務器根目錄,取名/mnt/data01
步驟2:修改/etc/fdfs/storage.conf配置文件
修改該配置中如下內容
store_path_count=1
store_path0=/data/fastdfs/storage
為
store_path_count=2
store_path0=/data/fastdfs/storage
store_path1=/mnt/data01
步驟3:修改vi /etc/fdfs/mod_fastdfs.conf配置文件
store_path_count=1
store_path0=/data/fastdfs/storage
為
store_path_count=2
store_path0=/data/fastdfs/storage
store_path1=/mnt/data01
步驟4:重啟tracker、storage
注意,步驟1、2、3需要在兩個阿里雲中同時修改,否則storage無法互為備份,進而導致tracker啟動失敗,提示如下錯誤
ERROR - file: tracker_service.c, line: 3550, cmd=84, client ip: 106.15.137.142, package size 32 is not correct, expect length: 16
重啟tracker和storage
fdfs_trackerd /etc/fdfs/tracker.conf restart
fdfs_storaged /etc/fdfs/storage.conf restart
也可以先關閉再啟動
killall fdfs_trackerd
killall fdfs_storaged
fdfs_trackerd /etc/fdfs/tracker.conf
fdfs_storaged /etc/fdfs/storage.conf
步驟5:使用fdfs_monitor查看文件系統狀態,看group是否新增了磁盤空間
查看
total storage
free storage
store_path_count
等項目,看看是否按照期望增加了磁盤空間。
fdfs_monitor /etc/fdfs/storage.conf
[2020-04-08 10:03:12] DEBUG - base_path=/data/fastdfs/storage, connect_timeout=30, network_timeout=60, tracker_server_count=2, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
server_count=2, server_index=0
tracker server is 172.16.178.218:22122
group count: 1
Group 1:
group name = group1
disk total space = 181168 MB
disk free space = 96577 MB
trunk free space = 0 MB
storage server count = 2
active server count = 2
storage server port = 23000
storage HTTP port = 8888
store path count = 2
subdir count per path = 256
current write server index = 1
current trunk file id = 0
Storage 1:
id = 172.16.178.218
ip_addr = 172.16.178.218 ACTIVE
http domain =
version = 5.11
join time = 2019-01-23 11:29:13
up time = 2020-04-07 16:44:35
total storage = 181168 MB
free storage = 96577 MB
upload priority = 10
store_path_count = 2
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 1
connection.max_count = 2
total_upload_count = 27627
success_upload_count = 27627
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 36690817321
success_upload_bytes = 36690817321
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 35951841974
success_sync_in_bytes = 35951841974
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 54744
success_file_open_count = 54744
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 304000
success_file_write_count = 304000
last_heart_beat_time = 2020-04-08 10:02:47
last_source_update = 2020-04-08 09:57:34
last_sync_update = 2020-04-08 10:00:16
last_synced_timestamp = 2020-04-08 10:00:07 (-1s delay)
Storage 2:
id = 172.16.178.219
ip_addr = 172.16.178.219 (iZbp1ibbmohux4asp357shZ) ACTIVE
http domain =
version = 5.11
join time = 2019-01-23 11:29:58
up time = 2020-04-07 16:27:46
total storage = 181168 MB
free storage = 99756 MB
upload priority = 10
store_path_count = 2
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id = 172.16.178.218
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 2
connection.max_count = 2
total_upload_count = 27117
success_upload_count = 27117
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 35951841974
success_upload_bytes = 35951841974
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 36690817321
success_sync_in_bytes = 36690817321
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 54744
success_file_open_count = 54744
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 304001
success_file_write_count = 304001
last_heart_beat_time = 2020-04-08 10:03:00
last_source_update = 2020-04-08 10:00:06
last_sync_update = 2020-04-08 09:57:35
last_synced_timestamp = 2020-04-08 09:57:35 (-1s delay)
步驟6:修改nginx.conf
在配置
location /group1/M00 {
root /data00/data;
ngx_fastdfs_module;
}
后增加
location /group1/M01 {
root /data01/data;
ngx_fastdfs_module;
}
步驟7:重啟nginx
/usr/local/nginx/sbin/nginx -s reload