fastdfs--Installation Chapter

Source: Internet
Author: User

Prior to understanding the principle of Fastdfs, then familiar with the installation process, prepared three machines, a simulation client, an analog storage, a simulation tracker.

Three machines are debian6, the system is minimal installation, first install the basic compilation environment:

Apt-get Install build-essential Php5-dev Libevent-dev

Download Fastdfs Source Package:

wget http://fastdfs.googlecode.com/files/FastDFS_v3.05.tar.gz

To start the installation:

Tar zxvf fastdfs_v3.05.tar.gzcd fastdfs/./make.sh./make.sh Install

After the installation is complete, the FASTDFS default profile is placed under the/etc/fdfs directory, containing client.conf http.conf mime.types storage.conf Tracker.conf five files, the startup of the FASTDFS process is differentiated by the loaded configuration file. The three configuration files are included in the source package.

   tracker.conf Profile Analysis:

#配置tracker. conf This configuration file is in effect because the configuration file needs to be specified when the FASTDFS server process is started, so the secondary configuration file needs to take effect. False is valid, and true is masked. disabled=false  #程序的监听地址, if not set then listen to all addresses bind_addr=  #tracker监听的端口port =22122  #链接超时设定connect_timeout = 30  #tracker在通过网络发送接收数据的超时时间network_timeout =60  #数据和日志的存放地点base_path =/opt/fdfs  #服务所支持的最大链接数max_ connections=256  #工作线程数一般为cpu个数work_threads =4  #在存储文件时选择group的策略, 0: Rotation strategy  1: Specify a group  2: Load Balancing, Select the groupstore_lookup=2  #如果上面的store_lookup选择了1 with the largest free space, you need to specify a group#store_group=group2 # Which storage in group is the master storage, when a file is uploaded to the main storage, the machine synchronizes files to other storage within the group, 0: Rotation policy  1: Sort by IP address, first  2: Sort by priority, first store_server=0  #选择那个storage作为主下载服务器, 0: Rotation policy  1: main upload storage as primary download server download_server=0 # Select which file to upload to storage (Directory/mount point), storage can have more than one base path 0: Rotation policy  2: Load Balancing, choose the largest free space store_path=0  #系统预留空间, when the remaining space of any storage in a group is less than the defined value, the entire group cannot upload the file reserved_storage_space = 4gb  #日志信息级别log_ level=info  #进程以那个用户/user group run, do not specify the default is the current user Run_by_group=run_by_user=  #允许那些机器连接tracker默认是所有机器allow_hosts =*  #设置日志信息刷新到disk的频率, default 10ssync_log_buff_interval =  10  #检测storage服务器的间隔时间, storage regularly actively send a heartbeat to tracker, if the signal is confiscated at a specified time, tracker man storage fault, the default 120scheck_active_ interval = 120  #线程栈的大小, Min 64kthread_stack_size = 64kb  #storage的ip改变后服务端是否自动调整, Storage automatically adjusts the storage_ip_changed_auto_adjust = true  #storage之间同步文件的最大延迟 when the process restarts, default 1 days storage_sync_ file_max_delay = 86400  #同步一个文件所花费的最大时间storage_sync_file_max_time  = 300 # Whether to store multiple small files with a trunk file use_trunk_file = false  #最小的solt大小, should be less than 4KB, the default 256bytesslot_min_size =  256  #最大的solt大小, if the uploaded file is less than the default value, the upload file is placed in the trunk file slot_max_size = 16mb  #trunk文件的默认大小, should be greater than 4mtrunk_file_size = 64mb  #http服务是否生效, http.disabled=false  #http服务端口http is not in effect by default. Server_ port=8080  #检测storage上http服务的时间间隔, <=0 indicates that http.check_alive_interval=30  #检测storage上http服务时所用请求的类型 is not detected, TCP only detects if it can connect, HTTP must return 200http.check_alive_type=tcp  #通过url检测storage  http Service status http.check_alive_uri=/status.html  #if  need find  content type from file extension namehttp.need_find_content_type=true # Include additional settings in HTTP with include # #include  http.conf

Start the tracker process

Fdfs_trackerd/etc/fdfs/tracker.conf

Detection status

Netstat-tupln|grep tracker# can be seen as follows: TCP 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 18559/fdfs_trackerd

storage.conf Configuration File Analysis:

#同tracker .confdisabled=false  #这个storage服务器属于那个groupgroup_name =group1  #同tracker. confbind_addr= # If the address is bound when connecting to other servers, this parameter is valid client_bind=true  #同tracker bind_addr configuration. Confport=23000connect_timeout=30network_ timeout=60  #主动向tracker发送心跳检测的时间间隔heart_beat_interval =30  #主动向tracker发送磁盘使用率的时间间隔stat_report_interval = 60  #同tracker .confbase_path=/opt/fdfsmax_connections=256  #接收/Send data buff size, must be greater than 8kbbuff_size =  256KB  #同tracker .confwork_threads=4  #磁盘IO是否读写分离disk_rw_separated  = true # Whether to read and write directly to the file, disk_rw_direct = false  #混合读写时的读写线程数disk_reader_threads  = 1disk_writer_ off by default threads = 1  #同步文件时如果binlog没有要同步的文件, the delay is a few milliseconds after the re-read, 0 means no delay sync_wait_msec=50 # How many milliseconds to synchronize the next file after synchronizing a file, 0 means no rest. direct Sync sync_interval=0  #表示这段时间内同步文件sync_start_time =00:00sync_end_time=23:59   #同步完多少文件后写mark标记write_mark_file_freq =500  #storage在存储文件时支持多路径, only one store_path_count=1 # is set by default Configure multiple Store_path paths, starting with 0, if Store_path0 does not exist, the Base_path must exist store_path0=/opt/fdfs#store_path1=/opt/fastdfs2  #subdir_count   * subdir_count directory will be in Store_ Path, with two-level storage subdir_count_per_path=256  #设置tracker_servertracker_server =x.x.x.x:22122 # Same tracker.conflog_level=inforun_by_group=run_by_user=allow_hosts=*  #文件在数据目录下的存放策略, 0: Rotation  1: Random file_ distribute_path_mode=0  #当问及是轮训存放时, the number of files that can be stored in a directory file_distribute_rotate_count=100  #写入多少字节后就开始同步, 0 indicates unsynchronized fsync_after_written_bytes=0  #刷新日志信息到disk的间隔sync_log_buff_interval =10 # Synchronize the status information of the storage to the disk interval sync_stat_file_interval=300  #线程栈大小thread_stack_size =512kb  #设置文件上传服务器的优先级, The lower the value, the higher the upload_priority=10  #是否检测文件重复存在, 1: Detect  0: check_file_duplicate=0  is not detected #当check_file_ Duplicate set to 1 o'clock, the secondary value must be set key_namespace=fastdfs  #与FastDHT建立连接的方式  0: Short connection  1: Long connection keep_alive=0 # With Tracker.confhttp.disabled=falsehttp.domain_name=http.server_port=8888http.trunk_size=256kbhttp.need_find_ content_type=true# #include  http.conf

Start the storage process

Fdfs_storaged/etc/fdfs/storage.conf

Detection status

NETSTAT-TUPLN | grep storage# results as follows: TCP 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 17138/fdfs_storaged

client.conf Configuration File Analysis:

#同tracker. confconnect_timeout=30network_timeout=60base_path=/opt/fdfstracker_server=x.x.x.x:22122log_level= infohttp.tracker_server_port=8080

To test the upload file:

Fdfs_upload_file/etc/fdfs/client.conf client.conf# returns the following string group1/m00/00/00/cgegflaqafw4henaaaaco8wrbse16.conf

You can see the file in the 00/00 directory under the storage data directory, the file name is cgegflaqafw4henaaaaco8wrbse16.conf

fastdfs--Installation Chapter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.