内容简介:FastDFS动态添加组(卷)(4)
- A+
所属分类:FastDFS
-- 可以随时动态增加一个组(卷) 为FastDFS集群的容量扩容 新组的容量会叠加 相当于与原来的组做了raid0
服务器角色
192.168.5.231 tracker +nginx
192.168.5.232 tracker + nginx
192.168.5.233 group1/stroage1 + nginx + fastdfs-nginx-module
192.168.5.234 group1/storage2 + nginx + fastdfs-nginx-module
192.168.5.235 group2/stroage1 + nginx + fastdfs-nginx-module
192.168.5.236 group2/storage2 + nginx + fastdfs-nginx-module
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
本实验请在完成 《FastDFS多tracker配置》 后进行
部署新storage
-- 在5.235 和 5.236上操作
-- 先部署storage 步骤请参照 ./FastDFS 里的 安装fastdfs 和 部署storage节点部分
但配置文件有以下2处有所不同
1. group_name 变为 group_name=group2 -- 因为这是第2个组(卷)
2. 再 添加一个tracker_server 为 tracker_server=192.168.5.232:22122 -- 要把上个实验的新tracker_server也添加进去
-- 启动storeage -- 在5.235 和 5.236上操作
fdfs_storaged /etc/fdfs/storage.conf start
-- 查看启动情况
netstat -tnlp tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 2459/fdfs_storaged tail -f /home/fastdfs/logs/storaged.log ------- 重点输出部分 ------------ [2016-10-26 11:14:19] INFO - local_host_ip_count: 3, 127.0.0.1 192.168.5.235 192.168.122.235 [2016-10-26 11:14:20] INFO - file: tracker_client_thread.c, line: 310, successfully connect to tracker server 192.168.5.232:22122, as a tracker client, my ip is 192.168.5.235 [2016-10-26 11:14:20] INFO - file: tracker_client_thread.c, line: 310, successfully connect to tracker server 192.168.5.231:22122, as a tracker client, my ip is 192.168.5.235 [2016-10-26 11:15:20] INFO - file: storage_sync.c, line: 2698, successfully connect to storage server 192.168.5.236:23000 -- 表示 与2台tracker 和 同组的storage节点 连接成功 ----------------------------------
-- 使用monitor查看新组(卷)的情况 -- 在随便一台storage上操作
fdfs_monitor /etc/fdfs/storage.conf
------ 重要输出部分 -------
Group 2: -- 看到Group 2 就表示添加组成功 其他参数意思请参考./FastDFS 相关部分 group name = group2 disk total space = 47786 MB disk free space = 45043 MB trunk free space = 0 MB
上传文件指定到group2
-- client的配置请参考 ./FastDFS 的 上传文件到fastdfs 部分 但命令如下
fdfs_upload_file /etc/fdfs/client.conf /root/software/pycharm.png 192.168.5.235:23000
-- 指定把文件上传到属于group2组下的192.168.5.235节点
group2/M00/00/00/wKgF61gQIy2AM36YAAULPRl0gCs976.png -- 返回的url 确实被传到了group2上 这个路径要记录下来 以后的实验需要用到
-- 到此为止 fsatdfs组扩容完成 接下来部署&配置nginx 使新加的组支持http协议下载
部署 & 配置nginx
-- 使新加的组支持http协议下载
-- 从group1的节点上拷贝nginx -- 在5.233上操作
rsync -avzR /usr/local/nginx/ 192.168.5.235:/ rsync -avzR /usr/local/nginx/ 192.168.5.236:/ rsync -avzR /etc/fdfs/http.conf /etc/fdfs/mime.types /etc/fdfs/mod_fastdfs.conf 192.168.5.235:/ rsync -avzR /etc/fdfs/http.conf /etc/fdfs/mime.types /etc/fdfs/mod_fastdfs.conf 192.168.5.236:/
-- 修改nginx配置文件 -- 在新组的节点上操作 即5.235 和 5.236
vim /usr/local/nginx/conf/nginx.conf
修改以下内容
location ~ /group2/M00 { -- 把group1修改为group2
-- 修改nginx_http_module模块配置文件
vim /etc/fdfs/mod_fastdfs.conf 修改以下内容 -- 在5.235 和 5.236 上操作 group_name=group2 -- 当前节点的组名 修改以下内容 -- 在所有storage节点上操作 即5.233-236 group_count = 2 -- 组的总数 在最后添加以下内容 -- 在所有storage节点上操作 即5.233-236 [group2] group_name=group2 storage_server_port=23000 store_path_count=1 store_path0=/home/fastdfs
-- 修改tracker_server上的nginx配置文件 -- 在5.231 和 5.232上操作
vim /usr/local/nginx/conf/nginx.conf
在http区域添加以下内容
upstream fdfs_group2 { -- 添加组2的upstream
server 192.168.5.235:8080;
server 192.168.5.236:8080;
}
在server区域添加以下内容
location /group2/M00{ -- 匹配访问组2的url
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_cache http-cache;
proxy_cache_valid 200 304 12h;
proxy_cache_key $uri$is_args$args;
proxy_pass http://fdfs_group2; -- 反向代理给组2的后端
#expires 30d;
}
-- 重启tracker所有节点 和 storage所有节点的nginx -- 在5.231-236上操作
/usr/local/nginx/sbin/nginx -s reload -- 如有没启动nginx的 就直接启动
-- 访问实验中刚刚上传到group2的图片
浏览器访问 http://192.168.5.232:8080/group2/M00/00/00/wKgF61gQIy2AM36YAAULPRl0gCs976.png
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
以上所述就是小编给大家介绍的《FastDFS动态添加组(卷)(4)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Concepts, Techniques, and Models of Computer Programming
Peter Van Roy、Seif Haridi / The MIT Press / 2004-2-20 / USD 78.00
This innovative text presents computer programming as a unified discipline in a way that is both practical and scientifically sound. The book focuses on techniques of lasting value and explains them p......一起来看看 《Concepts, Techniques, and Models of Computer Programming》 这本书的介绍吧!
图片转BASE64编码
在线图片转Base64编码工具
RGB CMYK 转换工具
RGB CMYK 互转工具