关于分布式文件系统FastDFS,在这里不做过多介绍,我们直接开始安装
1.安装 libfastcommon
[root@TEST-01softwares]#yum-yinstallwgetpcrepcre-develmakezlibzlib-develgcc-c++libtoolopensslopenssl-devel [root@TEST-01softwares]#wgethttps://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz [root@TEST-01softwares]#tar-zxvfV1.0.7.tar.gz [root@TEST-01softwares]#cdlibfastcommon-1.0.7/ [root@TEST-01libfastcommon-1.0.7]#./make.sh [root@TEST-01libfastcommon-1.0.7]#./make.shinstall mkdir-p/usr/lib64 install-m755libfastcommon.so/usr/lib64 mkdir-p/usr/include/fastcommon install-m644common_define.hhash.hchain.hlogger.hbase64.hshared_func.hpthread_func.hini_file_reader.h_os_bits.hsockopt.hsched_thread.hhttp_func.hmd5.hlocal_ip_func.havl_tree.hioevent.hioevent_loop.hfast_task_queue.hfast_timer.hprocess_ctrl.hfast_mblock.hconnection_pool.h/usr/include/fastcommon
2.安装 FastDFS
[root@TEST-01softwares]#wgethttps://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz [root@TEST-01softwares]#tar-xvfV5.05.tar.gz [root@TEST-01softwares]#cdfastdfs-5.05/ [root@TEST-01fastdfs-5.05]#./make.sh [root@TEST-01fastdfs-5.05]#./make.shinstall ..... 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.htracker_client.hstorage_client.hstorage_client1.hclient_func.hclient_global.hfdfs_client.h/usr/include/fastdfs if[!-f/etc/fdfs/client.conf.sample];thencp-f../conf/client.conf/etc/fdfs/client.conf.sample;fi 有以上信息就代表安装成功,创建几个链接 [root@TEST-01fastdfs-5.05]#ln-s/usr/bin/fdfs_trackerd/usr/local/bin [root@TEST-01fastdfs-5.05]#ln-s/usr/bin/stop.sh/usr/local/bin [root@TEST-01fastdfs-5.05]#ln-s/usr/bin/restart.sh/usr/local/bin [root@TEST-01fastdfs-5.05]#ln-s/usr/bin/fdfs_storaged/usr/local/bin
这样就安装好了FASDFS,接下来我们进入配置环节
3.配置 FastDFS
3.1配置tracker服务
[root@TEST-01fastdfs-5.05]#cd/etc/fdfs/ [root@TEST-01fdfs]#cptracker.conf.sampletracker.conf [root@TEST-01fdfs]#vitracker.conf修改base_path .... base_path=/data/fastdfs ..... [root@TEST-01fdfs]#mkdir/data/fastdfs 启动tracker服务 [root@TEST-01fdfs]#servicefdfs_trackerdstart StartingFastDFStrackerserver: [root@TEST-01fdfs]#netstat-unltp|grepfdfs tcp000.0.0.0:221220.0.0.0:*LISTEN4418/fdfs_trackerd
3.2配置Storage服务
[root@TEST-01fdfs]#cpstorage.conf.samplestorage.conf [root@TEST-01fdfs]#vistorage.conf修改以下三个地方 ... base_path=/data/fastdfs/storage .... store_path0=/data/fastdfs/storage ..... tracker_server=192.168.12.102:22122 .... [root@TEST-01fdfs]#mkdir/data/fastdfs/storage [root@TEST-01fdfs]#servicefdfs_storagedstart [root@TEST-01fdfs]#netstat-unltp|grepfdfs tcp000.0.0.0:221220.0.0.0:*LISTEN4418/fdfs_trackerd tcp000.0.0.0:230000.0.0.0:*LISTEN4728/fdfs_storaged
这样我们安装和配置好了,查下监控,看是否正常 [root@TEST-01fdfs]#/usr/bin/fdfs_monitor/etc/fdfs/storage.conf [2017-06-2218: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_keylength=0,use_connection_pool=0,g_connection_pool_max_idle_time=3600s,use_storage_id=0,storageserveridcount:0 server_count=1,server_index=0 trackerserveris192.168.12.102:22122 groupcount:1 Group1: groupname=group1 disktotalspace=936559MB diskfreespace=777572MB trunkfreespace=0MB storageservercount=1 activeservercount=1 storageserverport=23000 storageHTTPport=8888 storepathcount=1 subdircountperpath=256 currentwriteserverindex=0 currenttrunkfileid=0 Storage1: id=192.168.12.102 ip_addr=192.168.12.102ACTIVE#出现这个ACTIVE,说明服务正常 .... ....