1. 程式人生 > >FastDFS單點在 CentOS 安裝部署

FastDFS單點在 CentOS 安裝部署

fastdfs centos 單點

關於分布式文件系統FastDFS,在這裏不做過多介紹,我們直接開始安裝


1.安裝 libfastcommon

[[email protected] softwares]# yum -y install wget pcre pcre-devel make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel 
[[email protected] softwares]# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
[[email protected]
/* */ softwares]# tar -zxvf V1.0.7.tar.gz [[email protected] softwares]# cd libfastcommon-1.0.7/ [[email protected] libfastcommon-1.0.7]# ./make.sh [[email protected] libfastcommon-1.0.7]# ./make.sh install mkdir -p /usr/lib64 install -m 755 libfastcommon.so /usr/lib64 mkdir -p /usr/include/fastcommon install -m 644 common_define.h hash.h chain.h logger.h base64.h shared_func.h pthread_func.h ini_file_reader.h _os_bits.h sockopt.h sched_thread.h http_func.h md5.h local_ip_func.h avl_tree.h ioevent.h ioevent_loop.h fast_task_queue.h fast_timer.h process_ctrl.h fast_mblock.h connection_pool.h /usr/include/fastcommon

2.安裝 FastDFS

[[email protected] softwares]# wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
[[email protected] softwares]# tar -xvf V5.05.tar.gz 
[[email protected] softwares]# cd fastdfs-5.05/ 
[[email protected] fastdfs-5.05]# ./make.sh  
[[email protected]
*/ fastdfs-5.05]# ./make.sh install ..... 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 有以上信息就代表安裝成功,創建幾個鏈接 [[email protected] fastdfs-5.05]# ln -s /usr/bin/fdfs_trackerd /usr/local/bin [[email protected] fastdfs-5.05]# ln -s /usr/bin/stop.sh /usr/local/bin [[email protected] fastdfs-5.05]# ln -s /usr/bin/restart.sh /usr/local/bin [[email protected] fastdfs-5.05]# ln -s /usr/bin/fdfs_storaged /usr/local/bin

這樣就安裝好了FASDFS,接下來我們進入配置環節

3.配置 FastDFS

3.1配置tracker服務

[[email protected] fastdfs-5.05]# cd /etc/fdfs/
[[email protected] fdfs]# cp tracker.conf.sample tracker.conf
[[email protected] fdfs]# vi tracker.conf    修改base_path
....
base_path=/data/fastdfs
.....
[[email protected] fdfs]# mkdir /data/fastdfs
啟動tracker服務
[[email protected] fdfs]# service fdfs_trackerd start
Starting FastDFS tracker server: 
[[email protected] fdfs]# netstat -unltp|grep fdfs
tcp        0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      4418/fdfs_trackerd


3.2配置Storage服務


[[email protected] fdfs]# cp storage.conf.sample storage.conf
[[email protected] fdfs]# vi storage.conf  修改以下三個地方
...
base_path=/data/fastdfs/storage
....
store_path0=/data/fastdfs/storage
.....
tracker_server=192.168.12.102:22122
....

[[email protected] fdfs]# mkdir /data/fastdfs/storage
[[email protected] fdfs]#service fdfs_storaged start
[[email protected] fdfs]#netstat -unltp|grep fdfs
tcp        0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      4418/fdfs_trackerd  
tcp        0      0 0.0.0.0:23000               0.0.0.0:*                   LISTEN      4728/fdfs_storaged

這樣我們安裝和配置好了,查下監控,看是否正常

[[email protected] fdfs]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[2017-06-22 18:12:53] DEBUG - base_path=/data/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 192.168.12.102:22122

group count: 1

Group 1:
group name = group1
disk total space = 936559 MB
disk free space = 777572 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 = 192.168.12.102
                ip_addr = 192.168.12.102  ACTIVE     #出現這個ACTIVE,說明服務正常
                
                ....
                ....

本文出自 “xiangcun168” 博客,請務必保留此出處http://xiangcun168.blog.51cto.com/4788340/1941060

FastDFS單點在 CentOS 安裝部署