环境说明
硬件环境:
vm *2
软件环境:
Centos 6.5
glusterfs-3.6.0.29-2.el6.x86_64
samba-glusterfs-3.6.23-12.el6.x86_64
samba-3.6.23-12.el6.x86_64
安装配置
1.更新epel源
#wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm
2.安装samba-glusterfs,安装该包后,系统会自动安装好samba以及glusterfs
#yum -y install samba-glusterfs
Glusterfs配置
1.添加glusterfs服务器
#gluster peer probe 10.10.200.178
查看glusterfs cluster状态
[root@glusterfs-node-1 samba]# gluster peer status
Number of Peers: 1
Hostname: 10.10.200.178
Uuid: 1d1cfe87-6416-468b-b268-cf266596bce9
State: Peer in Cluster (Connected)
2.创建volume
[root@glusterfs-node-2 ~]# gluster volume create samba-vol1 replica 2 10.10.200.178:/buck1 10.10.200.177:/buck1
启动该volume
#gluster volume start samba-vol1
查看volume状态
[root@glusterfs-node-2 ~]# gluster volume status
Status of volume: samba-vol1
Gluster process Port Online Pid
------------------------------------------------------------------------------
Brick 10.10.200.178:/buck1 49152 Y 6174
Brick 10.10.200.177:/buck1 49152 Y 2221
NFS Server on localhost 2049 Y 13690
Self-heal Daemon on localhost N/A Y 13697
NFS Server on 10.10.200.177 N/A N N/A
Self-heal Daemon on 10.10.200.177 N/A Y 4146
Task Status of Volume samba-vol1
------------------------------------------------------------------------------
There are no active volume tasks
Samba配置
1.配置添加[data]字段到smb.conf文件中,并通过smbpasswd设置root用户的密码
[data]
comment = For samba export of volume test
vfs objects = glusterfs
glusterfs:volfile_server = localhost
glusterfs:volume = samba-vol1
path = /
workgroup = root
netbios name = root
browseable = yes
writeable = yes
2.测试smb.conf配置文件
[root@glusterfs-node-1 samba]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[data]"
Global parameter workgroup found in service section!
Global parameter netbios name found in service section!
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
password server = 127.0.0.1
log file = /var/log/samba/log.%m
max log size = 50
idmap config * : backend = tdb
cups options = raw
[data]
comment = For samba export of volume test
path = /
read only = No
vfs objects = glusterfs
glusterfs:volume = samba-vol1
glusterfs:volfile_server = localhost
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
print ok = Yes
browseable = No
3.启动smb
#/etc/init.d/smb start
Samba 客户端配置
[root@samba-180 /]# mount -t cifs //10.10.200.177/data /mnt -o username=root,password=hgctech
[root@samba-180 /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 7219704 2370056 4482904 35% /
tmpfs 961216 0 961216 0% /dev/shm
/dev/sda1 1032088 62612 917048 7% /boot
//10.10.200.177/data 524032000 32980 523999020 1% /mnt
ok~通过上述配置,完成了samba通过glusterfs-api调用glusterfs的全部配置过程!