设为首页 收藏本站
查看: 1270|回复: 0

[经验分享] FastDFS安装配置实使用

[复制链接]

尚未签到

发表于 2019-1-31 13:46:24 | 显示全部楼层 |阅读模式
FastDFS安装
环境介绍:
tracker:192.168.43.129
storage:192.168.43.130

软件下载:
wget http://fastdfs.googlecode.com/files/FastDFS_v3.02.tar.gz  
wget –no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
安装开始
一  首先安装libevent FastDFS这个步骤在tracker storage都需要操作
wget –no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
tar zxvf libevent-2.0.20-stable.tar.gz
./configure   && make  && make install
ln -s /usr/local/lib/libevent* /lib/
ln -s /usr/local/lib/libevent* /lib64/
wget http://fastdfs.googlecode.com/files/FastDFS_v3.02.tar.gz
tar zxvf FastDFS_v3.02.tar.gz
cd FastDFS

  • vim make.sh
    ############
    TARGET_PREFIX=/usr/local  改成  TARGET_PREFIX=/usr/local/FastDFS
    #WITH_HTTPD=1             改成  WITH_HTTPD=1
    #WITH_LINUX_SERVICE=1     改成  WITH_LINUX_SERVICE=1
    ############
    ./make.sh
    ./make.sh install

这样软件安装就已经完成 现在就单独配置tracker storage的配置文件了

  • 二 登陆192.168.43.129 配置/etc/fdfs/tracker.conf
    [root@server fdfs]#grep -v '^#' tracker.conf  |grep -v '^$'
    disabled=false
    bind_addr=
    port=22122             ##端口
    connect_timeout=30
    network_timeout=60
    base_path=/home/data/fastdfs      ##存储路径
    max_connections=256
    work_threads=4
    store_lookup=2
    store_group=group2
    store_server=0
    store_path=0
    download_server=0
    reserved_storage_space = 1GB
    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
    http.disabled=false
    http.server_port=8090              ##http端口  默认是8080
    http.check_alive_interval=30
    http.check_alive_type=tcp
    http.check_alive_uri=/status.html
    http.need_find_content_type=true
启动tracher服务:
/usr/local/FastDFS/bin/fdfs_trackerd  /etc/fdfs/tracker.conf

[root@clinet2 fdfs]# netstat -antp|grep fdfs
tcp        0      0 0.0.0.0:22122               0.0.0.0:*                   LISTEN      20112/fdfs_trackerd
tcp        0      0 0.0.0.0:8090                0.0.0.0:*                   LISTEN      20112/fdfs_trackerd
tcp        0      0 192.168.43.129:22122        192.168.43.130:54911        ESTABLISHED 20112/fdfs_trackerd

  • 登陆192.168.43.130 配置storage 配置/etc/fdfs/    storage.conf  && client.conf  &&http.conf
    [root@clinet1 fdfs]# grep -v '^#' storage.conf  |grep -v '^$'
    disabled=false
    group_name=group1
    bind_addr=192.168.43.130  ##本storage的ip   
    client_bind=true
    port=23000                  ##默认端口
    connect_timeout=30
    network_timeout=60
    heart_beat_interval=30
    stat_report_interval=60
    base_path=/home/data/fastdfs  ##存储路径
    max_connections=256
    buff_size = 256KB
    work_threads=4
    disk_rw_separated = true
    disk_rw_direct = false
    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=/home/data/fastdfs    ##路径
    subdir_count_per_path=256
    tracker_server=192.168.43.129:22122   ##tracher服务器ip地址
    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
    key_namespace=FastDFS
    keep_alive=0
    http.disabled=false
    http.domain_name=
    http.server_port=8888           ##本stroage的http端口
    http.trunk_size=256KB
    http.need_find_content_type=true

  • [root@clinet1 fdfs]# grep -v '^#' http.conf  |grep -v '^$'
    http.default_content_type = application/octet-stream
    http.mime_types_filename=mime.types
    http.anti_steal.check_token=false
    http.anti_steal.token_ttl=900
    http.anti_steal.secret_key=FastDFS1234567890
    http.anti_steal.token_check_fail=/home/data/fastdfs/conf/anti-steal.jpg   ##路径

  • [root@clinet1 fdfs]# grep -v '^#' client.conf  |grep -v '^$'         
    connect_timeout=30
    network_timeout=60
    base_path=/home/data/fastdfs              ##存储路径
    tracker_server=192.168.43.129:22122       ##tracherip地址和启动端口
    log_level=info
    http.tracker_server_port=8090             ##这个是tracher的httpd端口 默认是8080
所有配置完成,启动服务
/usr/local/FastDFS/bin/fdfs_storaged  /etc/fdfs/storage.conf

[root@clinet1 fdfs]# netstat -antp|grep fdfs
tcp        0      0 192.168.43.130:8888         0.0.0.0:*                   LISTEN      12724/fdfs_storaged
tcp        0      0 192.168.43.130:23000        0.0.0.0:*                   LISTEN      12724/fdfs_storaged
tcp        0      0 192.168.43.130:54911        192.168.43.129:22122        ESTABLISHED 12724/fdfs_storaged
测试:
在storage服务器里面执行:
[root@clinet1 ~]# /usr/local/FastDFS/bin/fdfs_test /etc/fdfs/client.conf  upload hello.html
This is FastDFS client test program v3.02
Copyright (C) 2008, Happy Fish / YuQing
FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail.
[2013-02-28 20:09:30] INFO - base_path=/home/data/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0
tracker_query_storage_store_list_without_group:
        server 1. group_name=group1, ip_addr=192.168.43.130, port=23000
group_name=group1, ip_addr=192.168.43.130, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854.html
source ip address: 192.168.43.130
file timestamp=2013-02-28 20:09:30
file size=13
file crc32=3420964911
file url: http://192.168.43.129:8090/group1/M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854.html
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854_big.html
source ip address: 192.168.43.130
file timestamp=2013-02-28 20:09:30
file size=13
file crc32=3420964911
file url: http://192.168.43.129:8090/group1/M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854_big.html
####上述就说明hello.html这个文件已经被上传到192.168.43.129 tracker服务器中 然后使用http://192.168.43.129:8090/group1/M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854_big.html即可访问




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-670106-1-1.html 上篇帖子: fastdfs负载均衡 下篇帖子: FastDFS单点在 CentOS 安装部署
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表