分布式存储系统FastDFS手册之二安装配置

转自互联网

==================

3 安装配置
3.1 安装
FastDFS的安装步骤如下:
(1)系统必要包的准备,如gcc等;
(2)下载FastDFS源代码并解压;
tar xzf FastDFS_v1.x.tar.gz
例如:
tar xzf FastDFS_v1.11.tar.gz
(3)进入FastDFS目录
   cd FastDFS
(4)编译
   ./make.sh
(5)安装
   ./make.sh install
(6)修改tracker和storage服务器配置文件
(7)运行服务器
   运行tracker服务器:/usr/local/bin/fdfs_trackerd <tracker_conf_filename>
   实例:/usr/local/bin/fdfs_trackerd /usr/local/bin/tracker.conf
   运行storage服务器:/usr/local/bin/fdfs_storaged <storage_conf_filename>
   实例与上面的类似。
(8)测试安装
   运行客户端程序:/usr/local/bin/fdfs_test <storage_conf_filename> <operation>
   实例:/usr/local/bin/fdfs_test conf/storage.conf upload /usr/include/stdlib.h
   上传后返回结果是:组名和文件名。
文件名格式:/M00/00/00/awGowEqNSzYAAAAAAAAADh8DEKc46.txt
“/M00/”对应第一个路径,它是一个逻辑路径。
“00/00”是该路径下的文件夹结构。
“awGowEqNSzYAAAAAAAAADh8DEKc46.txt”是文件名。
(9)运行测试监视程序
   命令如下:/usr/local/bin/fdfs_monitor <storage_conf_filename>
运行ps axu | grep "fdfs",如果看到两个进程都在运行了,则表明启动成功了。如果缺少某一个,可以去查看log,看出了什么问题。log是存放在指定的 base_path下的logs的文件夹下,有两个tracker.log和storage.log,分别记录两个daemon的日志。
3.2 tracker服务器配置

disabled=false
bind_addr=
port=22122
network_timeout=20
base_path=/home/yuqing/FastDFS
max_connections=256

选择上传组的方法:
#0: round robin 轮询方式
#1: specify group 指定组
#2: load balance 平衡加载
store_lookup=0

#当 store_lookup 设为1(指定组)时,必须设定组名
store_group=group2

选择存储服务器的方法
#0: round robin
#1: the first server order by ip address
#recommand use the first server to upload file
store_server=1

#保留存储空间为其他的系统或者应用
#如果该组中任一服务器存储空间小于或等于 reserved_storage_space,就不能传文件至#该组,字节单位可以采用如下的:
### G or g for gigabyte(GB)
### M or m for megabyte(MB)
### K or k for kilobyte(KB)
### no unit for byte(B)
reserved_storage_space = 4GB

#标准的系统日志级别,大小写不敏感,可用值如下:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info


#可使用该程序的用户组名,如果为空则默认为当前组
run_by_group=

#可使用该程序的用户名,如果为空则默认为当前用户
run_by_user=


# 允许的主机,可以有多个,主机名或者IP地址
# "*"代表匹配所有的IP地址,也可以使用IP段如10.0.1.[1-15,20]或者#[01-08,20-25].domain.com, #例如:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*

3.3 storage服务器配置
相同group的配置文件内容要一样
disabled=false
group_name=group1#组名不能有下划线,不能太长
bind_addr=
port=23000
network_timeout=20
heart_beat_interval=30
stat_report_interval=600
base_path=/home/yuqing/FastDFS
sync_wait_msec=200
max_connections=256

tracker_server=10.62.164.83:22122
tracker_server=10.62.164.84:22122

#标准的系统日志级别,大小写不敏感,可用值如下:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info

#可使用该程序的用户组名,如果为空则默认为当前组
run_by_group=

#可使用该程序的用户名,如果为空则默认为当前用户
run_by_user=

#允许的主机,可以有多个,主机名或者IP地址
# "*"代表匹配所有的IP地址,也可以使用IP段如10.0.1.[1-15,20]或者[01-08,20-25].domain.com, #例如:
#allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*

3.4.2 tracker服务器项
中文说明
项名
类型
默认值
是否必须

端口
port
int
22000
N

存储节点查询方式
store_lookup
int
0
N

存储组
store_group
string

N

存储服务器
store_server
int
1
N

保留空间大小
reserved_storage_space
string
1GB
N


       说明:

       store_lookup值可以是:

0: 轮询(default)
1: 指定组
2: 负载加载(从V1.1开始)
store_group 是存储文件的组。当store_lookup设置为1时(即为指定组),store_group 必段设置为指定的组名。
reserved_storage_space 是保留给其他一些应用或者系统的空间。如果该组中任意一个存储服务器的可用的空间小于等于该值时,就不能再往该组上传了。字节单位是以下中的一个:
G or g for gigabyte(GB)
M or m for megabyte(MB)
K or k for kilobyte(KB)
no unit for byte(B)
3.4.3 storage服务器项
       中文说明
项名
类型
默认值
是否必须

组名
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


说明:

跟踪器可以有多个,而且跟踪器的格式是:“host:port”,host可以是主机名或者IP地址。
同一组的存储Server配置保持一致,包括端口、store_path_count。

猜你喜欢

转载自soartju.iteye.com/blog/800583