免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1921 | 回复: 0
打印 上一主题 下一主题

[RAID与磁盘阵列] 分布式存储 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-25 13:47 |只看该作者 |倒序浏览

software:FasDFS.1.12
OS:ubuntu server 7.10
测试机器
NAS1:192.168.1.2
NAS2:192.168.1.3

分别在NAS1,NAS2  上安装 FastDFS.1.12
1.tar zxvf   FastDFS.1.12.tar.gz
cd  FastDFS.1.12
./make.sh
./make.sh install
cp conf/storage.conf  conf/tracker.conf  /etc

2.修改配置文件 (NAS1)
vim /etc/tracker.conf

disabled=false
bind_addr=192.168.1.2      #绑定IP本机IP地址
port=22122                           #监听端口
network_timeout=30           #超时退出
base_path=/home/yangzi  #存储目录
max_connections=256         #连接大小这个我测试过跟你的内存有关系,不然启动失败,我的是虚拟机,内存给的是256,所以最大我写的256
#0: round robin
#1: specify group
#2: load balance
store_lookup=1                   #我选定的是 指定组其他的我没有做测试
#when store_lookup set to 1, must set store_group to the group name
store_group=group1      #组别
#0: round robin
#1: the first server order by ip address
#recommand use the first server to upload file
store_server=1
#reserved storage space for system or other applications.
#if the free(available) space of any stoarge server in
#a group
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group=root
#unix username to run this program,
#not set (empty) means run by current user
run_by_user=root
# allow_hosts can ocur more than once, host can be hostname or ip address,
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
# host[01-08,20-25].domain.com, for example:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*
修改好后保存退出~

3.修改配置文件 (NAS1)
vim /etc/storage.conf

disabled=false
group_name=group1                     #组别对应tracker.conf
bind_addr=192.168.1.2                   #绑定本机IP
port=23000                                       #监听端口
network_timeout=20                     
heart_beat_interval=30                  
stat_report_interval=60
base_path=/home/yangzi             #数据存储目录
sync_wait_msec=200                    #数据同步等待时间
max_connections=256                   #连接大小这个我测试过跟你的内存有关系,不然启动失败,我的是虚拟机,内存给的是256,所以最大我写的256
# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
#tracker_server=10.62.164.84:22122
tracker_server=192.168.1.2:22122
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group=root
#unix username to run this program,
#not set (empty) means run by current user
run_by_user=root
# allow_hosts can ocur more than once, host can be hostname or ip address,
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
# host[01-08,20-25].domain.com, for example:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*
修改完后保存退出

4.修改配置文件 (NAS2)
vim /etc/storage.conf

disabled=false
group_name=group1
bind_addr=192.168.1.3                  #注意这里是绑定本机IP
port=23000
network_timeout=20
heart_beat_interval=30
stat_report_interval=60
base_path=/home/yangzi
sync_wait_msec=200
max_connections=256
tracker_server=192.168.1.2:22122   #这里是NAS1的IP 因为NAS1开启的tarcker服务~
log_level=info
run_by_group=root
run_by_user=root
allow_hosts=*

5.写启动脚本~(NAS1)
#!/bin/bash
case "$1" in
start)
echo -n "Staring to write your FDFS:..."
/usr/local/bin/fdfs_trackerd /etctracker.conf
/usr/local/bin/fdfs_storaged /etc/storage.conf
echo "Ok"
;;
stop)
echo -n "Cleaning your FDFS:..."
ps -efww |grep fdfs |grep -v grep|cut -c 9-15|xargs kill -9
echo "Ok"
;;
restart)
echo -n "Cleaning your FDFS:..."
ps -efww |grep fdfs |grep -v grep|cut -c 9-15|xargs kill -9
echo "Ok"
echo -n "Staring to write your FDFS:..."
/usr/loca/bin/fdfs_trackerd /etc/tracker.conf
/usr/loca/bin/fdfs_storaged /etc/storage.conf
echo "Ok"
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
6.启动脚本~(NAS2)
#!/bin/bash
case "$1" in
start)
echo -n "Staring to write your FDFS:..."
/usr/local/bin/fdfs_storaged  /etc/storage.conf
echo "Ok"
;;
stop)
echo -n "Cleaning your FDFS:..."
ps -efww |grep fdfs |grep -v grep|cut -c 9-15|xargs kill -9
echo "Ok"
;;
restart)
echo -n "Cleaning your FDFS:..."
ps -efww |grep fdfs |grep -v grep|cut -c 9-15|xargs kill -9
echo "Ok"
echo -n "Staring to write your FDFS:..."
/usr/loca/bin/fdfs_storaged  /etc/storage.conf
echo "Ok"
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
8.启动NAS1,NAS2. FastDFS
NAS1    # /etc/init.d/fdfs start
Staring to write your Iptbales:...Ok
#netstat -ant
tcp        0      0 192.168.1.2:22122     0.0.0.0:*               LISTEN
tcp        0      0 192.168.1.2:23000     0.0.0.0:*               LISTEN
tcp        0      0 192.168.1.2:22122     192.168.1.2:55075     ESTABLISHEDtcp        0      0 192.168.1.2:55075     192.168.1.2:22122     ESTABLISHED
说明启动成功`

NAS2    /etc/init.d/fdfs start
tcp        0      0 192.168.1.3:23000     0.0.0.0:*               LISTEN
tcp        0      0 192.168.1.3:33112     192.168.1.3:22122     ESTABLISHED
tcp        0      0 192.168.1.3:50542     192.168.1.3:23000     ESTABLISHED
说明NAS2 启动成功~
9.测试~ NAS1
/usr/local/bin/fdfs_test /etc/storage.conf upload /root/1234
This is FastDFS client test program v1.11
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
group_name=group1, ip_addr=192.168.1.2, port=23000
group_name=group1, remote_filename=52/65/SSEDyAAAEzh0SnYu
file timestamp=1226900424
file size=4920
10.测试~NAS2
#/usr/local/bin/fdfs_test /root/FastDFS/conf/storage.conf upload /root/1234
This is FastDFS client test program v1.11
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
[/url]
group_name=group1, ip_addr=192.168.1.2, port=23000
group_name=group1, remote_filename=10/91/SSEEQwAAAABqgkr1
file timestamp=1226900547
file size=0
具体怎么应用到生产环境里,大家可以看看他官方客户端软件.

本文来自ChinaUnix博客,如果查看原文请点:[url]http://blog.chinaunix.net/u2/66684/showart_1741363.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP