标签:
两台服务器,使用的系统为centos7.1,libfastcommon1.07,fastdfs版本为5.05稳定版
两台服务器ip分别是18和50,18作为tracker机器,50作为storage。
sudo yum -y groupinstall ‘Development Tools‘
cd libfastcommon-master
./make.sh
sudo ./make.sh install
cd fastdfs-5.05/
./make.sh
sudo ./make.sh install
useradd fastdfs -M -s /sbin/nologin
useradd nginx -M -s /sbin/nologin
sudo mkdir -p /data/fdfs/
sudo chown -R fastdfs:fastdfs /data/fdfs
sudo cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
sudo vim /etc/fdfs/tracker.conf
# the base path to store data and log files
base_path=/data/fdfs
配置run-user,run group为fastdfs,fastdfs
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
cd /etc/fdfs
sudo cp tracker.conf.sample tracker.conf
#编辑文件tracker.conf
sudo vim tracker.conf
run_by_group=fastdfs
run_by_user=fastdfs
# the base path to store data and log files
base_path=/data/fdfs
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
tracker_server=192.168.1.36:22122
# store_path#, based 0, if store_path0 not exists, it‘s value is base_path
# the paths must be exist
store_path0=/data/fdfs
#store_path1=/home/yuqing/fastdfs2
sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
为50机器添加client配置文件
cd /etc/fdfs sudo cp client.conf.sample client.conf
修改client.conf文件的如下内容
# the base path to store log files base_path=/data/fdfs
# tracker_server can ocur more than once, and tracker_server format is # "host:port", host can be hostname or ip address tracker_server=
192.168.1.
50:22122
sudo mkdir /data/ngx
sudo chown –R fastdfs:fastdfs /data
sudo cp /root/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/
# the base path to store log files base_path=/data/ngx # FastDFS tracker_server can ocur more than once, and tracker_server format is # "host:port", host can be hostname or ip address # valid only when load_fdfs_parameters_from_tracker is true tracker_server=192.168.1.36:22122 # store_path#, based 0, if store_path0 not exists, it‘s value is base_path # the paths must be exist # must same as storage.conf store_path0=/data/fdfs
cp /usr/yKF6600/fastdfs-master/conf/http.conf /usr/yKF6600/fastdfs-master/conf/mime.types /etc/fdfs
修改vi /usr/local/openresty/nginx/conf/nginx.conf
server { listen 80; server_name localhost; charset utf8; location /M00 { alias /data/fdfs/data; ngx_fastdfs_module; } ......
sudo ln -s /data/fdfs/data /data/fdfs/data/M00
sudo /usr/local/openresty/nginx/sbin/nginx -s reload
创建test.html,输入如下内容
test fastdfs
上传测试文件,命令为
/usr/bin/fdfs_test /etc/fdfs/client.conf upload test.html
结果类似为为
This is FastDFS client test program v5.05 Copyright (C) 2008, Happy Fish / YuQing FastDFS may be copied only under the terms of the GNU General Public License V3, which may be found in the FastDFS source kit. Please visit the FastDFS Home Page http://www.csource.org/ for more detail. [2015-04-25 18:06:09] DEBUG - base_path=/data/fdfs, 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 tracker_query_storage_store_list_without_group: server 1. group_name=, ip_addr=192.168.1.36, port=23000 group_name=group1, ip_addr=192.168.1.36, port=23000 storage_upload_by_filename group_name=group1, remote_filename=M00/00/00/wKgC1FU7ZxGAF19vAAAADcvBslg01.html source ip address: 192.168.1.36 file timestamp=2015-04-25 18:06:09 file size=13 file crc32=3418468952 example file url: http://192.168.1.36/group1/M00/00/00/wKgC1FU7ZxGAF19vAAAADcvBslg01.html storage_upload_slave_by_filename group_name=group1, remote_filename=M00/00/00/wKgC1FU7ZxGAF19vAAAADcvBslg01_big.html source ip address: 192.168.1.36 file timestamp=2015-04-25 18:06:09 file size=13 file crc32=3418468952 example file url: http://192.168.1.36/group1/M00/00/00/wKgC1FU7ZxGAF19vAAAADcvBslg01_big.html
curl http://172.16.4.50/M00/00/00/rBAEMlcersyAT4p8AAAADcvBslg24_big.html
得到结果为
test fdfs
http://www.centoscn.com/image-text/install/2015/0429/5298.html
标签:
原文地址:http://www.cnblogs.com/Yin-BloodMage/p/5433629.html