【FastDFS分布式文件系统之一】:搭建、部署、配置
来源:互联网 发布:sql show tables 编辑:程序博客网 时间:2024/06/05 17:20
最近要提高小文件(100KB左右)的存储性能(主要是写入性能),想到了使用FastDFS因此需要对其性能做一个简单的测试。
1.安装FastDFS
cd /opt && mkdir fastdfs && cd fastdfsgit clone https://github.com/happyfish100/fastdfs.gitgit clone https://github.com/happyfish100/libfastcommon.gitcd /opt/fastdfs/libfastcommon./make.sh && ./make.sh installcd /opt/fastdfs/fastdfs./make.sh && ./make.sh install安装成功后,FastDFS安装在/usr/bin中。配置文件在/etc/fdfs中:
2.修改配置文件
配置文件放在/etc/fdfs下面:
client配置文件:/etc/fdfs/client.conf.sample
storage配置文件:/etc/fdfs/storage.com.sample
tracker配置文件:/etc/fdfs/tracker.com.sample
cd /etc/fdfsmv client.conf.sample client.confmv storage.conf.sample storage.confmv tracker.conf.sample tracker.confclient:node1
tracker server:node2 / node3
group1:storage server1(node4) /storage server2(node5) /storage server3(node6)
group2:storage server4(node7) /storage server5(node6) /storage server6(node8)
修改client.conf:
base_path=/mnt/xfsd/fastdfs/clienttracker_server=node2:22122tracker_server=node3:22122#其他都采用默认其中base_path是客户端的数据和日志写入的目录,这个目录必须指定且提前创建好。
修改storage.conf:
base_path=/mnt/xfsd/fastdfs/storagemax_connections=2048accept_threads=4work_threads=8tracker_server=node2:22122tracker_server=node3:22122log_level=info#其他都采用默认max_connections:并发最大请求数,默认256,如果设置的比较小,那么如果并发请求达到300以上,就会造成失败,如果设置的太大(20480)又会造成storage server启动失败,不知道为什么。具体的参数配置可以见配置文件的注释。
修改tracker.conf:
base_path=/mnt/xfsd/fastdfs/trackermax_connections=2048accept_threads=4work_threads=8log_level=infouse_trunk_file = true值得一提的是use_trunk_file来进行小文件的合并,默认合并成为64MB的块。
3.启动服务
服务的启动,重启,状态查询等。
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf/usr/bin/fdfs_storaged /etc/fdfs/storage.confservice fdfs_storaged statusservice fdfs_storaged startservice fdfs_storaged stopservice fdfs_storaged restartservice fdfs_trackerd statusservice fdfs_trackerd startservice fdfs_trackerd restartservice fdfs_trackerd stop
4.检查服务
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf输出如下信息:
[2016-03-08 17:40:36] DEBUG - base_path=/mnt/xfsd/fastdfs/storage, connect_timeout=30, network_timeout=60, tracker_server_count=2, 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: 0server_count=2, server_index=1tracker server is XXXXXX:22122group count: 2Group 1:group name = group1disk total space = 6654860 MBdisk free space = 6430591 MBtrunk free space = 127 MBstorage server count = 3active server count = 3storage server port = 23000storage HTTP port = 8888store path count = 1subdir count per path = 256current write server index = 0current trunk file id = 3481Storage 1:id = XXX.119ip_addr = XXX.119 ACTIVEhttp domain = version = 5.08join time = 2016-03-07 21:46:38up time = 2016-03-07 21:46:38total storage = 6654860 MBfree storage = 6431077 MBupload priority = 10store_path_count = 1subdir_count_per_path = 256storage_port = 23000storage_http_port = 8888\Storage 2: …… Storage 3:……Group 2:group name = group2disk total space = 6654860 MBdisk free space = 6429913 MBtrunk free space = 152 MBstorage server count = 3active server count = 3storage server port = 23000storage HTTP port = 8888store path count = 1subdir count per path = 256current write server index = 2current trunk file id = 3501Storage 1:id = XXX.122ip_addr = XXX.122 ACTIVEhttp domain = version = 5.08join time = 2016-03-07 21:50:57up time = 2016-03-07 21:50:57total storage = 6654860 MBfree storage = 6429917 MBupload priority = 10store_path_count = 1subdir_count_per_path = 256storage_port = 23000storage_http_port = 8888current_write_path = 0source storage id = if_trunk_server = 1Storage 2: …… Storage 3:……
5.数据操作
在client端执行测试:
上传upload操作:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /data/files/bak/smallfile0
下载download操作:
6.重新部署方法
由于测试需要,将replica 2变成replica 3,那么只需要将tracer server以及storage server端的base_path下面的client,storage,tracker文件夹都删除掉,然后重新创建文件夹,重启各个server服务就好了,无需卸载,重新编译安装等。
Author:忆之独秀
Email:leaguenew@qq.com
注明出处:http://blog.csdn.net/lavorange/article/details/50814086
- 【FastDFS分布式文件系统之一】:搭建、部署、配置
- 分布式文件系统 - FastDFS 安装部署
- Centos6 部署分布式文件系统FastDFS
- Linux+FastDFS分布式文件系统部署
- FastDFS+Nginx搭建分布式文件系统
- 二、分布式文件系统FastDFS-配置
- 分布式文件系统 FastDFS 5.09 配置
- 分布式文件系统FastDFS最佳部署实践
- 三、分布式文件系统fastDFS-安装部署
- fastdfs-安装部署fastdfs实现分布式文件系统(一)
- FastDFS分布式文件系统搭建图片服务器
- fastdfs nginx 搭建分布式文件系统(单机模式)
- 分布式文件系统FastDFS+nginx配置详解
- 分布式文件系统FastDFS配置与使用
- FastDFS分布式文件系统集群安装与配置
- FastDFS分布式文件系统集群安装与配置
- FastDFS分布式文件系统集群安装与配置
- FastDFS分布式文件系统集群安装与配置
- 选择类排序---堆排序
- 堆栈
- BZOJ2908: 又是nand
- ubuntu15.10设置root界面登录
- vector的size_type
- 【FastDFS分布式文件系统之一】:搭建、部署、配置
- 线段树 适合初学者
- 【sgu176】Flow construction 有源汇上下界最小流
- uint8_t / uint16_t / uint32_t /uint64_t 是什么数据类型c++/c? (在andriod源码中)
- 合并两个递增排序的链表
- 【慕课笔记】3-1 RandomAccessFile基本操作
- C++11 与 C99的兼容
- 短信验证(手机号注册,绑定手机号获取验证码)
- iOS 后台任务处理(多任务)