Linux安装FastDFS

环境:CentOS 7.4.1708
FastDFS版本: 6.04

安装依赖

  • yum -y install gcc gcc+ gcc-c++ openssl openssl-devel pcre pcre-devel

安装 libfastcommon

  1. 下载libfastcommon https://github.com/happyfish100/libfastcommon/releases
  2. 解压并安装libfastcommon:
			tar zxvf libfastcommon-1.0.42.tar.gz
			cd libfastcommon-1.0.42
			./make.sh
			./make.sh install

安装 FastDFS

  1. 下载FastDFS https://github.com/happyfish100/fastdfs/releases
  2. 解压并安装FastDFS:
			tar zxvf fastdfs-6.04.tar.gz
			cd fastdfs-6.04
			./make.sh
			./make.sh install 

配置

进入fastdfs配置文件夹 cd /etc/fdfs

配置tracker服务

  1. 拷贝:cp tracker.conf.sample tracker.conf
  2. 编辑tracker.conf:vim tracker.conf
			#tracker数据文件和日志存储路径,若不存在请自行创建
			base_path=/data/fastdfs/tracker
			#tracker服务端口,默认22122
			port=22122
			# HTTP 服务端口
			http.server_port=8080
  1. 启动: /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start

配置storage服务

  1. 拷贝: cp storage.conf.sample storage.conf
  2. 编辑storage.conf: vim storage.conf
			#storage所在组名称
			group_name=group1
			#storage数据文件和日志目录,若不存在请自行创建
			base_path=/data/fastdfs/storage
			#storage服务的存储路径个数,需要和store_path个数匹配
			store_path_count=1 
			#storage服务的实际文件存储路径
			store_path0=/data/fastdfs/storage_data
			#tracker服务的ip和端口,不要使用127.0.0.1
			tracker_server=192.168.1.168:22122	
  1. 启动:/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
  2. 查看:/usr/bin/fdfs_monitor /etc/fdfs/storage.conf

FastDFS测试

  1. 拷贝:cp client.conf.sample client.conf
  2. 编辑client.conf:vim client.conf
			#tracker服务中配置的路径
			base_path=/data/fastdfs/tracker
			#tracker服务的ip 端口
			tracker_server=192.168.1.168:22122
			#storage服务的实际文件存储路径
			store_path0=/data/fastdfs/storage_data
  1. 测试上传文件123.log:/usr/bin/fdfs_upload_file /etc/fdfs/client.conf 123.log
    上传结果

你可能感兴趣的:(Linux)