Fast DFS安装(3个storage server,2个trackerserver,安装在3个虚拟机上)
tracker安装
wget https://codeload.github.com/happyfish100/libfastcommon/zip/master -O libfastcommon-master.zip
unzip libfastcommon-master.zip
cd libfastcommon-master/
./make.sh
./make.sh install
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
wget https://codeload.github.com/happyfish100/fastdfs/tar.gz/V5.10 -O fastdfs-5.10.tar.gz
tar -xvf fastdfs-5.10.tar.gz
cd fastdfs-5.10/
./make.sh
./make.sh install
mv -f /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
mv -f /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
mv -f /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
mkdir -p /opt/fastdfs_tracker
sed -i 's$base_path=/home/yuqing/fastdfs$base_path=/opt/fastdfs_tracker$g' /etc/fdfs/tracker.conf
sed -i 's$store_group=group2$store_group=westone$g' /etc/fdfs/tracker.conf
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
#开机启动
cat >> /etc/rc.d/rc.local <<EOF
service fdfs_trackerd start
EOF
chmod +x /etc/rc.d/rc.local
service fdfs_trackerd start
service fdfs_trackerd status 或者 ps -ef | grep fdfs
storage安装
网盘存储节点的安装与网盘控制节点的安装完全一样,不同的是配置方式
mkdir /opt/fastdfs_storage
mkdir /opt/fastdfs_storage_data
sed -i 's$group_name=group1$group_name=westone$g' /etc/fdfs/storage.conf
sed -i 's$base_path=/home/yuqing/fastdfs$base_path=/opt/fastdfs_storage$g' /etc/fdfs/storage.conf
sed -i 's$store_path0=/home/yuqing/fastdfs$store_path0=/opt/fastdfs_storage_data$g' /etc/fdfs/storage.conf
#注意替换192.168.6.117~119三个节点为对应的tracker节点ip
sed -i 's$tracker_server=192.168.209.121:22122$tracker_server=192.168.6.117:22122\ntracker_server=192.168.6.118:22122\ntracker_server=192.168.6.119:22122$g' /etc/fdfs/storage.conf
ln -s /usr/bin/fdfs_storaged /usr/local/bin
ln -s /usr/bin/stop.sh /usr/local/bin
ln -s /usr/bin/restart.sh /usr/local/bin
#加入开机启动
cat >> /etc/rc.d/rc.local <<EOF
service fdfs_storaged start
EOF
chmod +x /etc/rc.d/rc.local
#启动storage
service fdfs_storaged start
#检查storage是否启动
service fdfs_storaged status 或者 ps -ef | grep fdfs
测试
sed -i 's$base_path=/home/yuqing/fastdfs$base_path=/opt/fastdfs_tracker$g' /etc/fdfs/client.conf
#注意替换192.168.6.117~119三个节点为对应的tracker节点ip
sed -i 's$tracker_server=192.168.0.197:22122$tracker_server=192.168.6.117:22122\ntracker_server=192.168.6.118:22122\ntracker_server=192.168.6.119:22122$g' /etc/fdfs/client.conf
#集群状态检查
/usr/bin/fdfs_monitor /etc/fdfs/client.conf
#上传文件测试
[root@node117 opt]# echo "fastdfs" > test.txt
[root@node117 opt]# fdfs_upload_file /etc/fdfs/client.conf test.txt
westone/M00/00/00/wKgGdV8jr4SAGLthAAAACOIew5U501.txt
#任意节点查看文件是否存在
[root@node117 00]# ll /opt/fastdfs_storage_data/data/00/00
total 4
-rw-r--r-- 1 root root 8 Jul 31 13:43 wKgGdV8jr4SAGLthAAAACOIew5U501.txt
[root@node117 00]#
#下载文件测试(另存为aaaaa.txt)
fdfs_download_file /etc/fdfs/client.conf westone/M00/00/00/wKgGdV8jr4SAGLthAAAACOIew5U501.txt aaaaa.txt
#删除文件测试
[root@node117 opt]# fdfs_delete_file /etc/fdfs/client.conf westone/M00/00/00/wKgGdV8jr4SAGLthAAAACOIew5U501.txt
[root@node117 opt]# ll /opt/fastdfs_storage_data/data/00/00
total 0
[root@node117 opt]#