使用GlusterFS和Samba在Debian Squeeze上设置独立存储服务器
版本1.0
作者:Piotr Opara <piotr [dot] opara [at] gmail [dot] com>
本教程将介绍如何使用GlusterFS和SAMBA在Debian 6.0上设置独立存储服务器,以及自定义脚本和设置,使生活更轻松;)
我不会保证这将为您工作!
我不会保证你会明白我的英文不好;
1初步说明
教程基于Falko Timme文章。
Linux发行版:
我使用Debian 6.0(Squeeze)分发。 Debian的安装非常简单,所以我不会解释一下。 请记住,您需要具有专用于数据的磁盘或分区。
网络:
在本教程中,我使用三个系统,两个存储节点和一个Windows客户端:
- node1.example.com:IP地址192.168.20.106
- node2.example.com:IP地址192.168.20.107
- MS Windows客户端:IP地址192.168.20.7
2准备节点
我们必须确保两个节点是最新的,并且已经安装了我们喜欢或需要的SSH和其他软件。
node1 / node2
apt-get update
apt-get install mc ssh
我们需要确保,两个节点都应该能够解析其他系统的主机名:
node1 / node2
vi /etc/hosts
127.0.0.1 localhost192.168.20.106 node1.example.com node1192.168.20.107 node2.example.com node2
检查所有设置
node1
ping -c 1 node2
PING node2.example.com (192.168.20.107) 56(84) bytes of data.
64 bytes from node2.example.com (192.168.20.107): icmp_req=1 ttl=64 time=0.818 ms
— node2.example.com ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.818/0.818/0.818/0.000 ms
node2
ping -c 1 node1
PING node1.example.com (192.168.20.106) 56(84) bytes of data.
64 bytes from node1.example.com (192.168.20.106): icmp_req=1 ttl=64 time=0.802 ms
— node1.example.com ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.802/0.802/0.802/0.000 ms
3设置数据磁盘
在两个节点上我们都有独占磁盘,我们需要设置它们:
node1 / node2
fdisk /dev/sdb
Command (m for help): <– n
Command action
e extended
p primary partition (1-4) <– p
Partition number (1-4, default 1): <– 1
First sector (1-1305, default 1): <– ENTER
Using default value 1Last sector, +sectors or +size{K,M,G} (1-1305, default 1305): <– ENTER
Using default value 1305
Command (m for help): <– t
Selected partition 1
Hex code (type L to list codes): <– 83
Command (m for help): <– w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
现在跑
fdisk -l
并且您应该在两个节点的输出中找到/ dev / sdb1 :
设备启动开始结束块Id系统
/ dev / sdb1 1 1305 10482381 83 Linux
现在我们在/ dev / sdb1上创建一个文件系统,并将/ dev / sdb1挂载到/ data目录
node1 / node2
mkfs.ext3 /dev/sdb1
mkdir /data/
vi /etc/fstab
...
/dev/sdb1 /data ext3 defaults 0 0
...
现在跑
mount -a
之后,你应该在这个输出中找到份额
df -h
/dev/sdb1 9,9G 151M 9,2G 2% /data
mount
/dev/sdb1 on /data type ext3 (rw)