關於分佈式文件系統FastDFS,在這裏不作過多介紹,咱們直接開始安裝c++
1.安裝 libfastcommon git
[root@TEST-01 softwares]# yum -y install wget pcre pcre-devel make zlib zlib-devel gcc-c++ libtool openssl openssl-devel [root@TEST-01 softwares]# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz [root@TEST-01 softwares]# tar -zxvf V1.0.7.tar.gz [root@TEST-01 softwares]# cd libfastcommon-1.0.7/ [root@TEST-01 libfastcommon-1.0.7]# ./make.sh [root@TEST-01 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.安裝 FastDFSgithub
[root@TEST-01 softwares]# wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz [root@TEST-01 softwares]# tar -xvf V5.05.tar.gz [root@TEST-01 softwares]# cd fastdfs-5.05/ [root@TEST-01 fastdfs-5.05]# ./make.sh [root@TEST-01 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 有以上信息就表明安裝成功,建立幾個連接 [root@TEST-01 fastdfs-5.05]# ln -s /usr/bin/fdfs_trackerd /usr/local/bin [root@TEST-01 fastdfs-5.05]# ln -s /usr/bin/stop.sh /usr/local/bin [root@TEST-01 fastdfs-5.05]# ln -s /usr/bin/restart.sh /usr/local/bin [root@TEST-01 fastdfs-5.05]# ln -s /usr/bin/fdfs_storaged /usr/local/bin
這樣就安裝好了FASDFS,接下來咱們進入配置環節bash
3.配置 FastDFSapp
3.1配置tracker服務tcp
[root@TEST-01 fastdfs-5.05]# cd /etc/fdfs/ [root@TEST-01 fdfs]# cp tracker.conf.sample tracker.conf [root@TEST-01 fdfs]# vi tracker.conf 修改base_path .... base_path=/data/fastdfs ..... [root@TEST-01 fdfs]# mkdir /data/fastdfs 啓動tracker服務 [root@TEST-01 fdfs]# service fdfs_trackerd start Starting FastDFS tracker server: [root@TEST-01 fdfs]# netstat -unltp|grep fdfs tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 4418/fdfs_trackerd
3.2配置Storage服務分佈式
[root@TEST-01 fdfs]# cp storage.conf.sample storage.conf [root@TEST-01 fdfs]# vi storage.conf 修改如下三個地方 ... base_path=/data/fastdfs/storage .... store_path0=/data/fastdfs/storage ..... tracker_server=192.168.12.102:22122 .... [root@TEST-01 fdfs]# mkdir /data/fastdfs/storage [root@TEST-01 fdfs]#service fdfs_storaged start [root@TEST-01 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
這樣咱們安裝和配置好了,查下監控,看是否正常 [root@TEST-01 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,說明服務正常 .... ....