爱在莫斯科 发表于 2019-1-31 13:47:22

FastDFS单点在 CentOS 安装部署

  关于分布式文件系统FastDFS,在这里不做过多介绍,我们直接开始安装
  

  1.安装 libfastcommon
# yum -y install wget pcre pcre-devel make zlib zlib-devel gcc-c++ libtoolopenssl openssl-devel
# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
# tar -zxvf V1.0.7.tar.gz
# cd libfastcommon-1.0.7/
# ./make.sh
# ./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
# wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
# tar -xvf V5.05.tar.gz
# cd fastdfs-5.05/
# ./make.sh
# ./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
有以上信息就代表安装成功,创建几个链接
# ln -s /usr/bin/fdfs_trackerd /usr/local/bin
# ln -s /usr/bin/stop.sh /usr/local/bin
# ln -s /usr/bin/restart.sh /usr/local/bin
# ln -s /usr/bin/fdfs_storaged /usr/local/bin  这样就安装好了FASDFS,接下来我们进入配置环节
  3.配置 FastDFS
  3.1配置tracker服务
# cd /etc/fdfs/
# cp tracker.conf.sample tracker.conf
# vi tracker.conf    修改base_path
....
base_path=/data/fastdfs
.....
# mkdir /data/fastdfs
启动tracker服务
# service fdfs_trackerd start
Starting FastDFS tracker server:
# netstat -unltp|grep fdfs
tcp      0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      4418/fdfs_trackerd  

  3.2配置Storage服务
  
# cp storage.conf.sample storage.conf
# vi storage.conf修改以下三个地方
...
base_path=/data/fastdfs/storage
....
store_path0=/data/fastdfs/storage
.....
tracker_server=192.168.12.102:22122
....
# mkdir /data/fastdfs/storage
#service fdfs_storaged start
#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  
这样我们安装和配置好了,查下监控,看是否正常
# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
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.102ACTIVE   #出现这个ACTIVE,说明服务正常
                ....
                ....


页: [1]
查看完整版本: FastDFS单点在 CentOS 安装部署