关于分布式文件系统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,说明服务正常 .... ....
时间: 2024-10-13 14:52:27