CentOS 單機(jī)搭建FastDFS文件系統(tǒng)

此例為在CentOS7.2 單機(jī)上搭建一個FastDFS 文件管理系統(tǒng)

FastDFS架構(gòu)圖
軟件名稱 版本 百度云盤存放名稱
FastDFS 5.11 fastdfs-5.11.zip
FastDFS-Nginx-module fastdfs-nginx-module-master.zip
LibFastCommon 1.0.36 libfastcommon-1.0.36.zip
nginx 1.10.3 nginx-1.10.3.tar.gz

安裝所需文件均上傳到百度云盤覆享,位置:FastDFS百度云盤
安裝清單如下:

軟件名稱 版本 百度云盤存放名稱
FastDFS 5.11 fastdfs-5.11.zip
FastDFS-Nginx-module fastdfs-nginx-module-master.zip
LibFastCommon 1.0.36 libfastcommon-1.0.36.zip
nginx 1.10.3 nginx-1.10.3.tar.gz

一、安裝FastDFS

1.安裝libfastcommon

先解壓安裝包到目錄

[root@localhost fastDFS]# unzip libfastcommon-1.0.36.zip 

解壓后目錄如下:

[root@localhost fastdfs-5.11]# ll
[root@localhost libfastcommon-1.0.36]# ll
總用量 32
drwxr-xr-x. 2 root root  117 4月   5 2017 doc
-rw-r--r--. 1 root root 8005 4月   5 2017 HISTORY
-rw-r--r--. 1 root root  566 4月   5 2017 INSTALL
-rw-r--r--. 1 root root 1606 4月   5 2017 libfastcommon.spec
-rwxr-xr-x. 1 root root 3099 4月   5 2017 make.sh
drwxr-xr-x. 2 root root  191 4月   5 2017 php-fastcommon
-rw-r--r--. 1 root root 2763 4月   5 2017 README
drwxr-xr-x. 3 root root 4096 1月  17 11:21 src

安裝C編譯工具 gcc

[root@localhost fastdfs-5.11]# yum -y install gcc-c++

編譯libfastcommon軟件并安裝

[root@localhost fastdfs-5.11]# ./make.sh  && ./make.sh install

為libcommon 創(chuàng)建軟鏈接到/usr/local/lib目錄下

[root@localhost fastdfs-5.11]# ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
[root@localhost fastdfs-5.11]# ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
[root@localhost fastdfs-5.11]# ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
[root@localhost fastdfs-5.11]# ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so

2.安裝FastDFS

解壓安裝包

[root@localhost fastDFS]# unzip fastdfs-5.11.zip 

解壓后目錄如下:

總用量 128
drwxr-xr-x. 3 root root  4096 1月  17 11:25 client
drwxr-xr-x. 2 root root  4096 1月  17 11:25 common
drwxr-xr-x. 2 root root   146 6月   3 2017 conf
-rw-r--r--. 1 root root 35067 6月   3 2017 COPYING-3_0.txt
-rw-r--r--. 1 root root  3171 6月   3 2017 fastdfs.spec
-rw-r--r--. 1 root root 33100 6月   3 2017 HISTORY
drwxr-xr-x. 2 root root    48 6月   3 2017 init.d
-rw-r--r--. 1 root root  7755 6月   3 2017 INSTALL
-rwxr-xr-x. 1 root root  5548 6月   3 2017 make.sh
drwxr-xr-x. 2 root root  4096 6月   3 2017 php_client
-rw-r--r--. 1 root root  2380 6月   3 2017 README.md
-rwxr-xr-x. 1 root root  1768 6月   3 2017 restart.sh
-rwxr-xr-x. 1 root root  1680 6月   3 2017 stop.sh
drwxr-xr-x. 4 root root  4096 1月  17 11:25 storage
drwxr-xr-x. 2 root root  4096 6月   3 2017 test
drwxr-xr-x. 2 root root  4096 1月  17 11:25 tracker

進(jìn)入解壓目錄并進(jìn)行編譯和安裝

[root@localhost fastDFS]# cd fastdfs-5.11/
[root@localhost fastdfs-5.11]# ./make.sh  && ./make.sh install

安裝成功后臭觉,F(xiàn)astDFS會安裝在/etc/fdfs目錄下:

[root@localhost fastdfs-5.11]# ll /etc/fdfs/
總用量 76
-rw-r--r--. 1 root root   316 1月  17 11:47 client.conf
-rw-r--r--. 1 root root  1461 1月  17 11:25 client.conf.sample
-rw-r--r--. 1 root root   955 1月  17 13:20 http.conf
-rw-r--r--. 1 root root 31172 1月  17 13:21 mime.types
-rw-r--r--. 1 root root  3716 1月  17 12:57 mod_fastdfs.conf
-rw-r--r--. 1 root root  1278 1月  17 11:40 storage.conf
-rw-r--r--. 1 root root  7927 1月  17 11:25 storage.conf.sample
-rw-r--r--. 1 root root   105 1月  17 11:25 storage_ids.conf.sample
-rw-r--r--. 1 root root  1356 1月  17 11:34 tracker.conf
-rw-r--r--. 1 root root  7389 1月  17 11:25 tracker.conf.sample

我們需要把這三個示例文件復(fù)制一份,去掉.sample

[root@localhost fdfs]# cp client.conf.sample client.conf
[root@localhost fdfs]# cp storage.conf.sample storage.conf
[root@localhost fdfs]# cp tracker.conf.sample tracker.conf

FastDFS安裝結(jié)束

二、安裝Tracker

1.創(chuàng)建tracker工作目錄

此目錄用于保存tracker 的data和log

[root@localhost fdfs]# mkdir /opt/fastdfs_tracker

2.配置tracker

配置 /etc/fdfs目錄下tracker.conf
主要實現(xiàn)以下4個配置內(nèi)容:

1.disabled=false 
2.port=22122 #默認(rèn)端口號 
3.base_path=/opt/fastdfs_tracker #我剛剛創(chuàng)建的目錄 
4.http.server_port=8080 #默認(rèn)端口是8080
5.bind_addr= 0.0.0.0 監(jiān)聽地址

完整tracker.conf 文件信息如下:

disabled=false

bind_addr= 0.0.0.0

port=22122

connect_timeout=30

network_timeout=60

base_path=/opt/fastdfs_tracker

max_connections=512

accept_threads=1

work_threads=4

min_buff_size = 8KB

max_buff_size = 128KB

store_lookup=2

store_group=group2

store_server=0

store_path=0

download_server=0

reserved_storage_space = 10%

log_level=info

run_by_group=

run_by_user=

allow_hosts=*

sync_log_buff_interval = 10

check_active_interval = 120

thread_stack_size = 64KB

storage_ip_changed_auto_adjust = true

storage_sync_file_max_delay = 86400

storage_sync_file_max_time = 300

use_trunk_file = false 

slot_min_size = 256

slot_max_size = 16MB

trunk_file_size = 64MB

trunk_create_file_advance = false

trunk_create_file_time_base = 02:00

trunk_create_file_interval = 86400

trunk_create_file_space_threshold = 20G

trunk_init_check_occupying = false

trunk_init_reload_from_binlog = false

trunk_compress_binlog_min_interval = 0

use_storage_id = false

storage_ids_filename = storage_ids.conf

id_type_in_filename = ip

store_slave_file_use_link = false

rotate_error_log = false

error_log_rotate_time=00:00

rotate_error_log_size = 0

log_file_keep_days = 0

use_connection_pool = false

connection_pool_max_idle_time = 3600

http.server_port=8080

http.check_alive_interval=30

http.check_alive_type=tcp

http.check_alive_uri=/status.html

修改保存后創(chuàng)建軟引用

[root@localhost fdfs]# ln -s /usr/bin/fdfs_storaged /usr/local/bin

4.啟動tracker闯捎,并加入開機(jī)啟動項

[root@localhost fdfs]# service fdfs_trackerd start

進(jìn)行剛剛創(chuàng)建的tracker目錄撒蟀,發(fā)現(xiàn)目錄中多了data和log兩個目錄

[root@localhost fdfs]# ll /opt/fastdfs_tracker/
總用量 0
drwxr-xr-x. 2 root root 178 1月  17 13:48 data
drwxr-xr-x. 2 root root  26 1月  17 11:35 logs

將tracker加入開機(jī)啟動項

[root@localhost fdfs]# echo "service fdfs_trackerd start" |tee -a /etc/rc.d/rc.local

查看一下tracker的端口監(jiān)聽情況

[root@localhost fdfs]# netstat -unltp|grep fdfs
tcp        0      0 0.0.0.0:22122           0.0.0.0:*               LISTEN      3088/fdfs_trackerd  

三叙谨、安裝Storage

1.配置storage工作目錄

由于storage還需要一個目錄用來存儲數(shù)據(jù),因此多建了兩個目錄fastdfs_storage_data,fastdfs_storage

[root@localhost opt]# mkdir fastdfs_storage
[root@localhost opt]# mkdir fastdfs_storage_data
[root@localhost opt]# ll
總用量 0
drwxr-xr-x. 4 root root 30 1月  17 11:45 fastdfs_storage
drwxr-xr-x. 3 root root 18 1月  17 11:45 fastdfs_storage_data
drwxr-xr-x. 4 root root 30 1月  17 11:35 fastdfs_tracker

2.配置storage文件

修改 /etc/fdfs 目錄下 storage.conf 文件
修改要點如下:

1.disabled=false 
2.group_name=group1 #組名保屯,根據(jù)實際情況修改 
3.port=23000 #設(shè)置storage的端口號手负,默認(rèn)是23000,同一個組的storage端口號必須一致 
4.base_path=/opt/fastdfs_storage #設(shè)置storage數(shù)據(jù)文件和日志目錄 
5.store_path_count=1 #存儲路徑個數(shù)姑尺,需要和store_path個數(shù)匹配 
6.store_path0=/opt/fastdfs_storage_data #實際文件存儲路徑 
7.tracker_server=192.168.43.60:22122 #我CentOS7的ip地址 
8.http.server_port=8888 #設(shè)置 http 端口號

完整信息如下:

disabled=false
group_name=group1
bind_addr= 0.0.0.0
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/opt/fastdfs_storage
max_connections=256
buff_size = 256KB
accept_threads=1
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/opt/fastdfs_storage_data
subdir_count_per_path=256
tracker_server=192.168.43.60:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
file_signature_method=hash
key_namespace=FastDFS
keep_alive=0
use_access_log = false
rotate_access_log = false
access_log_rotate_time=00:00
rotate_error_log = false
error_log_rotate_time=00:00
rotate_access_log_size = 0
rotate_error_log_size = 0
log_file_keep_days = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=8888

修改保存后創(chuàng)建軟引用

[root@localhost fdfs]#  ln -s /usr/bin/fdfs_storaged /usr/local/bin

3.啟動Storage

[root@localhost fdfs]# service fdfs_storaged start

設(shè)置開機(jī)啟動:

[root@localhost fdfs]#  echo "service fdfs_storaged start" |tee -a /etc/rc.d/rc.local

查看一下服務(wù)是否啟動

[root@localhost fdfs]# netstat -unltp | grep fdfs 
tcp        0      0 0.0.0.0:22122           0.0.0.0:*               LISTEN      3088/fdfs_trackerd  
tcp        0      0 0.0.0.0:23000           0.0.0.0:*               LISTEN      3139/fdfs_storaged  

4.校驗整合

到這里竟终,fastdfs的東西都已安裝完成,最后我們還要確定一下切蟋,storage是否注冊到了tracker中去统捶。
查看命令:

[root@localhost fdfs]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf

成功后可以看到:
ip_addr = 192.168.43.60 (localhost.localdomain) ACTIVE

四、測試

1.配置客戶端

修改 /etc/fdfs/目錄下的client.conf 文件
修改要點為:

base_path=/opt/fastdfs_tracker #tracker服務(wù)器文件路徑
tracker_server=192.168.43.60:22122 #tracker服務(wù)器IP地址和端口號
http.tracker_server_port=8080 # tracker 服務(wù)器的 http端口號,必須和tracker的設(shè)置對應(yīng)起來

完整client.conf 文件信息如下:

connect_timeout=30
network_timeout=60
base_path=/opt/fastdfs_tracker
tracker_server=192.168.43.60:22122
log_level=info
use_connection_pool = false
connection_pool_max_idle_time = 3600
load_fdfs_parameters_from_tracker=false
use_storage_id = false
storage_ids_filename = storage_ids.conf
http.tracker_server_port=8080

模擬上傳
從個人用戶目錄上傳一個圖片喘鸟,進(jìn)行測試

[root@localhost fdfs]# fdfs_upload_file  /etc/fdfs/client.conf /home/zhangyongliang/9408.jpg  #這后面放的是圖片的位置

成功后會返回圖片存儲路徑

[root@localhost fdfs]# fdfs_upload_file  /etc/fdfs/client.conf /home/zhangyongliang/9408.jpg 
group1/M00/00/00/wKgrPFpe9OqAWsHxAAH5yvc2jn8251.jpg

組名:group1
磁盤:M00
目錄:00/00
文件名稱:wKgrPFpe9OqAWsHxAAH5yvc2jn8251.jpg
定位上傳的文件位置如下:

[root@localhost fdfs]# ll /opt/fastdfs_storage_data/data/00/00/
總用量 256
-rw-r--r--. 1 root root 129482 1月  17 15:02 wKgrPFpe9OqAWsHxAAH5yvc2jn8251.jpg
-rw-r--r--. 1 root root 129482 1月  17 11:53 wKgrPFpeyM2ATkGUAAH5yvc2jn8013.jpg

實際文件存儲路徑下有創(chuàng)建好的多級目錄匆绣。data下有256個1級目錄,每級目錄下又有256個2級子目錄什黑,總共65536個文件崎淳,新寫的文件會以hash的方式被路由到其中某個子目錄下,然后將文件數(shù)據(jù)直接作為一個本地文件存儲到該目錄中愕把。

如果要訪問剛上傳的圖片拣凹,我們得需要結(jié)合nginx來實現(xiàn)

五、安裝Nginx并實現(xiàn)配置

1.安裝Nginx依賴環(huán)境

[root@localhost fdfs]# yum -y install pcre pcre-devel  
[root@localhost fdfs]# yum -y install zlib zlib-devel  
[root@localhost fdfs]# yum -y install openssl openssl-devel

2.安裝nginx并添加fastdfs-nginx-module

解壓nginx和fastdfs-nginx-module

[root@localhost fdfs]# tar -zxvf nginx-1.10.3.tar.gz
[root@localhost fdfs]# unzip fastdfs-nginx-module-master.zip

解壓后進(jìn)入nginx目錄編譯安裝nginx,并添加fastdfs-nginx-module

[root@localhost nginx-1.10.3]# ./configure --prefix=/usr/local/nginx --add-module=/home/zhangyongliang/apps/fastdfs-nginx-module-master/src #解壓后fastdfs-nginx-module所在的位置

之后進(jìn)行編譯和安裝

[root@localhost nginx-1.10.3]# make && make isntall

安裝成功后恨豁,nginx會安裝在/usr/local/nginx,安裝后查看

[root@localhost src]# ll /usr/local/nginx/
總用量 8
drwx------. 2 nobody root    6 1月  17 13:23 client_body_temp
drwxr-xr-x. 2 root   root 4096 1月  17 13:17 conf
drwx------. 2 nobody root    6 1月  17 13:23 fastcgi_temp
drwxr-xr-x. 2 root   root   40 1月  17 13:17 html
drwxr-xr-x. 2 root   root   58 1月  17 13:49 logs
-rw-r--r--. 1 root   root 1156 1月  17 13:29 nginx.conf
drwx------. 2 nobody root    6 1月  17 13:23 proxy_temp
drwxr-xr-x. 2 root   root   19 1月  17 13:17 sbin
drwx------. 2 nobody root    6 1月  17 13:23 scgi_temp
drwx------. 2 nobody root    6 1月  17 13:23 uwsgi_temp

安裝成功后嚣镜,nginx尚未運行時,nginx文件夾沒有臨時文件夾橘蜜,例如fastcgi_temp這些文件祈惶。

3.配置Storage Nginx

修改Nginx 目錄下 conf 的配置文件nginx.conf,新增location信息,具體如下:

server {
        listen       9991;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location ~/group1/M00 {
            root /opt/fastdfs_storage/data;
            ngx_fastdfs_module;
        }

        location = /50x.html {
            root   html;
        }
}

然后進(jìn)入FastDFS安裝時的解壓過的目錄扮匠,將http.conf和mime.types拷貝到/etc/fdfs目錄下:

[root@localhost src]# cp http.conf  mime.types  /etc/fdfs/
[root@localhost src]# cp mime.types  /etc/fdfs/

另外還需要把fastdfs-nginx-module安裝目錄中src目錄下的mod_fastdfs.conf也拷貝到/etc/fdfs目錄下:

[root@localhost src]# cp mod_fastdfs.conf  /etc/fdfs/

對剛剛拷貝的mod_fastdfs.conf文件進(jìn)行修改:

base_path=/opt/fastdfs_storage  #保存日志目錄
tracker_server=192.168.43.60:22122 #tracker服務(wù)器的IP地址以及端口號
storage_server_port=23000 #storage服務(wù)器的端口號
url_have_group_name = true #文件 url 中是否有 group 名
store_path0=/opt/fastdfs_storage_data   #存儲路徑
group_count = 1 #設(shè)置組的個數(shù)

在文件的最后捧请,設(shè)置group

[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/opt/fastdfs_storage_data

創(chuàng)建M00至storage存儲目錄的符號連接:

ln  -s  /opt/fastdfs_storage_data/data/ /opt/fastdfs_storage_data/data/M00

啟動Nginx:

[root@localhost src]# /usr/local/nginx/sbin/nginx

訪問Nginx是否啟動

[root@localhost src]# curl localhost:9991
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a >nginx.org</a>.<br/>
Commercial support is available at
<a >nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

4.配置Tracker Nginx

在nginx.conf 文件添加一個虛擬機(jī)

upstream fdfs_group1 {
        server 127.0.0.1:9991;
    }
   server {
        listen       80;
        server_name  localhost;
       location /group1/M00 {
            proxy_pass http://fdfs_group1;
        }
      error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

完整nginx.conf配置文件如下:


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       9991;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
        location ~/group1/M00 {
            root /opt/fastdfs_storage/data;
            ngx_fastdfs_module;
        }
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    upstream fdfs_group1 {
       server 127.0.0.1:9991;
    }
     server {
        listen       80;
        server_name  localhost;
       location /group1/M00 {
            proxy_pass http://fdfs_group1;
        }
      error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

將Nginx重新啟動

[root@localhost src]# /usr/local/nginx/sbin/nginx -s reload

訪問Nginx是否已經(jīng)啟動

[root@localhost src]# curl localhost:9991
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a >nginx.org</a>.<br/>
Commercial support is available at
<a >nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[root@localhost src]# curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a >nginx.org</a>.<br/>
Commercial support is available at
<a >nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

5.HTTP訪問圖片資源

訪問圖片資源路徑http://192.168.43.60/group1/M00/00/00/wKgrPFpeyM2ATkGUAAH5yvc2jn8013.jpg

FastDFS資源訪問截圖

說明: 如圖片資源無法訪問,請關(guān)閉系統(tǒng)防火墻
可以看到已經(jīng)圖片棒搜,說明你已成功實現(xiàn)了FastDFS單機(jī)的文件系統(tǒng)搭建疹蛉。

補充說明:

如果Tracker 服務(wù)、Storage服務(wù)力麸、Nginx服務(wù)開機(jī)后沒有自啟動可款,請執(zhí)行一下操作并進(jìn)行重啟

[root@localhost ~]# chkconfig  --add fdfs_trackerd
[root@localhost ~]# chkconfig  --add fdfs_storaged

編輯目錄下的/etc/rc.d/rc.local,內(nèi)容如下:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
/usr/local/nginx/sbin/nginx

主要增加了Nginx的啟動,之后進(jìn)行文件授權(quán)克蚂,生效文件闺鲸,重新啟動系統(tǒng)

[root@localhost ~]# chmod  +x /etc/rc.d/rc.local
[root@localhost ~]# source /etc/rc.d/rc.local 
[root@localhost ~]# reboot
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市埃叭,隨后出現(xiàn)的幾起案子摸恍,更是在濱河造成了極大的恐慌,老刑警劉巖赤屋,帶你破解...
    沈念sama閱讀 219,589評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件立镶,死亡現(xiàn)場離奇詭異,居然都是意外死亡类早,警方通過查閱死者的電腦和手機(jī)媚媒,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,615評論 3 396
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來涩僻,“玉大人缭召,你說我怎么就攤上這事栈顷。” “怎么了嵌巷?”我有些...
    開封第一講書人閱讀 165,933評論 0 356
  • 文/不壞的土叔 我叫張陵妨蛹,是天一觀的道長。 經(jīng)常有香客問我晴竞,道長,這世上最難降的妖魔是什么狠半? 我笑而不...
    開封第一講書人閱讀 58,976評論 1 295
  • 正文 為了忘掉前任噩死,我火速辦了婚禮,結(jié)果婚禮上神年,老公的妹妹穿的比我還像新娘已维。我一直安慰自己,他們只是感情好已日,可當(dāng)我...
    茶點故事閱讀 67,999評論 6 393
  • 文/花漫 我一把揭開白布垛耳。 她就那樣靜靜地躺著,像睡著了一般飘千。 火紅的嫁衣襯著肌膚如雪堂鲜。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,775評論 1 307
  • 那天护奈,我揣著相機(jī)與錄音缔莲,去河邊找鬼。 笑死霉旗,一個胖子當(dāng)著我的面吹牛痴奏,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播厌秒,決...
    沈念sama閱讀 40,474評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼读拆,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了鸵闪?” 一聲冷哼從身側(cè)響起檐晕,我...
    開封第一講書人閱讀 39,359評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎蚌讼,沒想到半個月后棉姐,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,854評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡啦逆,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,007評論 3 338
  • 正文 我和宋清朗相戀三年伞矩,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片夏志。...
    茶點故事閱讀 40,146評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡乃坤,死狀恐怖苛让,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情湿诊,我是刑警寧澤狱杰,帶...
    沈念sama閱讀 35,826評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站厅须,受9級特大地震影響仿畸,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜朗和,卻給世界環(huán)境...
    茶點故事閱讀 41,484評論 3 331
  • 文/蒙蒙 一错沽、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧眶拉,春花似錦千埃、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,029評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至朝刊,卻和暖如春耀里,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背拾氓。 一陣腳步聲響...
    開封第一講書人閱讀 33,153評論 1 272
  • 我被黑心中介騙來泰國打工备韧, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人痪枫。 一個月前我還...
    沈念sama閱讀 48,420評論 3 373
  • 正文 我出身青樓织堂,卻偏偏與公主長得像,于是被迫代替她去往敵國和親奶陈。 傳聞我的和親對象是個殘疾皇子易阳,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,107評論 2 356