FastDFS 的安装和配置 修订版
程序员文章站
2022-05-21 19:57:56
...
FastDFS Home:http://code.google.com/p/fastdfs/
1. 安装
http://code.google.com/p/fastdfs/wiki/Setup http://hi.baidu.com/leolance/blog/item/3c273327978ae55f93580703.html
安装libevent (对libevent的版本要求为1.4.x,建议使用最新的stable版本,如1.4.14b。 注意,千万不要使用libevent 2.0非 将以下命令 copy 到 shell 脚本执行就可以了:
##################### setup fastdfs start #####################
cd /home/download; wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-1.4.14b-stable.tar.gz; tar -zvxf libevent-1.4.14b-stable.tar.gz;
cd libevent-1.4.14b-stable;
./configure; make; make install
ldconfig
mkdir -p /home/server;
mkdir -p /home/fastdfs
cd /home/download; wget http://fastdfs.googlecode.com/files/FastDFS_v3.11.tar.gz tar -zvxf FastDFS_v3.11.tar.gz; mv FastDFS /home/server/FastDFS_v3.11;
cd /home/server/FastDFS_v3.11
./make.sh; ./make.sh install
##################### setup fastdfs end#####################
2. 配置
cd /home/server/FastDFS_v3.11 配置 tracker_server:
vi /etc/fdfs/tracker.conf
设置 base_path=/home/fastdfs;
thread_stack_size = 512KB; http.disabled=true
启动: /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf 配置 storage_server:
vi /etc/fdfs/storage.conf
设置 base_path=/home/fastdfs;
store_path0=/home/fastdfs;
http.disabled=true
tracker_server=192.168.51.110:22122
tracker_server=192.168.51.111:22122 (可以指定多个tracker_server)
启动: /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
*注:如果storage server有多个ip,可以用bind_addr来指定某个特定ip,bind_addr地址会提交给tracker_server,然后track
重启命令:
sh /home/server/FastDFS_v3.11/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf sh /home/server/FastDFS_v3.11/restart.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
3. Nginx插件
cd /home/download;
wget http://fastdfs-nginx-module.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gz;
tar zvxf fastdfs-nginx-module_v1.10.tar.gz
wget http://nginx.org/download/nginx-1.3.4.tar.gz; tar zvxf nginx-1.3.4.tar.gz;
cd nginx-1.3.4; ./configure --prefix=/usr/local/nginx-1.3.4 --add-module=/home/download/fastdfs-nginx-module/src; make; make install;
cp /home/download/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/mod_fastdfs.conf
vi /etc/fdfs/mod_fastdfs.conf
设置: base_path=/home/fastdfs
tracker_server=192.168.51.110:22122
tracker_server=192.168.51.111:22122
store_path0=/home/fastdfs
url_have_group_name = true
log_filename=/usr/local/nginx-1.3.4/conf/fastdfs.log cd /usr/local/nginx-1.3.4;
vi conf/nginx.conf;
添加:
location /group1/M00 {
root /home/fastdfs/data;
ngx_fastdfs_module;
}
启动 nginx: /usr/local/nginx-1.3.4/sbin/nginx 待续。。。
4. 安装 php 驱动
cd /home/server/FastDFS/php_client/ /home/server/php/bin/phpize
./configure --with-php-config=/home/server/php/bin/php-config make; make install
vi /etc/fdfs/client.conf; 设置 base_path; tracker_server; http.tracker_server_port;
vi /home/server/php/etc/php.ini (如果没有,cp /home/download/php-5.3.6/php.ini-production /home/server/php/lib/php.ini) 添加:
extension = fastdfs_client.so
fastdfs_client.tracker_group_count = 1
fastdfs_client.tracker_group0 = /etc/fdfs/client.conf 测试:/usr/local/php/bin/php -m 如果看到 fastdfs_client 说明配置成功了。
此时就可以执行 /usr/local/php/bin/php fastdfs_test.php
1. 安装
http://code.google.com/p/fastdfs/wiki/Setup http://hi.baidu.com/leolance/blog/item/3c273327978ae55f93580703.html
安装libevent (对libevent的版本要求为1.4.x,建议使用最新的stable版本,如1.4.14b。 注意,千万不要使用libevent 2.0非 将以下命令 copy 到 shell 脚本执行就可以了:
##################### setup fastdfs start #####################
cd /home/download; wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-1.4.14b-stable.tar.gz; tar -zvxf libevent-1.4.14b-stable.tar.gz;
cd libevent-1.4.14b-stable;
./configure; make; make install
ldconfig
mkdir -p /home/server;
mkdir -p /home/fastdfs
cd /home/download; wget http://fastdfs.googlecode.com/files/FastDFS_v3.11.tar.gz tar -zvxf FastDFS_v3.11.tar.gz; mv FastDFS /home/server/FastDFS_v3.11;
cd /home/server/FastDFS_v3.11
./make.sh; ./make.sh install
##################### setup fastdfs end#####################
2. 配置
cd /home/server/FastDFS_v3.11 配置 tracker_server:
vi /etc/fdfs/tracker.conf
设置 base_path=/home/fastdfs;
thread_stack_size = 512KB; http.disabled=true
启动: /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf 配置 storage_server:
vi /etc/fdfs/storage.conf
设置 base_path=/home/fastdfs;
store_path0=/home/fastdfs;
http.disabled=true
tracker_server=192.168.51.110:22122
tracker_server=192.168.51.111:22122 (可以指定多个tracker_server)
启动: /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
*注:如果storage server有多个ip,可以用bind_addr来指定某个特定ip,bind_addr地址会提交给tracker_server,然后track
重启命令:
sh /home/server/FastDFS_v3.11/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf sh /home/server/FastDFS_v3.11/restart.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
3. Nginx插件
cd /home/download;
wget http://fastdfs-nginx-module.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gz;
tar zvxf fastdfs-nginx-module_v1.10.tar.gz
wget http://nginx.org/download/nginx-1.3.4.tar.gz; tar zvxf nginx-1.3.4.tar.gz;
cd nginx-1.3.4; ./configure --prefix=/usr/local/nginx-1.3.4 --add-module=/home/download/fastdfs-nginx-module/src; make; make install;
cp /home/download/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/mod_fastdfs.conf
vi /etc/fdfs/mod_fastdfs.conf
设置: base_path=/home/fastdfs
tracker_server=192.168.51.110:22122
tracker_server=192.168.51.111:22122
store_path0=/home/fastdfs
url_have_group_name = true
log_filename=/usr/local/nginx-1.3.4/conf/fastdfs.log cd /usr/local/nginx-1.3.4;
vi conf/nginx.conf;
添加:
location /group1/M00 {
root /home/fastdfs/data;
ngx_fastdfs_module;
}
启动 nginx: /usr/local/nginx-1.3.4/sbin/nginx 待续。。。
4. 安装 php 驱动
cd /home/server/FastDFS/php_client/ /home/server/php/bin/phpize
./configure --with-php-config=/home/server/php/bin/php-config make; make install
vi /etc/fdfs/client.conf; 设置 base_path; tracker_server; http.tracker_server_port;
vi /home/server/php/etc/php.ini (如果没有,cp /home/download/php-5.3.6/php.ini-production /home/server/php/lib/php.ini) 添加:
extension = fastdfs_client.so
fastdfs_client.tracker_group_count = 1
fastdfs_client.tracker_group0 = /etc/fdfs/client.conf 测试:/usr/local/php/bin/php -m 如果看到 fastdfs_client 说明配置成功了。
此时就可以执行 /usr/local/php/bin/php fastdfs_test.php