CentOS7.3搭建FastDFS V5.11(二)
1.CentOS7 FastDFS搭建
前面已下載好了要用到的工具集,下面就可以開始安裝了:
如果安裝過程中出現問題,可以下載我提供的,當前測試可以通過的工具包:
1.1 安裝libfastcommon
安裝成功後解壓libfastcommon-master.zip
unzip libfastcommon-master.zip
[root@sybmfw12-lnsy libfastcommon-1.0.36]# ll
drwxr-xr-x. 2 root root 4096 4月 5 2017 doc
-rw-r--r--. 1 root root 8005 4月 5 2017 HISTORY
-rw-r--r--. 1 root root 566 4月 5 2017 INSTALL
-rw-r--r--. 1 root root 1606 4月 5 2017 libfastcommon.spec
-rwxr-xr-x. 1 root root 3099 4月 5 2017 make.sh
drwxr-xr-x. 2 root root 4096 4月 5 2017 php-fastcommon
-rw-r--r--. 1 root root 2763 4月 5 2017 README
drwxr-xr-x. 3 root root 4096 11月 8 12:30 src
當我們./make.sh的時候可能會提示,gcc命令沒有找到。
用yum安裝gcc:
yum -y install gcc-c++
這個時候分別執行./make.sh和./make.sh install,正常情況是可以成功的。
libfastcommon預設會被安裝到/usr/lib64/libfastcommon.so但是FastDFS的主程式卻在/usr/local/lib目錄下
這個時候我們就要建立一個軟連結了,實際上也相當於windows上的快捷方式。
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
1.2安裝FastDFS
解壓FastDFS安裝包
unzip fastdfs-5.11.zip
解壓後看到:
[root@sybmfw12-lnsy fastdfs-5.11]# ll
總用量 136
drwxr-xr-x. 3 root root 4096 11月 8 12:32 client
drwxr-xr-x. 2 root root 4096 11月 8 12:32 common
drwxr-xr-x. 2 root root 4096 6月 3 21:09 conf
-rw-r--r--. 1 root root 35067 6月 3 21:09 COPYING-3_0.txt
-rw-r--r--. 1 root root 3171 6月 3 21:09 fastdfs.spec
-rw-r--r--. 1 root root 33100 6月 3 21:09 HISTORY
drwxr-xr-x. 2 root root 4096 6月 3 21:09 init.d
-rw-r--r--. 1 root root 7755 6月 3 21:09 INSTALL
-rwxr-xr-x. 1 root root 5548 6月 3 21:09 make.sh
drwxr-xr-x. 2 root root 4096 6月 3 21:09 php_client
-rw-r--r--. 1 root root 2380 6月 3 21:09 README.md
-rwxr-xr-x. 1 root root 1768 6月 3 21:09 restart.sh
-rwxr-xr-x. 1 root root 1680 6月 3 21:09 stop.sh
drwxr-xr-x. 4 root root 4096 11月 8 12:32 storage
drwxr-xr-x. 2 root root 4096 6月 3 21:09 test
drwxr-xr-x. 2 root root 4096 11月 8 12:32 track
進到剛解壓的目錄:
cd fastdfs-5.11
./make.sh
./make.sh install
如果沒有報錯那麼就成功了。安裝log中會提示FastDFS安裝到了/etc/fdfs目錄下。
成功後檢視安裝目錄:
[root@sybmfw12-lnsy fastdfs-5.11]# ll /etc/fdfs/
-rw-r--r--. 1 root root 1463 11月 8 12:52 client.conf.sample
-rw-r--r--. 1 root root 7938 11月 8 14:55 storage.conf.sample
-rw-r--r--. 1 root root 7397 11月 8 12:36 tracker.conf.sample
我們需要把這三個示例檔案複製一份,去掉.sample
cp client.conf.sample client.conf
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf
FastDFS安裝結束。
1.3安裝tracker
1.3.1建立tracker工作目錄
這個目錄可以自定義,用來儲存tracker的data和log
根據個人習慣,我建立了下面的目錄:
mkdir /opt/fastdfs_tracker
1.3.2 配置tracker
vim /etc/fdfs/tracker.conf
開啟後重點關注下面4個配置:
1.disabled=false
2.port=22122 #預設埠號
3.base_path=/opt/fastdfs_tracker #我剛剛建立的目錄
4.http.server_port=8080 #預設埠是8080
5.bind_addr= 0.0.0.0 監聽地址
修改完的檔案為:
disabled=false
bind_addr= 0.0.0.0
port=22122
connect_timeout=30
network_timeout=60
base_path=/opt/fastdfs_tracker
max_connections=512
accept_threads=1
work_threads=4
min_buff_size = 8KB
max_buff_size = 128KB
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 10%
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
trunk_init_check_occupying = false
trunk_init_reload_from_binlog = false
trunk_compress_binlog_min_interval = 0
use_storage_id = false
storage_ids_filename = storage_ids.conf
id_type_in_filename = ip
store_slave_file_use_link = false
rotate_error_log = false
error_log_rotate_time=00:00
rotate_error_log_size = 0
log_file_keep_days = 0
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html
1.3.3啟動tracker
儲存配置後啟動tracker,命令如下:
service fdfs_trackerd start
成功後應該可以看到:
[root@sybmfw12-lnsy fastdfs-5.11]#service fdfs_trackerd start
Starting fdfs_trackerd (via systemctl): [ OK ]
進行剛剛建立的tracker目錄,發現目錄中多了data和log兩個目錄
[root@sybmfw12-lnsy fastdfs-5.11]# ll /opt/fastdfs_tracker/
drwxr-xr-x. 2 root root 4096 11月 8 15:01 data
drwxr-xr-x. 2 root root 4096 11月 8 12:37 logs
最後我們需要給tracker加入開機啟動
echo "service fdfs_trackerd start" |tee -a /etc/rc.d/rc.local
檢視一下tracker的埠監聽情況
[root@sybmfw12-lnsy fastdfs-5.11]# netstat -unltp|grep fdfs
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 70382/fdfs_trackerd
埠22122成功監聽。
1.4 安裝storage
storage的安裝與tracker很類似。
1.4.1 為storage配置工作目錄
與tracker不同的是,由於storage還需要一個目錄用來儲存資料,所以我另外多建了兩個目錄fastdfs_storage_data,fastdfs_storage
下面是我的目錄結構:
[root@sybmfw12-lnsy fastdfs-5.11]# ll /opt/
drwxr-xr-x. 4 root root 4096 11月 8 12:48 fastdfs_storage
drwxr-xr-x. 3 root root 4096 11月 8 15:02 fastdfs_storage_data
drwxr-xr-x. 4 root root 4096 11月 8 12:37 fastdfs_tracker
1.4.2 修改storage配置檔案
修改storage.conf
1.disabled=false
2.group_name=group1 #組名,根據實際情況修改
3.port=23000 #設定storage的埠號,預設是23000,同一個組的storage埠號必須一致
4.base_path=/opt/fastdfs_storage #設定storage資料檔案和日誌目錄
5.store_path_count=1 #儲存路徑個數,需要和store_path個數匹配
6.store_path0=/opt/fastdfs_storage_data #實際檔案儲存路徑
7.tracker_server=172.20.132.57:22122 #我CentOS7的ip地址
8.http.server_port=8888 #設定 http 埠號
修改完的檔案為:
disabled=false
group_name=group1
bind_addr= 0.0.0.0
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/opt/fastdfs_storage
max_connections=256
buff_size = 256KB
accept_threads=1
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/opt/fastdfs_storage_data
subdir_count_per_path=256
tracker_server=172.20.132.57:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
file_signature_method=hash
key_namespace=FastDFS
keep_alive=0
use_access_log = false
rotate_access_log = false
access_log_rotate_time=00:00
rotate_error_log = false
error_log_rotate_time=00:00
rotate_access_log_size = 0
rotate_error_log_size = 0
log_file_keep_days = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=8888
修改儲存後建立軟引用
ln -s /usr/bin/fdfs_storaged /usr/local/bin
1.4.3 啟動storage
service fdfs_storaged start
Starting fdfs_storaged (via systemctl): [ OK ]
同樣的,設定開機啟動:
修改rc.local
echo "service fdfs_storaged start" |tee -a /etc/rc.d/rc.local
檢視一下服務是否啟動
[root@sybmfw12-lnsy fastdfs-5.11]#netstat -unltp | grep fdfs
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 2231/fdfs_trackerd
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 2323/fdfs_storaged
服務已正常啟動。
1.4.4 校驗整合
到這裡,fastdfs的東西都已安裝完成,最後我們還要確定一下,storage是否註冊到了tracker中去。
檢視命令:
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
成功後可以看到:
ip_addr = 172.20.132.57 (localhost.localdomain) ACTIVE
[root@sybmfw12-lnsy fastdfs-5.11]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[2017-11-08 18:05:55] DEBUG - base_path=/opt/fastdfs_storage, connect_timeout=30, network_timeout=60, tracker_server_count=1, 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=1, server_index=0
tracker server is 172.20.132.57:22122
group count: 1
Group 1:
group name = group1
disk total space = 34140 MB
disk free space = 29282 MB
trunk free space = 0 MB
storage server count = 1
active server count = 1
storage server port = 23000
storage HTTP port = 8888
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 172.20.132.57
ip_addr = 172.20.132.57 (sybmfw12-lnsy) ACTIVE
http domain =
version = 5.11
join time = 2017-11-08 12:48:05
up time = 2017-11-08 15:02:04
total storage = 34140 MB
free storage = 29282 MB
upload priority = 10
store_path_count = 1
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 = 0
connection.max_count = 1
total_upload_count = 2
success_upload_count = 2
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 = 179368
success_upload_bytes = 179368
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 = 0
success_sync_in_bytes = 0
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 2
success_file_open_count = 2
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 2
success_file_write_count = 2
last_heart_beat_time = 2017-11-08 18:05:37
last_source_update = 2017-11-08 15:24:21
last_sync_update = 1970-01-01 08:00:00
last_synced_timestamp = 1970-01-01 08:00:00
相關文章
- CentOS7.3搭建FastDFS V5.11(一)CentOSAST
- CentOS7.3搭建FastDFS V5.11(三)CentOSAST
- DFS 避坑手記 (docker 搭建 fastDFS 教程 / 在 CentOS 上搭建 FastDFS+nginx)DockerASTCentOSNginx
- 使用tomcat搭建Jenkins環境(centos7.3)TomcatJenkinsCentOS
- CentOS7.3 編譯搭建 lamp 環境CentOS編譯LAMP
- FastDFS+Nginx搭建分散式圖片儲存ASTNginx分散式
- CentOS7.3下載,CentOS7.3 iso下載CentOS
- 【FastDFS】小夥伴們說在CentOS 8伺服器上搭建FastDFS環境總報錯?ASTCentOS伺服器
- FastDFS視訊教程-如何用FastDFS一步步搭建檔案管理系統AST
- 騰訊雲centos7下搭建fastDFS+nginxCentOSASTNginx
- 分散式檔案系統fastdfs_搭建和基本使用分散式AST
- FastDFS一步步搭建儲存伺服器AST伺服器
- centos7.3安裝redisCentOSRedis
- FastDFS NET示例AST
- CentOS7.3怎麼安裝?使用DVD ISO映象安裝CentOS7.3的方法CentOS
- CentOS7.3 安裝 MySQL 5.7.24CentOSMySql
- fastdfs管理工具Go-fastdfs-web 安裝教程ASTGoWeb
- fastdfs資料遷移以及fastdfs問題排查記錄AST
- 一、 Fastdfs介紹AST
- 三、 FastDFS功能原理AST
- linux安裝fastdfsLinuxAST
- FastDFS 技術整理AST
- FastDFS-nginx外掛作為FastDFS客戶端訪問ASTNginx客戶端
- 【FastDFS】SpringBoot整合FastDFS實戰,我只看這一篇!!ASTSpring Boot
- CentOS7.3 安裝 MySQL5.7CentOSMySql
- 分散式檔案儲存FastDFS(七)FastDFS配置檔案詳解分散式AST
- FastDFS入門小DemoAST
- FastDFS簡介,運用AST
- CentOS7.3 安裝配置 Nginx、MariaDB、PHPCentOSNginxPHP
- Centos7.3編譯RAID驅動(一)CentOS編譯AI
- MVVM框架的搭建(二)——專案搭建MVVM框架
- CentOS 7.0 之 FastDFS安裝CentOSAST
- spring-boot 中使用 FastDFSSpringbootAST
- Fastdfs資料遷移方案AST
- Principle for Mac(快速原型動畫設計軟體) v5.11(5023)Mac原型動畫
- Laravel 使用 FastDFS 上傳圖片LaravelAST
- springboot(十八):使用Spring Boot整合FastDFSSpring BootAST
- FastDFS依賴無法匯入AST