Ubuntu下部署FastDFS 5.05
来源:互联网 发布:json转java对象 在线 编辑:程序博客网 时间:2024/05/22 02:00
很早前得知这样一个开源分布式的文件存储方案,一直没有正式的使用过,正好这次相册升级可以试试了,起初以为fastdfs也是通过block来优化小文件存储的,实际上也是文件形式管理,可以预见大量的小文件还是会有问题,可能更好的解决方案是淘宝TFS。不过fastdfs已远远满足我的需求了。而且及其轻量,这货在google code上早已停止更新,最新的版本可以在这里获取,目前下载的最新版本是5.05,更新于2014-12-02。在这里可以找到更多的说明。
下载好后,server端分为两个部分,一个是tracker,一个是storage。顾名思义,前者调度管理,负载均衡,后者则是实际的存储节点。两个都能做成集群,以防止单点故障。以前的4.x版本依赖libevent,现在不需要了,只需要libfastcommon。安装方法如下:
1. 下载安装libfastcommon
git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon/
./make.sh
./make.sh install
确认make没有错误后,执行安装,64位系统默认会复制到/usr/lib64下。
这时候需要设置环境变量或者创建软链接
export LD_LIBRARY_PATH=/usr/lib64/
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
2. 下载安装fastdfs
tar xzf FastDFS.tar.gz
cd FastDFS/
./make.sh
./make.sh install
确认make没有错误后,执行安装,默认会安装到/usr/bin中,并在/etc/fdfs中添加三个配置文件。
3. 修改配置文件
首先将三个文件的名字去掉sample,暂时只修改以下几点,先让fastdfs跑起来,其余参数调优的时候再考虑。
tracker.conf 中修改
base_path=/usr/fastdfs #用于存放日志。
storage.conf 中修改
base_path=/usr/fastdfs-storaged #用于存放日志。
store_path0=/usr/fastdfs0 #存放数据,若不设置默认为前面那个。
tracker_server=192.168.29.132:22122 #指定tracker服务器地址。
client.conf 中同样要修改
base_path=/usr/fastdfs #用于存放日志。
tracker_server=192.168.29.132:22122 #指定tracker服务器地址。
4. 启动tracker和storage
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
5. 检查进程
root@ubuntu:~# ps -ef |grep fdfs
root 7819 1 0 15:24 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root 8046 1 0 15:36 ? 00:00:01 fdfs_storaged /etc/fdfs/storage.conf start
表示启动ok了,若有错误,可以在/usr/fastdfs目录下检查日志。
6. 上传/删除测试
使用自带的fdfs_test来测试,使用格式如下:
root@ubuntu:~# fdfs_test /etc/fdfs/client.conf upload /home/steven/01.jpg
...
group_name=group1, ip_addr=192.168.29.132, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580.jpg
...
example file url: http://192.168.29.132/group1/M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580.jpg
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580_big.jpg
...
example file url: http://192.168.29.132/group1/M00/00/00/wKgdhFTV0ZmAP3AZAPk-Io7D4w8580_big.jpg
使用fdfs_delete_file来删除文件,格式如下:
fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgdhFTV11uAXgKWAPk-Io7D4w8667.jpg
可以看到,上传ok了,这里会生成两个文件,这是fastdfs的主/从文件特性,以后再介绍。example file url是不能在浏览器中直接打开的,除非配合nginx使用,这里我不需要了。删除文件需要完整的group_name和remote_filename。
http://dorole.com/tag/fastdfs/
- Ubuntu下部署FastDFS 5.05
- Ubuntu下部署FastDFS 5.05
- Ubuntu 14.04下部署FastDFS 5.08+Nginx 1.13.0
- Ubuntu 14.04下部署FastDFS 5.08+Nginx 1.9.14
- Linux 下fastdfs 安装 部署 测试
- 2. FastDFS 在 CentOS 下安装部署
- Ubuntu下FastDFS环境的安装搭建
- Ubuntu下FastDFS安装以及配置
- Ubuntu下安装并配置FastDFS
- Ubuntu下安装与配置FastDFS
- Ubuntu 下nginx和FastDfs的配置
- centOs7.0 下部署 fastdfs 集群 并配置负载均衡
- ubuntu下部署hadoop
- Ubuntu下hadoop部署
- Ubuntu下部署SVN
- Ubuntu下部署ELK
- 安装部署fastdfs
- FastDFS安装与部署
- 简析H264分包组包
- iOS-自定义导航栏后侧滑返回功能失效
- 哥又装了一个浏览器火狐-->互联网随想录
- 标签或者图片循环旋转
- 后缀表达式 (2) —— 表达树与后缀表达式的运算
- Ubuntu下部署FastDFS 5.05
- 成功的背后!(给所有IT人)
- Build.VERSION.SDK_INT判断Android SDK版本号
- 用PHP Demo 学 RabbitMq
- css3 的一些新属性
- 安装DBUtils报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in ra
- SQL Server 2008 查版本及 位数
- .260. Single Number III
- 房地产库存两极分化态势明显