Skip to content

Commit

Permalink
remove tracker_global.c extern keyword to tracker_global.h
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqing committed Jun 23, 2014
1 parent abe9d0c commit 5128a78
Show file tree
Hide file tree
Showing 194 changed files with 88,280 additions and 3 deletions.
675 changes: 675 additions & 0 deletions COPYING-3_0.txt

Large diffs are not rendered by default.

640 changes: 640 additions & 0 deletions HISTORY

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
Copy right 2009 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 for more detail.
English language: http://english.csource.org/
Chinese language: http://www.csource.org/

#step 1. download FastDFS source package and unpack it,
tar xzf FastDFS_v5.x.tar.gz
#for example:
tar xzf FastDFS_v5.01.tar.gz

#step 2. enter the FastDFS dir
cd FastDFS

#step 3. execute:
./make.sh

#step 4. make install
./make.sh install

#step 5. edit/modify the config file of tracker and storage

#step 6. run server programs
#start the tracker server:
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
#in Linux, you can start fdfs_trackerd as a service:
/sbin/service fdfs_trackerd start

#start the storage server:
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf restart
#in Linux, you can start fdfs_storaged as a service:
/sbin/service fdfs_storaged start

#step 7. run test program
#run the client test program:
/usr/local/bin/fdfs_test <client_conf_filename> <operation>
/usr/local/bin/fdfs_test1 <client_conf_filename> <operation>
#for example, upload a file:
/usr/local/bin/fdfs_test conf/client.conf upload /usr/include/stdlib.h

#step 8. run monitor program
#run the monitor program:
/usr/local/bin/fdfs_monitor <client_conf_filename>


tracker server config file sample please see conf/tracker.conf

storage server config file sample please see conf/storage.conf

client config file sample please see conf/client.conf


Item detail
1. server common items
---------------------------------------------------
| item name | type | default | Must |
---------------------------------------------------
| base_path | string | | Y |
---------------------------------------------------
| disabled | boolean| false | N |
---------------------------------------------------
| bind_addr | string | | N |
---------------------------------------------------
| network_timeout | int | 30(s) | N |
---------------------------------------------------
| max_connections | int | 256 | N |
---------------------------------------------------
| log_level | string | info | N |
---------------------------------------------------
| run_by_group | string | | N |
---------------------------------------------------
| run_by_user | string | | N |
---------------------------------------------------
| allow_hosts | string | * | N |
---------------------------------------------------
| sync_log_buff_interval| int | 10(s) | N |
---------------------------------------------------
| thread_stack_size | string | 1M | N |
---------------------------------------------------
memo:
* base_path is the base path of sub dirs:
data and logs. base_path must exist and it's sub dirs will
be automatically created if not exist.
$base_path/data: store data files
$base_path/logs: store log files
* log_level is the standard log level as syslog, case insensitive
# emerg: for emergency
# alert
# crit: for critical
# error
# warn: for warning
# notice
# info
# debug
* allow_hosts can ocur more than once, host can be hostname or ip address,
"*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20]
or host[01-08,20-25].domain.com, for example:
allow_hosts=10.0.1.[1-15,20]
allow_hosts=host[01-08,20-25].domain.com

2. tracker server items
---------------------------------------------------
| item name | type | default | Must |
---------------------------------------------------
| port | int | 22000 | N |
---------------------------------------------------
| store_lookup | int | 0 | N |
---------------------------------------------------
| store_group | string | | N |
---------------------------------------------------
| store_server | int | 0 | N |
---------------------------------------------------
| store_path | int | 0 | N |
---------------------------------------------------
| download_server | int | 0 | N |
---------------------------------------------------
| reserved_storage_space| string | 1GB | N |
---------------------------------------------------

memo:
* the value of store_lookup is:
0: round robin (default)
1: specify group
2: load balance (supported since V1.1)
* store_group is the name of group to store files.
when store_lookup set to 1(specify group),
store_group must be set to a specified group name.
* reserved_storage_space is the reserved storage space for system
or other applications. if the free(available) space of any stoarge
server in a group <= reserved_storage_space, no file can be uploaded
to this group (since V1.1)
bytes unit can be one of follows:
# G or g for gigabyte(GB)
# M or m for megabyte(MB)
# K or k for kilobyte(KB)
# no unit for byte(B)

3. storage server items
-------------------------------------------------
| item name | type | default | Must |
-------------------------------------------------
| group_name | string | | Y |
-------------------------------------------------
| tracker_server | string | | Y |
-------------------------------------------------
| port | int | 23000 | N |
-------------------------------------------------
| heart_beat_interval | int | 30(s) | N |
-------------------------------------------------
| stat_report_interval| int | 300(s) | N |
-------------------------------------------------
| sync_wait_msec | int | 100(ms) | N |
-------------------------------------------------
| sync_interval | int | 0(ms) | N |
-------------------------------------------------
| sync_start_time | string | 00:00 | N |
-------------------------------------------------
| sync_end_time | string | 23:59 | N |
-------------------------------------------------
| store_path_count | int | 1 | N |
-------------------------------------------------
| store_path0 | string |base_path| N |
-------------------------------------------------
| store_path# | string | | N |
-------------------------------------------------
|subdir_count_per_path| int | 256 | N |
-------------------------------------------------
|check_file_duplicate | boolean| 0 | N |
-------------------------------------------------
| key_namespace | string | | N |
-------------------------------------------------
| keep_alive | boolean| 0 | N |
-------------------------------------------------
| sync_binlog_buff_interval| int | 60s | N |
-------------------------------------------------

memo:
* tracker_server can ocur more than once, and tracker_server format is
"host:port", host can be hostname or ip address.
* store_path#, # for digital, based 0
* check_file_duplicate: when set to true, must work with FastDHT server,
more detail please see INSTALL of FastDHT. FastDHT download page:
http://code.google.com/p/fastdht/downloads/list
* key_namespace: FastDHT key namespace, can't be empty when
check_file_duplicate is true. the key namespace should short as possible

46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
fastdfs
=======
Copyright (C) 2008 Happy Fish / YuQing

FastDFS is an open source high performance distributed file system (DFS). It's major functions include: file storing, file syncing and file accessing, and design for high capacity and load balance.
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 for more detail.
English language: http://english.csource.org/
Chinese language: http://www.csource.org/


FastDFS is an open source high performance distributed file system. It's major
functions include: file storing, file syncing and file accessing (file uploading
and file downloading), and it can resolve the high capacity and load balancing
problem. FastDFS should meet the requirement of the website whose service based
on files such as photo sharing site and video sharing site.

FastDFS has two roles: tracker and storage. The tracker takes charge of
scheduling and load balancing for file access. The storage store files and it's
function is file management including: file storing, file syncing, providing file
access interface. It also manage the meta data which are attributes representing
as key value pair of the file. For example: width=1024, the key is "width" and
the value is "1024".

The tracker and storage contain one or more servers. The servers in the tracker
or storage cluster can be added to or removed from the cluster by any time without
affecting the online services. The servers in the tracker cluster are peer to peer.

The storarge servers organizing by the file volume/group to obtain high capacity.
The storage system contains one or more volumes whose files are independent among
these volumes. The capacity of the whole storage system equals to the sum of all
volumes' capacity. A file volume contains one or more storage servers whose files
are same among these servers. The servers in a file volume backup each other,
and all these servers are load balancing. When adding a storage server to a
volume, files already existing in this volume are replicated to this new server
automatically, and when this replication done, system will switch this server
online to providing storage services.

When the whole storage capacity is insufficiency, you can add one or more
volumes to expand the storage capacity. To do this, you need to add one or
more storage servers.

The identification of a file is composed of two parts: the volume name and
the file name.

Client test code use client library please refer to the directory: client/test.
115 changes: 115 additions & 0 deletions client/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
.SUFFIXES: .c .o .lo

COMPILE = $(CC) $(CFLAGS)
ENABLE_STATIC_LIB = $(ENABLE_STATIC_LIB)
ENABLE_SHARED_LIB = $(ENABLE_SHARED_LIB)
INC_PATH = -I../common -I../tracker -I/usr/local/include
LIB_PATH = $(LIBS)
TARGET_PATH = $(TARGET_PREFIX)/bin
TARGET_LIB = $(TARGET_PREFIX)/lib
TARGET_INC = $(TARGET_PREFIX)/include
CONFIG_PATH = $(TARGET_CONF_PATH)

FAST_STATIC_OBJS = ../common/hash.o ../common/chain.o \
../common/shared_func.o ../common/ini_file_reader.o \
../common/logger.o ../common/sockopt.o \
../common/base64.o ../common/sched_thread.o \
../common/http_func.o ../common/md5.o \
../common/pthread_func.o ../common/local_ip_func.o \
../common/avl_tree.o ../common/connection_pool.o

FDFS_STATIC_OBJS = ../common/fdfs_global.o ../common/fdfs_http_shared.o \
../common/mime_file_parser.o ../tracker/tracker_proto.o \
../tracker/fdfs_shared_func.o \
../storage/trunk_mgr/trunk_shared.o \
tracker_client.o client_func.o \
client_global.o storage_client.o

STATIC_OBJS = $(FAST_STATIC_OBJS) $(FDFS_STATIC_OBJS)

FAST_SHARED_OBJS = ../common/hash.lo ../common/chain.lo \
../common/shared_func.lo ../common/ini_file_reader.lo \
../common/logger.lo ../common/sockopt.lo \
../common/base64.lo ../common/sched_thread.lo \
../common/http_func.lo ../common/md5.lo \
../common/pthread_func.lo ../common/local_ip_func.lo \
../common/avl_tree.lo ../common/connection_pool.lo

FDFS_SHARED_OBJS = ../common/fdfs_global.lo ../common/fdfs_http_shared.lo \
../common/mime_file_parser.lo ../tracker/tracker_proto.lo \
../tracker/fdfs_shared_func.lo \
../storage/trunk_mgr/trunk_shared.lo \
tracker_client.lo client_func.lo \
client_global.lo storage_client.lo

FAST_HEADER_FILES = ../common/common_define.h ../common/hash.h \
../common/chain.h ../common/logger.h \
../common/base64.h ../common/shared_func.h \
../common/pthread_func.h ../common/ini_file_reader.h \
../common/sockopt.h ../common/sched_thread.h \
../common/http_func.h ../common/md5.h ../common/_os_bits.h \
../common/local_ip_func.h ../common/avl_tree.h \
../common/connection_pool.h

FDFS_HEADER_FILES = ../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

ALL_OBJS = $(STATIC_OBJS) $(FAST_SHARED_OBJS) $(FDFS_SHARED_OBJS)

ALL_PRGS = 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

STATIC_LIBS = libfastcommon.a libfdfsclient.a

SHARED_LIBS = libfastcommon.so.1 libfdfsclient.so.1

ALL_LIBS = $(STATIC_LIBS) $(SHARED_LIBS)

all: $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS)
libfastcommon.so.1:
$(COMPILE) -o $@ $< -shared $(FAST_SHARED_OBJS) $(LIB_PATH)
ln -fs libfastcommon.so.1 libfastcommon.so
libfdfsclient.so.1:
$(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH) -L. -lfastcommon
ln -fs libfdfsclient.so.1 libfdfsclient.so
libfastcommon.a:
ar cru $@ $< $(FAST_STATIC_OBJS)
libfdfsclient.a:
ar cru $@ $< $(FDFS_STATIC_OBJS)
.o:
$(COMPILE) -o $@ $< $(STATIC_OBJS) $(LIB_PATH) $(INC_PATH)
.c:
$(COMPILE) -o $@ $< $(STATIC_OBJS) $(LIB_PATH) $(INC_PATH)
.c.o:
$(COMPILE) -c -o $@ $< $(INC_PATH)
.c.lo:
$(COMPILE) -c -fPIC -o $@ $< $(INC_PATH)
install:
mkdir -p $(TARGET_PATH)
mkdir -p $(CONFIG_PATH)
mkdir -p $(TARGET_LIB)
cp -f $(ALL_PRGS) $(TARGET_PATH)
if [ $(ENABLE_STATIC_LIB) -eq 1 ]; then cp -f $(STATIC_LIBS) $(TARGET_LIB); fi
if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then cp -f $(SHARED_LIBS) $(TARGET_LIB); fi
if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then ln -fs $(TARGET_LIB)/libfastcommon.so.1 $(TARGET_LIB)/libfastcommon.so; fi
if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then ln -fs $(TARGET_LIB)/libfdfsclient.so.1 $(TARGET_LIB)/libfdfsclient.so; fi

if [ ! -f $(CONFIG_PATH)/client.conf ]; then cp -f ../conf/client.conf ../conf/http.conf $(CONFIG_PATH); fi

mkdir -p $(TARGET_INC)
mkdir -p $(TARGET_INC)/fastcommon
mkdir -p $(TARGET_INC)/fastdfs
cp -f $(FAST_HEADER_FILES) $(TARGET_INC)/fastcommon
cp -f $(FDFS_HEADER_FILES) $(TARGET_INC)/fastdfs

if [ $(ENABLE_SHARED_LIB) -eq 1 -a $(TARGET_LIB) = "/usr/local/lib" ]; then sh ./fdfs_link_library.sh; fi
clean:
rm -f $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS) libfastcommon.so libfdfsclient.so

Loading

0 comments on commit 5128a78

Please sign in to comment.