- 浏览: 584899 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (365)
- Tomcat调优 (2)
- Apache Http (20)
- Webserver安装 (5)
- Linux安装 (28)
- Linux常用命令 (17)
- C语言及网络编程 (10)
- 文件系统 (0)
- Lucene (12)
- Hadoop (9)
- FastDFS (8)
- 报表 (0)
- 性能测试 (1)
- JAVA (18)
- CSharp (3)
- C++ (38)
- BI (0)
- 数据挖掘 (0)
- 数据采集 (0)
- 网址收集整理 (3)
- Resin (0)
- JBoss (0)
- nginx (0)
- 数据结构 (1)
- 随记 (5)
- Katta (1)
- Shell (6)
- webservice (0)
- JBPM (2)
- JQuery (6)
- Flex (41)
- SSH (0)
- javascript (7)
- php (13)
- 数据库 (6)
- 搜索引擎排序 (2)
- LVS (3)
- solr (2)
- windows (1)
- mysql (3)
- 营销软件 (1)
- tfs (1)
- memcache (5)
- 分布式搜索 (3)
- 关注的博客 (1)
- Android (2)
- clucene (11)
- 综合 (1)
- c c++ 多线程 (6)
- Linux (1)
- 注册码 (1)
- 文件类型转换 (3)
- Linux 与 asp.net (2)
- perl (5)
- coreseek (1)
- 阅读器 (2)
- SEO (1)
- 励志 (1)
- 在线性能测试工具 (1)
- yii (7)
- 服务器监控 (1)
- 广告 (1)
- 代理服务 (5)
- zookeeper (8)
- 广告联盟 (0)
- 常用软件下载 (1)
- 架设自已的站点心得 (0)
最新评论
-
terry07:
java 7 用这个就可以了 Desktop desktop ...
关于java Runtime.getRunTime.exec(String command)的使用 -
HSINKING:
怎么设置打开的dos 窗口是指定的路径下
关于java调用bat文件,不打开窗口 -
liubang201010:
hyperic hq更多参考资料,请访问:http://www ...
hyperic-hq -
^=^:
STDIN_FILENO是unistd.h中定义的一个numb ...
深入理解dup和dup2的用法 -
antor:
留个记号,学习了
[转]用java流方式判断文件类型
${CYGWIN_HOME}/bin/sh.exe /cygdrive/d/fastDFS/c/test/src/FastDFS/make.sh
/cygdrive/d/cygwin//bin/sh.exe
D:\cygwin\bin
/cygdrive/d/cygwin/bin/sh.exe
D:\Program Files\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;d:\Program Files\Subversion\bin;E:\heritrix\lib;D:\cygwin\bin;C:\CodeBlocks\MinGW\bin;C:\CodeBlocks\MinGW\libexec\gcc\mingw32\3.4.5;C:\Java\jdk1.6.0\bin;F:\download\javacc-4.2\javacc-4.2\bin;d:\Program Files\Rational\common;C:\php;D:\cygwin\bin
Administrator@obama-jc /cygdrive/d/cygwin/bin
$ cd
eclipse Cannot run program sh.exe Launching failed
**** Build of configuration Debug for project testrun ****
make all
Building target: testrun.exe
Invoking: Cygwin C Linker
gcc -o"testrun.exe" ./src/testrun.o
/usr/bin/sh: /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: No such file or directory
collect2: ld returned 127 exit status
make: *** [testrun.exe] Error 1
参考资源(以后经常补写)
Java代码
1.问查询某个端口是否已被使用
2.#netstat -na |grep tcp
3. 列出所有开放的TCP端口(已经占用的)
4.netstat -an | grep 8080
5. 查询8080端口是否占用
问查询某个端口是否已被使用
#netstat -na |grep tcp
列出所有开放的TCP端口(已经占用的)
netstat -an | grep 8080
查询8080端口是否占用
0\在windows eclipse 下的编译
首先建一个hello 工程,并且能编译通过,然后把FastDfs文件目录copy到 src目录下
a:设置环境变量 CYGWIN_HOME
b:在properties中的c/c++ build的build command设置 ${CYGWIN_HOME}/bin/sh.exe /cygdrive/u/programe/testproject/test/src/FastDFS/make.sh
1\基本配置
参看install
主要是调路径,端口号等
2\如果要支持http Server
配 置
tracker.conf ,把##include http.conf改成 #include http.conf
storage.conf ,把##include http.conf改成 #include http.conf
修改mash.sh 把 #WITH_HTTPD=1 改成 WITH_HTTPD=1(重要)
安装libEvent库
1. # tar xzvf libevent-2.0.4-alpha.tar.gz
2. # cd libevent-2.0.4
3. # ./configure --prefix=/home/super/installLIB
4. # make
5. # make install
3\执行
./make.sh
./make.sh install (如果要卸载,./make.sh clean)
可能会出现
error while loading shared libraries: libevent_core.so.3: cannot open shared object file: No such file or directory
[root@bogon bin]# ./fdfs_trackerd /fastdfs/FastDFS/conf/tracker.conf
./fdfs_trackerd: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
执行
ln -s /home/super/installLIB/lib/libevent_core.so.3 /lib/libevent_core.so.3
4\注意
运行情况请看日志文件
trackerd.log
storaged.log
它们具体内容如下
trackerd.log
[2010-05-03 06:47:26] INFO - FastDFS v1.27, base_path=/fastdfs/FastDFS, network_timeout=60s, port=22122, bind_addr=, max_connections=256, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=1024MB, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1
[2010-05-03 06:47:26] INFO - HTTP supported: server_port=8080, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0, check_active_interval=30, check_active_type=tcp, check_active_uri=/status.html
storaged.log
[2010-05-03 06:47:29] INFO - FastDFS v1.27, base_path=/fastdfs/FastDFS, store_path_count=1, subdir_count_per_path=256, group_name=group1, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=1, sync_wait_msec=200ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time: 23:59, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=60s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
[2010-05-03 06:47:29] INFO - HTTP supported: server_port=8888, http_trunk_size=262144, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0
[2010-05-03 06:47:30] INFO - file: storage_param_getter.c, line: 225, storage_ip_changed_auto_adjust=1
[2010-05-03 06:47:31] INFO - file: tracker_client_thread.c, line: 257, successfully connect to tracker server 192.168.247.128:22122, as a tracker client, my ip is 192.168.247.128
5\上传图片后(参看install文件)
则返回 http://192.168.247.128:8080/group1/M00/00/00/wKj3gEvd84oAAAAAAABdrVV-uEs424_big.jpg
在ie中执行 http://192.168.247.128:8080/group1/M00/00/00/wKj3gEvd84oAAAAAAABdrVV-uEs424_big.jpg 看到此图片正常运行
6、
查看端口号
lsof -i :端口 号
lsof -i :8080
显示结果
[root@linux2 bin]# lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
fdfs_trac 4742 root 10u IPv4 14679 TCP *:webcache (LISTEN)
[root@call root]# netstat -anp
显示结果
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 2129/hpiod
tcp 0 0 0.0.0.0:835 0.0.0.0:* LISTEN 1925/rpc.statd
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 4742/fdfs_trackerd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1891/portmap
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4742/fdfs_trackerd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2146/cupsd
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 5006/fdfs_storaged
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 5006/fdfs_storaged
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2192/sendmail: acce
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 2134/python
tcp 0 0 192.168.247.128:22122 192.168.247.128:48836 ESTABLISHED 4742/fdfs_trackerd
tcp 0 0 192.168.247.128:48836 192.168.247.128:22122 ESTABLISHED 5006/fdfs_storaged
tcp 0 0 192.168.247.128:57448 192.168.247.128:8888 TIME_WAIT -
tcp 0 0 192.168.247.128:57447 192.168.247.128:8888 TIME_WAIT -
tcp 0 0 :::22 :::* LISTEN 2160/sshd
tcp 0 0 ::ffff:192.168.247.128:22 ::ffff:192.168.247.1:1038 ESTABLISHED 2754/0
tcp 0 0 ::ffff:192.168.247.128:22 ::ffff:192.168.247.1:1051 ESTABLISHED 3358/1
tcp 0 48 ::ffff:192.168.247.128:22 ::ffff:192.168.247.1:1101 ESTABLISHED 4149/2
udp 0 0 0.0.0.0:32768 0.0.0.0:* 2317/avahi-daemon:
udp 0 0 0.0.0.0:829 0.0.0.0:* 1925/rpc.statd
udp 0 0 0.0.0.0:832 0.0.0.0:* 1925/rpc.statd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1748/dhclient
udp 0 0 0.0.0.0:5353 0.0.0.0:* 2317/avahi-daemon:
udp 0 0 0.0.0.0:111 0.0.0.0:* 1891/portmap
udp 0 0 0.0.0.0:631 0.0.0.0:* 2146/cupsd
udp 0 0 :::32769 :::* 2317/avahi-daemon:
udp 0 0 :::5353 :::* 2317/avahi-daemon:
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 11230 2723/gam_server @/tmp/fam-root-
unix 25 [ ] DGRAM 6411 1847/syslogd /dev/log
unix 2 [ ACC ] STREAM LISTENING 10819 2679/scim-launcher /tmp/scim-socket-frontend-root
unix 2 [ ACC ] STREAM LISTENING 11363 2741/mapping-daemon /tmp/mapping-root
7\
wget -S file_url
wget -S http://192.168.247.128:8888/group1/M00/00/00/wKj3gEvd84oAAAAAAABdrVV-uEs424_big.jpg 可以得到文件,并把文件保存在当前路径下
8\
>> 3.store_path这个参数的作用
同一个GROUP中的store_path目录个数必须大小一样,但目录名称可以不相同。
>> 4.能直接访问吗?我认为不能?
可以配合apache使用。在存储服务器上安装apache,将DocumentRoot配置到${base_path}/data目录。
以前有人问过类似的问题,参阅:http://linux.chinaunix.net/bbs/thread-1062825-1-1.html
2.其它这个10台电脑.用rsync就可能实现.好像也没有必要使用fast-dfs吧!
问题一
无法断点调试,断点时报错如下,
Can't find a source file at "/cygdrive/d/eclipse-cpp/workspaces/easyhello/easyhello.cpp"
Locate the file or edit the source lookup path to include its location.
解决:
must provide a mapping from /cygdrive/d to d:\ (or whatever your drive letter is).
in the eclipse IDE, go to menu Window -> Preferences -> C/C++ -> Debug-> Common Source Lookup Path -> Add.
增加一个Path Mapping
名字debugmapping 点击 add
Compilation path ---->/cygdrive/d
Local File System Path ---> d:\
Select OK to finish the dialogs.
注意(Windows平台下),特别要在
make.sh 中加入如下三行
cd /cygdrive/j
cd /cygdrive/j/fastdfs/fastv1.21_twoDevelope/fdstdfs/dfsfast/src/FastDFS
pwd
1、FastDFS底层技术及协议
2、在测试环境中分次搭建如下测试环境
a、一个Tracker Service ,一个Storage Service
a、一个Tracker Service ,多个Storage Service 测试两个 ok
b、多个Tracek Service ,多个Storage Service 都两个,测试中
c、多个分组,每个分组包括一个Tracker Service ,多个Storage Service
d、多个分组,多个Tracek Service ,多个Storage Service
./stop.sh /fastdfs/FastDFS/conf/tracker.conf
fdfs_monitor /fastdfs/FastDFS/conf/storage.conf
fdfs_monitor /fastdfs/FastDFS/conf/client.conf
fdfs_test /fastdfs/FastDFS/conf/client.conf upload /fastdfs/FastDFS/conf/client.conf
[root@bogon bin]# ./fdfs_storaged /fastdfs/FastDFS/conf/storage.conf
[root@bogon bin]# ./fdfs_trackerd /fastdfs/FastDFS/conf/tracker.conf
ERROR - conf file "/fastdfs/FastDFS/conf/tracker.conf", get item "tracker_server" fail
[root@bogon testdata]# /usr/local/bin/fdfs_upload_file /etc/fdfs/client.conf test.swf
group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf
下载文件
[root@bogon testdata]# /usr/local/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf testdown.swf
删除文件
[root@bogon testdata]# /usr/local/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf
2011-03-16
测试在有两个Tracker Service ,两个Storage Service和条件下,分别动态增加一个Storage Service,及动态撒掉一个Tracker Service
在两台Tracker Service 的日志文件中出现如下提示
inceament storage log :
[2011-03-15 22:35:57] INFO - FastDFS v2.09, base_path=/fastdfs/fastdfsdata/incstorageone, store_path_count=1, subdir_count_per_path=256, group_name=group1, connect_timeout=30s, network_timeout=60s, port=23001, bind_addr=, client_bind=1, max_connections=256, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, disk_rw_direct=0, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=2, sync_wait_msec=200ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=60s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
[2011-03-15 22:36:25] INFO - file: storage_param_getter.c, line: 48, storage_ip_changed_auto_adjust=1
[2011-03-15 22:36:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:39:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:39:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:39:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:40:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:40:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:40:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:42:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:42:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:08] ERROR - file: tracker_mem.c, line: 3749, client ip: 192.168.0.130, port 23001 is not same in the group "group1", group port is 23000
ERROR - file: tracker_mem.c, line: 3749, client ip: 192.168.0.130, port 23001 is not same in the group "group1", group port is 23000
动态改storage.conf 中的组名改成 group3 出现如下提示:
[2011-03-15 22:48:42] ERROR - file: tracker_service.c, line: 461, client ip: 192.168.0.130, invalid group_name: group3
一台机可以配置多个组,每个组都需要一套conf文件,
上传文件通过指定组的方式,没问题
不指定组的方式,直接把两个组都包括进去会怎样呢(不行,要以指定组的方式才可以)
[root@bogon fdfs]# /usr/local/bin/fdfs_append_file client.conf group1/M00/00/00/wKgAgU1_mF_vb_LiAMDAAJQUX_s782.exe /testdata/shankejingling_gerenban.exe
说明 fastdfs-apache-module_v1.04 的工作方式
另外一个解决方案:使用web server扩展模块方式,通过storage server上部署的web server直接对用户提供HTTP下载服务。此时tracker server上不需要开启HTTP服务。
模块工作机制:
1. 对请求URL中的文件名进行反解,得到文件创建时间、文件大小和源storage server IP地址
2. 如果文件在本地存在,直接返回文件内容;否则转3
3. 文件在本地不存在的情况处理:
1)如果 (当前时间 - 文件创建时间) > 文件同步延迟阀值(如一天) 或者 源storage server IP地址在本机IP中(即当前文件上传到的源storage server为本机),则返回404 NOT FOUND
2)如果配置为redirect模式,直接重定向到源storage server IP对应的URL;否则为proxy模式,调用FastDFS client API从源storage server IP获取该文件并返回给客户端
目前已开发完成apache模块,正在测试阶段。
安装 apache
1. 源码包:httpd-2.2.6.tar.gz 从 www.apache.org 下载到此目录下:/usr/local/src 同时在 /usr/local 下创建一个httpd目录:mkdir httpd
2. 解压安装包:tar -zxvf httpd-2.2.6.tar.gz
3. 进入解压后的安装包:cd httpd-2.2.6
4. 配置:./configure --prefix=/usr/local/apache2 --enable-cgi ( 意义支持CGI)
5. 编译:make
6. 安装:make install
7. 启动web服务:
安装后fastdfs-apache-module_v1.04
启动apache 时报
service httpd start
ERROR - conf file "/etc/fdfs/mod_fastdfs.conf", host "tracker" is invalid
kill -9 $(ps -ef|grep httpd|gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')
ERROR1:
邋?httpd锛^[[?1;2cSyntax error on line 281 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
解决办法:[root@bogon conf]# chcon -R -t httpd_sys_content_t /fastdfs/fastdfsdata/storageone/storageone_1/data
chcon -R -t httpd_sys_content_t /fastdfs/testwebdir
Apache版本httpd-2.2.3-11.el5_1.centos.3
欲将www主目录设置为/home/www/html,目录权限如下
drwxr-xr-x 2 root root 4096 01-19 01:12 /home/www/html
httpd.conf配置文件如下
DocumentRoot "/home/www/html"
执行/etc/rc.d/init.d/httpd start出现如下错误
启动 httpd:Syntax error on line 281 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
[失败]
如将DocumentRoot "/home/www/html"替换为DocumentRoot "/var/www/html"
则启动成功。。。
/var/www/html权限如下
drwxr-xr-x 2 root root 4096 01-16 09:36 /var/www/html
百思不得其解。。。望哪位大大告知。。。
seigfied继续试验,设置DocumentRoot "/home/seigfied"
/home/seigfied权限为
drwx------ 2 seigfied seigfied 4096 01-11 17:33 /home/seigfied
执行/etc/rc.d/init.d/httpd start,启动成功
真的没弄明白,/home/www/html明明就是一个目录。。
为什么Apache会告诉我DocumentRoot必须是一个目录呢
kenduest一般通常都是 selinux 問題。
請修改目錄的 security content,讓 apache 有存取該目錄的權限。
另外該相同問題於 linux.vbird.org 您有問過。
http://phorum.vbird.org/viewtopic.php?t=30684
/fastdfs/fastdfsdata/storageone/storageone_1/data/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf
scp root@172.19.2.75:/home/root /home/daisy/*.tar.gz
scp 源文件 root@192.168.0.129:/home/root
配置 fastdfs-apache-module_v1.04 与apache 集成 目录权限重要(即mod_fastdfs.conf中base_path=/fastdfs/fastdfsdata/apachemod目录的权限),不然报如下错误
启动 httpd:[2011-03-17 01:34:22] ERROR - file: ../tracker/tracker_proto.c, line: 541, connect to tracker server 192.168.0.129:22122 fail, errno: 13, error info: Permission denied
[2011-03-17 01:34:22] INFO - fastdfs apache / nginx module v1.04, response_mode=redirect, base_path=/fastdfs/fastdfsdata/apachemod, connect_timeout=2, network_timeout=5, tracker_server_count=1, storage_server_port=23000, group_name=group1, if_alias_prefix=, local_host_ip_count=2, need_find_content_type=0, default_content_type=, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0, storage_sync_file_max_delay=86400s
httpd: apr_sockaddr_info_get() failed for bogon
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
解决办法 chcon -R -t httpd_sys_content_t /fastdfs/fastdfsdata/
这样就可以正常使用了
http://192.168.0.129/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf
2011-03-23
fastdfs-apache-module 有关返回原始文件名的问题
问:
之前看到happy_fish100如下说
模块工作机制:
1. 对请求URL中的文件名进行反解,得到文件创建时间、文件大小和源storage server IP地址
2. 如果文件在本地存在,直接返回文件内容;否则转3
3. 文件在本地不存在的情况处理:
1)如果 (当前时间 - 文件创建时间) > 文件同步延迟阀值(如一天) 或者 源storage server IP地址在本机IP中(即当前文件上传到的源storage server为本机),则返回404 NOT FOUND
2)如果配置为redirect模式,直接重定向到源storage server IP对应的URL;否则为proxy模式,调用FastDFS client API从源storage server IP获取该文件并返回给客户端
=======================================================
我已测试过fastdfs-apache-module,很好用,解决了文件延时问题,有可起到分流分压的作用,有如下问题想问一下
具体问题描述
我有一个文件名叫 "540个活动营销策略.doc" 上传后假如文件名是wKj3gEvd84oAAAAAAABdrVV-uEs424.doc,我想通过redirect的模式在下载时直接返回"540个活动营销策略.doc"(即原始文件名),不知道有没有办法做到,我也看到happy_fish100说过,文件名在通过客户端上传时可以写到属性中,如“540个活动营销策略.doc”写到属性中,但下载(直接下载或用flashget之类的工具)怎样能返回原始中文名(我的站点是做文档分享的)呢,我也想过可不可通过fastdfs-apache-module 在内部进行处理,还请happy_fish100回复
======================================================================================
happy_fish100 回答:
已经有用户提出过这个需求了,呵呵。
原始文件名由应用记录到数据库中,生成下载链接时,URL参数中指定原始文件名,对应的参数名为:filename。
问(由于没及时看到回答,又问):
有过这样的回答:
可以使用文件附加属性来存储该文件的原文件名。在apache或nginx扩展模块中,可以在HTTP Header中输出原文件名。
happy_fish100 回答:
不推荐使用文件附件属性的方式保存原始文件名。
建议原始文件名由应用保存到数据库中。参见我上面的回复。
URL中指定参数filename,例如:filename=xxxx.doc
问:
happy_fish100 ,你好,谢谢你的回复,
QUOTE:已经有用户提出过这个需求了,呵呵。
原始文件名由应用记录到数据库中,生成下载链接时,URL参数中指定原始文件名,对应的参数名为:filename。
你上面说的 filename参数,是特别在fastdfs-apache-module 作过处理的吗?即通过如00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.doc ?filename=540个活动营销策略.doc 样式访问文件,
通过 00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.doc 定位磁盘文件,而filename是用户保存数据文件时的文件名,可以这样理解吗,我想应该是这样,如果是这样,太好了,我的问题解决了
happy_fish100 回答:
是的,你的理解完全正确。
不过文件名中包含中文,因为字符集问题,可能会导致另存时,显示的文件名为乱码。
问:
太谢谢happy_fish100 ,谢谢happy_fish100的提醒
QUOTE:是的,你的理解完全正确。
不过文件名中包含中文,因为字符集问题,可能会导致另存时,显示的文件名为乱码。
这个与apache本身的httpd.conf 的配置文件有关吧,可以让httpd.conf的字符集与网页字符集相应调整,可以解决吧
总之,可以通过如下方法访问物理磁盘文件名
http://192.168.0.129/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf?filename="原始文件名.doc"
/cygdrive/d/cygwin//bin/sh.exe
D:\cygwin\bin
/cygdrive/d/cygwin/bin/sh.exe
D:\Program Files\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;d:\Program Files\Subversion\bin;E:\heritrix\lib;D:\cygwin\bin;C:\CodeBlocks\MinGW\bin;C:\CodeBlocks\MinGW\libexec\gcc\mingw32\3.4.5;C:\Java\jdk1.6.0\bin;F:\download\javacc-4.2\javacc-4.2\bin;d:\Program Files\Rational\common;C:\php;D:\cygwin\bin
Administrator@obama-jc /cygdrive/d/cygwin/bin
$ cd
eclipse Cannot run program sh.exe Launching failed
**** Build of configuration Debug for project testrun ****
make all
Building target: testrun.exe
Invoking: Cygwin C Linker
gcc -o"testrun.exe" ./src/testrun.o
/usr/bin/sh: /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: No such file or directory
collect2: ld returned 127 exit status
make: *** [testrun.exe] Error 1
参考资源(以后经常补写)
Java代码
1.问查询某个端口是否已被使用
2.#netstat -na |grep tcp
3. 列出所有开放的TCP端口(已经占用的)
4.netstat -an | grep 8080
5. 查询8080端口是否占用
问查询某个端口是否已被使用
#netstat -na |grep tcp
列出所有开放的TCP端口(已经占用的)
netstat -an | grep 8080
查询8080端口是否占用
0\在windows eclipse 下的编译
首先建一个hello 工程,并且能编译通过,然后把FastDfs文件目录copy到 src目录下
a:设置环境变量 CYGWIN_HOME
b:在properties中的c/c++ build的build command设置 ${CYGWIN_HOME}/bin/sh.exe /cygdrive/u/programe/testproject/test/src/FastDFS/make.sh
1\基本配置
参看install
主要是调路径,端口号等
2\如果要支持http Server
配 置
tracker.conf ,把##include http.conf改成 #include http.conf
storage.conf ,把##include http.conf改成 #include http.conf
修改mash.sh 把 #WITH_HTTPD=1 改成 WITH_HTTPD=1(重要)
安装libEvent库
1. # tar xzvf libevent-2.0.4-alpha.tar.gz
2. # cd libevent-2.0.4
3. # ./configure --prefix=/home/super/installLIB
4. # make
5. # make install
3\执行
./make.sh
./make.sh install (如果要卸载,./make.sh clean)
可能会出现
error while loading shared libraries: libevent_core.so.3: cannot open shared object file: No such file or directory
[root@bogon bin]# ./fdfs_trackerd /fastdfs/FastDFS/conf/tracker.conf
./fdfs_trackerd: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
执行
ln -s /home/super/installLIB/lib/libevent_core.so.3 /lib/libevent_core.so.3
4\注意
运行情况请看日志文件
trackerd.log
storaged.log
它们具体内容如下
trackerd.log
[2010-05-03 06:47:26] INFO - FastDFS v1.27, base_path=/fastdfs/FastDFS, network_timeout=60s, port=22122, bind_addr=, max_connections=256, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=1024MB, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1
[2010-05-03 06:47:26] INFO - HTTP supported: server_port=8080, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0, check_active_interval=30, check_active_type=tcp, check_active_uri=/status.html
storaged.log
[2010-05-03 06:47:29] INFO - FastDFS v1.27, base_path=/fastdfs/FastDFS, store_path_count=1, subdir_count_per_path=256, group_name=group1, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=1, sync_wait_msec=200ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time: 23:59, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=60s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
[2010-05-03 06:47:29] INFO - HTTP supported: server_port=8888, http_trunk_size=262144, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0
[2010-05-03 06:47:30] INFO - file: storage_param_getter.c, line: 225, storage_ip_changed_auto_adjust=1
[2010-05-03 06:47:31] INFO - file: tracker_client_thread.c, line: 257, successfully connect to tracker server 192.168.247.128:22122, as a tracker client, my ip is 192.168.247.128
5\上传图片后(参看install文件)
则返回 http://192.168.247.128:8080/group1/M00/00/00/wKj3gEvd84oAAAAAAABdrVV-uEs424_big.jpg
在ie中执行 http://192.168.247.128:8080/group1/M00/00/00/wKj3gEvd84oAAAAAAABdrVV-uEs424_big.jpg 看到此图片正常运行
6、
查看端口号
lsof -i :端口 号
lsof -i :8080
显示结果
[root@linux2 bin]# lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
fdfs_trac 4742 root 10u IPv4 14679 TCP *:webcache (LISTEN)
[root@call root]# netstat -anp
显示结果
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 2129/hpiod
tcp 0 0 0.0.0.0:835 0.0.0.0:* LISTEN 1925/rpc.statd
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 4742/fdfs_trackerd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1891/portmap
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4742/fdfs_trackerd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2146/cupsd
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 5006/fdfs_storaged
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 5006/fdfs_storaged
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2192/sendmail: acce
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 2134/python
tcp 0 0 192.168.247.128:22122 192.168.247.128:48836 ESTABLISHED 4742/fdfs_trackerd
tcp 0 0 192.168.247.128:48836 192.168.247.128:22122 ESTABLISHED 5006/fdfs_storaged
tcp 0 0 192.168.247.128:57448 192.168.247.128:8888 TIME_WAIT -
tcp 0 0 192.168.247.128:57447 192.168.247.128:8888 TIME_WAIT -
tcp 0 0 :::22 :::* LISTEN 2160/sshd
tcp 0 0 ::ffff:192.168.247.128:22 ::ffff:192.168.247.1:1038 ESTABLISHED 2754/0
tcp 0 0 ::ffff:192.168.247.128:22 ::ffff:192.168.247.1:1051 ESTABLISHED 3358/1
tcp 0 48 ::ffff:192.168.247.128:22 ::ffff:192.168.247.1:1101 ESTABLISHED 4149/2
udp 0 0 0.0.0.0:32768 0.0.0.0:* 2317/avahi-daemon:
udp 0 0 0.0.0.0:829 0.0.0.0:* 1925/rpc.statd
udp 0 0 0.0.0.0:832 0.0.0.0:* 1925/rpc.statd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1748/dhclient
udp 0 0 0.0.0.0:5353 0.0.0.0:* 2317/avahi-daemon:
udp 0 0 0.0.0.0:111 0.0.0.0:* 1891/portmap
udp 0 0 0.0.0.0:631 0.0.0.0:* 2146/cupsd
udp 0 0 :::32769 :::* 2317/avahi-daemon:
udp 0 0 :::5353 :::* 2317/avahi-daemon:
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 11230 2723/gam_server @/tmp/fam-root-
unix 25 [ ] DGRAM 6411 1847/syslogd /dev/log
unix 2 [ ACC ] STREAM LISTENING 10819 2679/scim-launcher /tmp/scim-socket-frontend-root
unix 2 [ ACC ] STREAM LISTENING 11363 2741/mapping-daemon /tmp/mapping-root
7\
wget -S file_url
wget -S http://192.168.247.128:8888/group1/M00/00/00/wKj3gEvd84oAAAAAAABdrVV-uEs424_big.jpg 可以得到文件,并把文件保存在当前路径下
8\
>> 3.store_path这个参数的作用
同一个GROUP中的store_path目录个数必须大小一样,但目录名称可以不相同。
>> 4.能直接访问吗?我认为不能?
可以配合apache使用。在存储服务器上安装apache,将DocumentRoot配置到${base_path}/data目录。
以前有人问过类似的问题,参阅:http://linux.chinaunix.net/bbs/thread-1062825-1-1.html
2.其它这个10台电脑.用rsync就可能实现.好像也没有必要使用fast-dfs吧!
问题一
无法断点调试,断点时报错如下,
Can't find a source file at "/cygdrive/d/eclipse-cpp/workspaces/easyhello/easyhello.cpp"
Locate the file or edit the source lookup path to include its location.
解决:
must provide a mapping from /cygdrive/d to d:\ (or whatever your drive letter is).
in the eclipse IDE, go to menu Window -> Preferences -> C/C++ -> Debug-> Common Source Lookup Path -> Add.
增加一个Path Mapping
名字debugmapping 点击 add
Compilation path ---->/cygdrive/d
Local File System Path ---> d:\
Select OK to finish the dialogs.
注意(Windows平台下),特别要在
make.sh 中加入如下三行
cd /cygdrive/j
cd /cygdrive/j/fastdfs/fastv1.21_twoDevelope/fdstdfs/dfsfast/src/FastDFS
pwd
1、FastDFS底层技术及协议
2、在测试环境中分次搭建如下测试环境
a、一个Tracker Service ,一个Storage Service
a、一个Tracker Service ,多个Storage Service 测试两个 ok
b、多个Tracek Service ,多个Storage Service 都两个,测试中
c、多个分组,每个分组包括一个Tracker Service ,多个Storage Service
d、多个分组,多个Tracek Service ,多个Storage Service
./stop.sh /fastdfs/FastDFS/conf/tracker.conf
fdfs_monitor /fastdfs/FastDFS/conf/storage.conf
fdfs_monitor /fastdfs/FastDFS/conf/client.conf
fdfs_test /fastdfs/FastDFS/conf/client.conf upload /fastdfs/FastDFS/conf/client.conf
[root@bogon bin]# ./fdfs_storaged /fastdfs/FastDFS/conf/storage.conf
[root@bogon bin]# ./fdfs_trackerd /fastdfs/FastDFS/conf/tracker.conf
ERROR - conf file "/fastdfs/FastDFS/conf/tracker.conf", get item "tracker_server" fail
[root@bogon testdata]# /usr/local/bin/fdfs_upload_file /etc/fdfs/client.conf test.swf
group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf
下载文件
[root@bogon testdata]# /usr/local/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf testdown.swf
删除文件
[root@bogon testdata]# /usr/local/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf
2011-03-16
测试在有两个Tracker Service ,两个Storage Service和条件下,分别动态增加一个Storage Service,及动态撒掉一个Tracker Service
在两台Tracker Service 的日志文件中出现如下提示
inceament storage log :
[2011-03-15 22:35:57] INFO - FastDFS v2.09, base_path=/fastdfs/fastdfsdata/incstorageone, store_path_count=1, subdir_count_per_path=256, group_name=group1, connect_timeout=30s, network_timeout=60s, port=23001, bind_addr=, client_bind=1, max_connections=256, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, disk_rw_direct=0, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=2, sync_wait_msec=200ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=60s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
[2011-03-15 22:36:25] INFO - file: storage_param_getter.c, line: 48, storage_ip_changed_auto_adjust=1
[2011-03-15 22:36:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:37:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:38:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:39:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:39:29] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:39:59] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:40:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:40:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:40:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:41:30] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:42:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.129:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:42:00] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 192.168.0.130:22122, as a tracker client, my ip is 192.168.0.130
[2011-03-15 22:36:08] ERROR - file: tracker_mem.c, line: 3749, client ip: 192.168.0.130, port 23001 is not same in the group "group1", group port is 23000
ERROR - file: tracker_mem.c, line: 3749, client ip: 192.168.0.130, port 23001 is not same in the group "group1", group port is 23000
动态改storage.conf 中的组名改成 group3 出现如下提示:
[2011-03-15 22:48:42] ERROR - file: tracker_service.c, line: 461, client ip: 192.168.0.130, invalid group_name: group3
一台机可以配置多个组,每个组都需要一套conf文件,
上传文件通过指定组的方式,没问题
不指定组的方式,直接把两个组都包括进去会怎样呢(不行,要以指定组的方式才可以)
[root@bogon fdfs]# /usr/local/bin/fdfs_append_file client.conf group1/M00/00/00/wKgAgU1_mF_vb_LiAMDAAJQUX_s782.exe /testdata/shankejingling_gerenban.exe
说明 fastdfs-apache-module_v1.04 的工作方式
另外一个解决方案:使用web server扩展模块方式,通过storage server上部署的web server直接对用户提供HTTP下载服务。此时tracker server上不需要开启HTTP服务。
模块工作机制:
1. 对请求URL中的文件名进行反解,得到文件创建时间、文件大小和源storage server IP地址
2. 如果文件在本地存在,直接返回文件内容;否则转3
3. 文件在本地不存在的情况处理:
1)如果 (当前时间 - 文件创建时间) > 文件同步延迟阀值(如一天) 或者 源storage server IP地址在本机IP中(即当前文件上传到的源storage server为本机),则返回404 NOT FOUND
2)如果配置为redirect模式,直接重定向到源storage server IP对应的URL;否则为proxy模式,调用FastDFS client API从源storage server IP获取该文件并返回给客户端
目前已开发完成apache模块,正在测试阶段。
安装 apache
1. 源码包:httpd-2.2.6.tar.gz 从 www.apache.org 下载到此目录下:/usr/local/src 同时在 /usr/local 下创建一个httpd目录:mkdir httpd
2. 解压安装包:tar -zxvf httpd-2.2.6.tar.gz
3. 进入解压后的安装包:cd httpd-2.2.6
4. 配置:./configure --prefix=/usr/local/apache2 --enable-cgi ( 意义支持CGI)
5. 编译:make
6. 安装:make install
7. 启动web服务:
安装后fastdfs-apache-module_v1.04
启动apache 时报
service httpd start
ERROR - conf file "/etc/fdfs/mod_fastdfs.conf", host "tracker" is invalid
kill -9 $(ps -ef|grep httpd|gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')
ERROR1:
邋?httpd锛^[[?1;2cSyntax error on line 281 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
解决办法:[root@bogon conf]# chcon -R -t httpd_sys_content_t /fastdfs/fastdfsdata/storageone/storageone_1/data
chcon -R -t httpd_sys_content_t /fastdfs/testwebdir
Apache版本httpd-2.2.3-11.el5_1.centos.3
欲将www主目录设置为/home/www/html,目录权限如下
drwxr-xr-x 2 root root 4096 01-19 01:12 /home/www/html
httpd.conf配置文件如下
DocumentRoot "/home/www/html"
执行/etc/rc.d/init.d/httpd start出现如下错误
启动 httpd:Syntax error on line 281 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
[失败]
如将DocumentRoot "/home/www/html"替换为DocumentRoot "/var/www/html"
则启动成功。。。
/var/www/html权限如下
drwxr-xr-x 2 root root 4096 01-16 09:36 /var/www/html
百思不得其解。。。望哪位大大告知。。。
seigfied继续试验,设置DocumentRoot "/home/seigfied"
/home/seigfied权限为
drwx------ 2 seigfied seigfied 4096 01-11 17:33 /home/seigfied
执行/etc/rc.d/init.d/httpd start,启动成功
真的没弄明白,/home/www/html明明就是一个目录。。
为什么Apache会告诉我DocumentRoot必须是一个目录呢
kenduest一般通常都是 selinux 問題。
請修改目錄的 security content,讓 apache 有存取該目錄的權限。
chcon -R -t httpd_sys_content_t /home/www/html
另外該相同問題於 linux.vbird.org 您有問過。
http://phorum.vbird.org/viewtopic.php?t=30684
/fastdfs/fastdfsdata/storageone/storageone_1/data/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf
scp root@172.19.2.75:/home/root /home/daisy/*.tar.gz
scp 源文件 root@192.168.0.129:/home/root
配置 fastdfs-apache-module_v1.04 与apache 集成 目录权限重要(即mod_fastdfs.conf中base_path=/fastdfs/fastdfsdata/apachemod目录的权限),不然报如下错误
启动 httpd:[2011-03-17 01:34:22] ERROR - file: ../tracker/tracker_proto.c, line: 541, connect to tracker server 192.168.0.129:22122 fail, errno: 13, error info: Permission denied
[2011-03-17 01:34:22] INFO - fastdfs apache / nginx module v1.04, response_mode=redirect, base_path=/fastdfs/fastdfsdata/apachemod, connect_timeout=2, network_timeout=5, tracker_server_count=1, storage_server_port=23000, group_name=group1, if_alias_prefix=, local_host_ip_count=2, need_find_content_type=0, default_content_type=, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0, storage_sync_file_max_delay=86400s
httpd: apr_sockaddr_info_get() failed for bogon
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
解决办法 chcon -R -t httpd_sys_content_t /fastdfs/fastdfsdata/
这样就可以正常使用了
http://192.168.0.129/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf
2011-03-23
fastdfs-apache-module 有关返回原始文件名的问题
引用
问:
之前看到happy_fish100如下说
模块工作机制:
1. 对请求URL中的文件名进行反解,得到文件创建时间、文件大小和源storage server IP地址
2. 如果文件在本地存在,直接返回文件内容;否则转3
3. 文件在本地不存在的情况处理:
1)如果 (当前时间 - 文件创建时间) > 文件同步延迟阀值(如一天) 或者 源storage server IP地址在本机IP中(即当前文件上传到的源storage server为本机),则返回404 NOT FOUND
2)如果配置为redirect模式,直接重定向到源storage server IP对应的URL;否则为proxy模式,调用FastDFS client API从源storage server IP获取该文件并返回给客户端
=======================================================
我已测试过fastdfs-apache-module,很好用,解决了文件延时问题,有可起到分流分压的作用,有如下问题想问一下
具体问题描述
我有一个文件名叫 "540个活动营销策略.doc" 上传后假如文件名是wKj3gEvd84oAAAAAAABdrVV-uEs424.doc,我想通过redirect的模式在下载时直接返回"540个活动营销策略.doc"(即原始文件名),不知道有没有办法做到,我也看到happy_fish100说过,文件名在通过客户端上传时可以写到属性中,如“540个活动营销策略.doc”写到属性中,但下载(直接下载或用flashget之类的工具)怎样能返回原始中文名(我的站点是做文档分享的)呢,我也想过可不可通过fastdfs-apache-module 在内部进行处理,还请happy_fish100回复
======================================================================================
happy_fish100 回答:
已经有用户提出过这个需求了,呵呵。
原始文件名由应用记录到数据库中,生成下载链接时,URL参数中指定原始文件名,对应的参数名为:filename。
问(由于没及时看到回答,又问):
有过这样的回答:
可以使用文件附加属性来存储该文件的原文件名。在apache或nginx扩展模块中,可以在HTTP Header中输出原文件名。
happy_fish100 回答:
不推荐使用文件附件属性的方式保存原始文件名。
建议原始文件名由应用保存到数据库中。参见我上面的回复。
URL中指定参数filename,例如:filename=xxxx.doc
问:
happy_fish100 ,你好,谢谢你的回复,
QUOTE:已经有用户提出过这个需求了,呵呵。
原始文件名由应用记录到数据库中,生成下载链接时,URL参数中指定原始文件名,对应的参数名为:filename。
你上面说的 filename参数,是特别在fastdfs-apache-module 作过处理的吗?即通过如00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.doc ?filename=540个活动营销策略.doc 样式访问文件,
通过 00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.doc 定位磁盘文件,而filename是用户保存数据文件时的文件名,可以这样理解吗,我想应该是这样,如果是这样,太好了,我的问题解决了
happy_fish100 回答:
是的,你的理解完全正确。
不过文件名中包含中文,因为字符集问题,可能会导致另存时,显示的文件名为乱码。
问:
太谢谢happy_fish100 ,谢谢happy_fish100的提醒
QUOTE:是的,你的理解完全正确。
不过文件名中包含中文,因为字符集问题,可能会导致另存时,显示的文件名为乱码。
这个与apache本身的httpd.conf 的配置文件有关吧,可以让httpd.conf的字符集与网页字符集相应调整,可以解决吧
总之,可以通过如下方法访问物理磁盘文件名
http://192.168.0.129/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf?filename="原始文件名.doc"
发表评论
-
提升磁盘IO性能的几个技巧
2011-05-12 20:47 1752引用本帖最后由 happy_fis ... -
FastDFS注意事项
2011-03-15 17:35 4178>>1.除了在storage.conf ... -
fastdfs-apache-module模块在centos下的使用说明
2011-03-14 16:22 1673from http://www.blogjava.net/ya ... -
fastDfs BBS list
2011-01-13 13:24 872http://linux.chinaunix.net/bbs/ ... -
FastDFS HOWTO - 同步机制
2011-01-13 10:50 1757引用happy_fish100 发表于 2 ... -
网址收集
2010-07-01 11:08 866此链接很好的介绍了FastDfs相关操作,包抱编译\二次开发\ ... -
FashDFS开发环境及配置
2010-06-30 14:23 1533参考资源(以后经常补写) 问查询某个端口是否已被使用 # ...
相关推荐
首先,安装FastDFS-Nginx-Module涉及的步骤包括: 1. 安装FastDFS:这通常涉及到编译安装FastDFS源代码,配置相应的环境变量,并启动FastDFS服务。 2. 安装Nginx:根据系统选择合适的Nginx版本,同样通过编译安装...
4. 安装fastdfs-nginx-module-1.22:将其编译为Nginx的模块,并配置Nginx,指定FastDFS的连接信息。 5. 安装Nginx-1.16.1:编译安装Nginx,配置反向代理规则,指向FastDFS的HTTP接口。 6. 配置负载均衡:如果有多台...
本文将深入探讨FastDFS-Nginx-Module 1.22版本的特性、安装与配置以及实际应用中的注意事项。 FastDFS是一个开源的高性能分布式文件系统,它对文件进行管理,包括文件存储、文件同步、文件访问(文件上传、文件下载...
《FastDFS-Nginx-Module 1.24:高效文件服务器集成详解》 FastDFS-nginx-module 1.24 是一个针对 FastDFS 文件系统的 Nginx 模块,它使得 Nginx 可以无缝地与 FastDFS 集成,提供了高效的文件上传、下载服务。这一...
4. **安装与配置**:首先,需要在服务器上安装FastDFS和Nginx,然后编译并安装FastDFS-nginx-module。配置Nginx的配置文件,包括设置FastDFS的连接参数、URL重写规则等,以实现Nginx与FastDFS的交互。 5. **使用...
在实际部署过程中,首先需要将`fastdfs-nginx-module-master`解压,然后按照官方文档或社区教程进行编译和安装。这通常包括以下步骤: 1. 配置FastDFS环境,包括安装FastDFS、配置Tracker和Storage节点,以及设置...
安装fastdfs-nginx-module_v1.16.tar.gz的过程包括以下几个步骤: 1. 解压源码包:使用tar命令解压fastdfs-nginx-module_v1.16.tar.gz,得到源代码目录。 2. 配置编译环境:确保系统已经安装了Nginx和FastDFS,并且...
1. **模块安装与配置**:首先需要安装FastDFS和Nginx,然后编译并安装FastDFS-Nginx-Module。配置过程中,需要设置FastDFS的连接参数,如tracker服务器地址、端口等,以及Nginx的location配置,确保正确解析FastDFS...
这个压缩包中的"fastdfs-nginx-module-master"目录很可能是FastDFS-Nginx模块的源代码仓库,包含了所有必要的文件和配置,用于编译和安装这个模块,使得Nginx能够直接处理FastDFS的文件请求,提高系统的响应速度和...
本文将详细解析如何将FastDFS的Nginx模块(fastdfs-nginx-module-1.20.zip)安装并配置到Nginx中,实现高效、稳定的服务。 首先,确保你已经安装了FastDFS和Nginx的基础环境。FastDFS提供了数据存储和文件管理的...
在这个场景下,`fastdfs-nginx-module.zip`扮演着关键的角色,它是FastDFS与Nginx之间的重要桥梁。 FastDFS通常与Nginx结合使用,Nginx作为一个强大的反向代理和负载均衡服务器,负责接收HTTP请求,然后将这些请求...
FastDFS-nginx-module-1.22的安装和配置通常涉及以下步骤: 1. **环境准备**:确保系统已经安装了Linux、FastDFS、Nginx的基础环境。 2. **下载解压**:获取fastdfs-nginx-module-1.22.tar.gz文件并解压。 3. **...
《FastDFS-Nginx-Module 5.0.8 深度解析及安装指南》 FastDFS-Nginx-Module是FastDFS分布式文件系统的一个重要组成部分,它为FastDFS提供了一个高性能、高可用的HTTP服务接口。在5.0.8版本中,该模块进一步提升了...
(注意注意,里面有个文件libfastcommon... fastdfs-nginx-module_v1.16.tar.gz FastDFS_v5.05.tar.gz libevent-2.0.22-stable.tar.gz libfastcommon_v1.01.tar.gz nginx-1.6.3.tar.gz ngx_cache_purge-2.3.tar.gz
《FastDFS-Nginx-Module在Linux环境下的安装与配置详解》 FastDFS是一个开源的高性能、轻量级的分布式文件系统,它对文件进行管理,包括文件存储、文件同步、文件访问(文件上传、文件下载)等功能,解决了大容量...
赠送jar包:fastdfs-client-1.27.2.jar; 赠送原API文档:fastdfs-client-1.27.2-javadoc.jar; 赠送源代码:fastdfs-client-1.27.2-sources.jar; 赠送Maven依赖信息文件:fastdfs-client-1.27.2.pom; 包含翻译后...
解决 Maven 无法下载 fastdfs-client-java-1.29-SNAPSHOT 依赖,直接下载之后用maven命令存储到本地maven仓库即可。 maven命令 mvn install:install-file -DgroupId=org.csource -DartifactId=fastdfs-client-java ...
3. 接着,编译并安装Nginx,同时将Fastdfs-nginx-module_v1.19源码编译进Nginx。 4. 配置Nginx的配置文件,设置FastDFS的相关参数,如tracker服务器的地址、连接超时时间等。 5. 最后,启动Nginx服务,测试能否正常...
在安装FastDFS-Nginx模块前,确保已经安装了FastDFS和Nginx的基础环境,包括FastDFS的client库和Nginx服务器。 2. 解压模块 将"fastdfs-nginx-module-master-version1.19.zip"解压,进入解压后的目录。 3. 编译...