fastdfs单机安装试用

step1.安装c库

下载libfastcommon.zip,

unzip libfastcommon-1.0.35.zip
cd libfastcommon-1.0.35
./make.sh
./make.sh install

step2.安装dfs

下载fastdfs-5.08.zip

unzip fastdfs-5.08.zip
cd fastdfs-5.08
./make.sh
./make.sh install

step3.配置

vim conf/storage.conf
vim conf/tracker.conf
vim conf/client.conf

fdfs_trackerd conf/tracker.conf
fdfs_storaged conf/storage.conf

#测试
fdfs_test conf/client.conf upload /root/index.html

比较蛋疼,tracker和storage的文件目录都必须要手动创建,否则起不起来。tracker的地址不能填127.0.0.1。

测试上传下载都成功,但是返回的http连接打不开。查看端口,发现并没有监听80和8080。应该是这些版本不支持了,但是官网都打不开。只好再装nginx。

step4.安装nginx

下载nginx.tar.gz,和fastdfs-nginx-module。解压。yum install prce-devel openssl openssl-dev,然后编译安装Nginx

./configure --add-module=/opt/fastdfs-nginx-module-master/src \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-http_slice_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-http_v2_module \
--with-ipv6
useradd -s /sbin/nologin -M nginx

添加一个nginx用户后启动,发现各种配置文件没有,但是又不在fdfs-nginx-module里。找了一圈,把fastdfs-5.08/conf 下的http.conf mime.types都复制到/etc/fdfs下。正常了

配置nginx,

location /M00 {
          alias /opt/fastdfs/storage/data0/data;
          ngx_fastdfs_module;
        }

http://192.168.137.2/M00/00/00/wKiJAljAJm2Aaf1qAABQd2XUFnc359.png 这种路径就可以访问了,

但是中间的那个group1不见了……虽然可以自己加。

扫描二维码关注公众号,回复: 869518 查看本文章

很奇怪我只有一个storage,上传文件时不知道为什么会产生两个文件。

tracker_query_storage_store_list_without_group: 
        server 1. group_name=, ip_addr=192.168.137.2, port=23000

group_name=group1, ip_addr=192.168.137.2, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKiJAljAJm2Aaf1qAABQd2XUFnc359.png
source ip address: 192.168.137.2
file timestamp=2017-03-08 23:42:37
file size=20599
file crc32=1708398199
example file url: http://192.168.137.2/group1/M00/00/00/wKiJAljAJm2Aaf1qAABQd2XUFnc359.png
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKiJAljAJm2Aaf1qAABQd2XUFnc359_big.png
source ip address: 192.168.137.2
file timestamp=2017-03-08 23:42:37
file size=20599
file crc32=1708398199
example file url: http://192.168.137.2/group1/M00/00/00/wKiJAljAJm2Aaf1qAABQd2XUFnc359_big.png

试问那个_big结尾的,是用来冗余的吗?以及M00这个是指盘符吗?

如果官网不挂就还好。否则有啥子用?

猜你喜欢

转载自my.oschina.net/u/1047640/blog/856280
今日推荐