142536a 发表于 2019-2-1 06:59:32

FastDFS 分布式文件系统之二storage 服务部署

  storage 安装
  1, 安装相关库文件
      git clone https://github.com/happyfish100/libfastcommon.git
      cd libfastcommon/
      sh make.sh
      sh make.sh install  

  2, 安装fastDFS
      git clone https://github.com/happyfish100/fastdfs.git
      cd fastdfs
      sh make.sh
      sh make.sh install  

  3, 安装完成截图
      mkdir -p /usr/bin
      mkdir -p /etc/fdfs
      cp -f fdfs_trackerd /usr/bin
      if [ ! -f /etc/fdfs/tracker.conf.sample ]; then cp -f ../conf/tracker.conf /etc/fdfs/tracker.conf.sample; fi
      mkdir -p /usr/bin
      mkdir -p /etc/fdfs
      cp -f fdfs_storaged/usr/bin
      if [ ! -f /etc/fdfs/storage.conf.sample ]; then cp -f ../conf/storage.conf /etc/fdfs/storage.conf.sample; fi
      mkdir -p /usr/bin
      mkdir -p /etc/fdfs
      mkdir -p /usr/lib64
      cp -f fdfs_monitor fdfs_test fdfs_test1 fdfs_crc32 fdfs_upload_file fdfs_download_file fdfs_delete_file fdfs_file_info fdfs_appender_test fdfs_appender_test1 fdfs_append_file fdfs_upload_appender /usr/bin
      if [ 0 -eq 1 ]; then cp -f libfdfsclient.a /usr/lib64; fi
      if [ 1 -eq 1 ]; then cp -f libfdfsclient.so /usr/lib64; fi
      mkdir -p /usr/include/fastdfs
      cp -f ../common/fdfs_define.h ../common/fdfs_global.h ../common/mime_file_parser.h ../common/fdfs_http_shared.h ../tracker/tracker_types.h ../tracker/tracker_proto.h ../tracker/fdfs_shared_func.h ../storage/trunk_mgr/trunk_shared.h tracker_client.h storage_client.h storage_client1.h client_func.h client_global.h fdfs_client.h /usr/include/fastdfs
      if [ ! -f /etc/fdfs/client.conf.sample ]; then cp -f ../conf/client.conf /etc/fdfs/client.conf.sample; fi  

  4, storage配置
      1, 更改/etc/fdfs/storaged.conf 配置
      # cat storage.conf |grep -v '^$'|grep -v '#'
      disabled=false
      group_name=group1
      bind_addr=192.168.6.55
      client_bind=true
      port=23000
      connect_timeout=30
      network_timeout=120
      heart_beat_interval=30
      stat_report_interval=60
      base_path=/var/log/fastdfs
      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=2
      store_path0=/data0/fastdfs
      store_path1=/data1/fastdfs
      subdir_count_per_path=256
      tracker_server=192.168.0.1: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      2,配置storage_idc.conf
      # cat storage_ids.conf
      #   
      # 100001   group1192.168.0.196
      # 100002   group1192.168.0.11
      #每个服务器对应一个group
      100001group1192.168.0.2
      100002group1192.168.0.3
      100003group1192.168.0.4      2, 创建日志目录
            mkdir /var/log/fastdfs  

  5, 磁盘分区
      fdisk /dev/vdb
      mkfs.xfs /dev/vdb1
      mkfs.xfs /dev/vdb2
      mount /dev/vdb1 /data0
      mount /dev/vdb2 /data1  

  6, 启动服务
      cd /root/fastdfs
      cp -fr restart.sh stop.sh/usr/bin/fdfs_* /usr/local/bin/
      systemctl daemon-reload
      service fdfs_storage restart  

  7, client 配置
      # cat client.conf |grep -v '#'|grep -v '^$'
      connect_timeout=30
      network_timeout=60
      base_path=/var/log/fastdfs
      tracker_server=192.168.0.1:22122 #修改tracker IP 地址,如果有多个,就写多个
      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=80  

  8, 验证服务
      1, 程序进程验证
      # netstat -tnpl
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address         Foreign Address         State       PID/Program name   
      tcp      0      0 192.168.6.49:22122      0.0.0.0:*               LISTEN      2232/fdfs_trackerd
      tcp      0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      641/rpcbind         
      tcp      0      0 0.0.0.0:22            0.0.0.0:*               LISTEN      992/sshd            
      tcp      0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1794/master         
      tcp6       0      0 :::111                  :::*                  LISTEN      641/rpcbind         
      tcp6       0      0 :::22                   :::*                  LISTEN      992/sshd            
      tcp6       0      0 ::1:25                  :::*                  LISTEN      1794/master         
      #
      2,Group 验证
      # fdfs_monitor/etc/fdfs/client.conf
       DEBUG - base_path=/var/log/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
      server_count=1, server_index=0
      tracker server is 192.168.0.1:22122
      group count: 3
      Group 1:
      group name = group1
      disk total space = 102349 MB
      disk free space = 102245 MB
      trunk free space = 0 MB
      storage server count = 1
      active server count = 1
      storage server port = 23000
      storage HTTP port = 8888
      store path count = 2
      subdir count per path = 256
      current write server index = 0
      current trunk file id = 0
            Storage 1:
                id = 192.168.0.2
                ip_addr = 192.168.0.2 (localhost)ACTIVE
                http domain =
                version = 5.07
                join time = 2015-09-02 11:05:12
                up time = 2015-09-02 11:20:55
                total storage = 102349 MB
                free storage = 102245 MB
                upload priority = 10
                store_path_count = 2
                subdir_count_per_path = 256
                storage_port = 23000
                storage_http_port = 8888
                current_write_path = 0
                source storage id =
                if_trunk_server = 0
                connection.alloc_count = 256
                connection.current_count = 0
                connection.max_count = 0
                total_upload_count = 0
                success_upload_count = 0
                total_append_count = 0
                success_append_count = 0
                total_modify_count = 0
                success_modify_count = 0
                total_truncate_count = 0
                success_truncate_count = 0
                total_set_meta_count = 0
                success_set_meta_count = 0
                total_delete_count = 0
                success_delete_count = 0
                total_download_count = 0
                success_download_count = 0
                total_get_meta_count = 0
                success_get_meta_count = 0
                total_create_link_count = 0
                success_create_link_count = 0
                total_delete_link_count = 0
                success_delete_link_count = 0
                total_upload_bytes = 0
                success_upload_bytes = 0
                total_append_bytes = 0
                success_append_bytes = 0
                total_modify_bytes = 0
                success_modify_bytes = 0
                stotal_download_bytes = 0
                success_download_bytes = 0
                total_sync_in_bytes = 0
                success_sync_in_bytes = 0
                total_sync_out_bytes = 0
                success_sync_out_bytes = 0
                total_file_open_count = 0
                success_file_open_count = 0
                total_file_read_count = 0
                success_file_read_count = 0
                total_file_write_count = 0
                success_file_write_count = 0
                last_heart_beat_time = 2015-09-02 11:31:40
                last_source_update = 1970-01-01 08:00:00
                last_sync_update = 1970-01-01 08:00:00
                last_synced_timestamp = 1970-01-01 08:00:00  




页: [1]
查看完整版本: FastDFS 分布式文件系统之二storage 服务部署