${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
# ./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
显示结果
# lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
fdfs_trac 4742 root 10u IPv4 14679 TCP *:webcache (LISTEN)
# 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
# ./fdfs_storaged /fastdfs/FastDFS/conf/storage.conf
# ./fdfs_trackerd /fastdfs/FastDFS/conf/tracker.conf
ERROR - conf file "/fastdfs/FastDFS/conf/tracker.conf", get item "tracker_server" fail
# /usr/local/bin/fdfs_upload_file /etc/fdfs/client.conf test.swf
group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf
下载文件
# /usr/local/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf testdown.swf
删除文件
# /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文件,
上传文件通过指定组的方式,没问题
不指定组的方式,直接把两个组都包括进去会怎样呢(不行,要以指定组的方式才可以)
# /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
解决办法:# 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 有存取該目錄的權限。
[code]chcon -R -t httpd_sys_content_t /home/www/html[/code]
另外該相同問題於 linux.vbird.org 您有問過。
[url]http://phorum.vbird.org/viewtopic.php?t=30684[/url]
/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
[b]解决办法 chcon -R -t httpd_sys_content_t /fastdfs/fastdfsdata/ [/b]
这样就可以正常使用了
http://192.168.0.129/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf
2011-03-23
[b]fastdfs-apache-module 有关返回原始文件名的问题 [/b]
[quote]
问:
之前看到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"[/quote]
/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
# ./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
显示结果
# lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
fdfs_trac 4742 root 10u IPv4 14679 TCP *:webcache (LISTEN)
# 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
# ./fdfs_storaged /fastdfs/FastDFS/conf/storage.conf
# ./fdfs_trackerd /fastdfs/FastDFS/conf/tracker.conf
ERROR - conf file "/fastdfs/FastDFS/conf/tracker.conf", get item "tracker_server" fail
# /usr/local/bin/fdfs_upload_file /etc/fdfs/client.conf test.swf
group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf
下载文件
# /usr/local/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKgAgk1_M36eGCazAAHAC_MLulA790.swf testdown.swf
删除文件
# /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文件,
上传文件通过指定组的方式,没问题
不指定组的方式,直接把两个组都包括进去会怎样呢(不行,要以指定组的方式才可以)
# /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
解决办法:# 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 有存取該目錄的權限。
[code]chcon -R -t httpd_sys_content_t /home/www/html[/code]
另外該相同問題於 linux.vbird.org 您有問過。
[url]http://phorum.vbird.org/viewtopic.php?t=30684[/url]
/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
[b]解决办法 chcon -R -t httpd_sys_content_t /fastdfs/fastdfsdata/ [/b]
这样就可以正常使用了
http://192.168.0.129/00/00/wKgAgU2AjDWFE_PHAAHAC_MLulA788.swf
2011-03-23
[b]fastdfs-apache-module 有关返回原始文件名的问题 [/b]
[quote]
问:
之前看到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"[/quote]