免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: happy_fish100
打印 上一主题 下一主题

FastDFS-开源分布式文件系统 [复制链接]

论坛徽章:
0
1 [报告]
发表于 2008-07-23 13:04 |显示全部楼层
LZ,  正在研究你的软件。。
其中你的文档中提出:


<b>上传文件交互过程:
1. client询问tracker上传到的storage,不需要附加参数;
2. tracker返回一台可用的storage;
3. client直接和storage通讯完成文件上传。</b>

那么客户端要装软件吗?
如果是安装软件,感觉上不太使用了,
那么如果不需要安装,如果我要做 RR 轮叫写入的时候,是否还需要先问一下要写入到那个 SERVER 呢?

感觉上文档还是没有没有搞明白。。

论坛徽章:
0
2 [报告]
发表于 2008-07-23 13:17 |显示全部楼层
hehe.. 感谢。

现在在测试中。。

架构

希望达到这样的效果
[server1] 数据存储实时备份 <----------------------> [server2] 数据存储同步并进行售票


[server2] 1.1.1.12 (传说中的售票员)
                         tracker.conf

disabled=false
bind_addr=1.1.1.12      [自己 IP 地址。。。留意]
port=22122
network_timeout=20
base_path=/dbtest
max_connections=1024

#0: round robin
#1: specify group
#2: load balance
store_lookup=2

#when store_lookup set to 1, must set store_group to the group name
store_group=group1   对应一下

#reserved storage space for system or other applications.
#if the free(available) space of any stoarge server in a group <= reserved_storage_space,
#no file can be uploaded to this group.
#bytes unit can be one of follows:
### G or g for gigabyte(GB)
### M or m for megabyte(MB)
### K or k for kilobyte(KB)
### no unit for byte(B)
reserved_storage_space = 100MB

然后叫醒售票员

[root@node2 conf]# /usr/local/bin/fdfs_trackerd  tracker.conf  &

测试一下

[root@node2 conf]# lsof -i:22122
COMMAND    PID USER   FD   TYPE DEVICE SIZE NODE NAME
fdfs_trac 3430 root    3u  IPv4  74226       TCP node2.cluster.com:22122 (LISTEN)

--------------------------------------------------------------------------------------
同一个节点中的 storage.conf

disabled=false
group_name=group1 [ 跟上面对应的一个存储组]
bind_addr=1.1.1.12  [还是自己IP]
port=23000
network_timeout=20
heart_beat_interval=30
stat_report_interval=60
base_path=/dbtest
sync_wait_msec=200
max_connections=1024

#tracker_server=10.62.245.107:22122
tracker_server=1.1.1.12:22122    [指向售票员- 就是自己咯]

在叫醒负责数据存储的搬运工

/usr/local/bin/fdfs_storaged storage.conf &

测试一下端口

[root@node2 conf]# lsof -i:23000
COMMAND    PID USER   FD   TYPE DEVICE SIZE NODE NAME
fdfs_stor 3435 root    3u  IPv4  74594       TCP node2.cluster.com:23000 (LISTEN)
fdfs_stor 3435 root    9u  IPv4  74599       TCP node2.cluster.com:saiseh->node1.cluster.com:23000 (ESTABLISHED)



=================================================


[server1] 1.1.1.11   负责数据同步的电脑
共享目录 /dbtest
-------------------------------------------------------------------
[root@node1 conf]# vi storage.conf
disabled=false
group_name=group1   [跟上面的存储属于同一个组]
bind_addr=1.1.1.11    [监听自己的IP还是监听对方的IP?]
port=23000
network_timeout=20
heart_beat_interval=30
stat_report_interval=60
base_path=/dbtest
sync_wait_msec=200
max_connections=1024

#tracker_server=10.62.245.107:22122
tracker_server=1.1.1.12:22122  [所谓的售票员IP及端口]


再次测试一下

[root@node1 conf]# /usr/local/bin/fdfs_storaged storage.conf  &
[root@node1 conf]# ps aux | grep storage
root      4802  0.0  0.2  22304   532 ?        Sl   14:32   0:00 /usr/local/bin/fdfs_storaged storage.conf
root      4808  0.0  0.2   3880   680 pts/1    R+   14:32   0:00 grep storage
[root@node1 conf]# lsof -i:23000
COMMAND    PID USER   FD   TYPE DEVICE SIZE NODE NAME
fdfs_stor 4802 root    3u  IPv4  80191       TCP node1.cluster.com:23000 (LISTEN)
fdfs_stor 4802 root    9u  IPv4  80196       TCP node1.cluster.com:4723->node2.cluster.com:23000 (ESTABLISHED)

--------------------------------------------------------------------
分别在两台电脑上测试一下

[root@node2 conf]# /usr/local/bin/fdfs_test  storage.conf upload /boot/grub/grub.conf
This is FastDFS client test program v1.1

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 http://www.csource.org/
for more detail.

group_name=group1, ip_addr=1.1.1.11, port=23000
group_name=group1, remote_filename=A7/D3/SIbQ1gAAAmsASXXC
file timestamp=1216794838
file size=619
-------------------------------
另外一个测试结果

[root@node1 conf]# /usr/local/bin/fdfs_test  storage.conf upload /boot/grub/grub.conf
This is FastDFS client test program v1.1

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 http://www.csource.org/
for more detail.

group_name=group1, ip_addr=1.1.1.12, port=23000
group_name=group1, remote_filename=9E/24/R3prUgAAAmtNrm_D  [每个人看到的结果可能都不一样吧]
file timestamp=1199205202
file size=619

----------------------------------------------
在其中一个电脑上运行监视程序 {我是在售票员机器上运行,在另外一个也可以看到相同效果}

[root@node2 conf]# /usr/local/bin/fdfs_monitor  storage.conf
group count: 1

Group 1:
group name = group1
free space = 4 GB
storage server count = 2
active server count = 2
storage_port = 23000
current write server index = 2

        Host 1:
                ip_addr = 1.1.1.11  ACTIVE
                total storage = 8GB
                free storage = 4GB
                total_upload_count = 1
                success_upload_count = 1
                total_set_meta_count = 0
                success_set_meta_count = 0
                total_delete_count = 0
                success_delete_count = 0
                total_download_count = 0
                success_download_count = 0
                total_get_meta_count = 0
                success_get_meta_count = 0
                last_source_update = 2008-07-23 14:33:58
                last_sync_update = 1970-01-01 08:00:00
        Host 2:
                ip_addr = 1.1.1.12  ACTIVE
                total storage = 8GB
                free storage = 4GB
                total_upload_count = 1
                success_upload_count = 1
                total_set_meta_count = 0
                success_set_meta_count = 0
                total_delete_count = 0
                success_delete_count = 0
                total_download_count = 0
                success_download_count = 0
                total_get_meta_count = 0
                success_get_meta_count = 0
                last_source_update = 2008-01-02 00:33:22
                last_sync_update = 2008-01-02 00:32:02




---------------------------------------------

再看看 /dbtest 这个用于数据同步的目录,一堆 00 ~ ff 的目录跟 squid 有点相似,估计就是用于缓存的吧,

问题来了。。。我怎么向这个目录传输文件能够同步呢???? 【文档上好像没有写哦】



-_-! 汗啊。。

哈皮鱼 ~~ 救命啊。。。。

[ 本帖最后由 signmem 于 2008-7-23 14:30 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2008-07-23 14:23 |显示全部楼层
[2008-01-01 23:53:50] file: tracker_service.c, line: 1405, client ip: 1.1.1.12, recv data fail, errno: 0, error info: Success
[2008-01-02 00:14:13] FastDFS v1.1, base_path=/dbtest, network_timeout=20, port=22122, bind_addr=1.1.1.12, max_connections=1024, store_lookup=2, store_group=, reserved_storage_space=100MB
[2008-01-02 00:19:55] file: tracker_service.c, line: 1405, client ip: 1.1.1.11, recv data fail, errno: 0, error info: Success





另外一个电脑上出现了错误日志

[2008-07-23 14:12:49] file: tracker_client_thread.c, line: 506, tracker server 1.1.1.12:22122, recv data fail, errno: 0, error info: Success.
[2008-07-23 14:13:09] file: storage_service.c, line: 1016, client ip: 1.1.1.12, recv data fail, errno: 2, error info: No such file or directory.
[2008-07-23 14:19:01] file: storage_service.c, line: 402, cmd=16, client ip: 1.1.1.12, data file: /dbtest/data/A0/B3/R3piIQAAAchYeYeS already exists, ignore it
[2008-07-23 14:19:01] file: storage_service.c, line: 402, cmd=16, client ip: 1.1.1.12, data file: /dbtest/data/A0/B3/R3piIQAAAchYeYeS-m already exists, ignore it
感觉上代码有问题。。。。我没法修复哦。。。。。。。。



我尝试过在这个目录下复制文件或者建立文件,另外一个电脑上没有反应啊。。。我的配置和做法都在上面 13 楼,麻烦看看。

[ 本帖最后由 signmem 于 2008-7-23 14:53 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2008-07-23 17:54 |显示全部楼层
>>>> 向存储集群上传文件必须使用FastDFS的Client Library <<<< 怎么调用啊??

看是没有看懂怎么去使用或者控制目录下的文件。。。。。。。。

反正现在的问题是 cp,  mv, 等做法都无法同步数据,

比如我要把目录用于一个邮件服务器或者网页服务器中数据同步, 那还需要再次对服务器进行二次开发才能够支持,或者要重新写 FTP 客户端?????

那这个软件没有太大意义吧??

论坛徽章:
0
5 [报告]
发表于 2008-07-23 20:15 |显示全部楼层
那么现在能够怎么去提交文件呢? 只能够使用 XXX_TEST  CONFIG  UPLOAD  FILENAME 的方法吗?

如果是这样的话。。。。。。。目前看来还是只能够等待。。。。。。。

招兵买马吧。。好不容易有一个国产开源。。。不过就是。。。。。用不上。。可惜啊。

论坛徽章:
0
6 [报告]
发表于 2008-07-29 10:28 |显示全部楼层
现在问题是就算的服务器同步再优化再好, 现在是根本不知道怎么把数据放到服务器上, 现在都不能够支持通过比如 CP, MV 等命令在服务器上创建数据源, 而且看样子数据是放到了一个自己的数据库中的一个地方藏起来,就像 CVS 一样,要通过复杂的方法才能够上传和下载, 对普通的用户需求现在还有问题,

LZ 就先完善了功能再推这个软件把。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP