[root@martin mogilefs]# ss -lntup|grep 7001
tcp LISTEN 0 128 *:7001 *:* users:(("mogilefsd",41047,6))
部署Storage Nodes
yum -y install make gcc unzip perl perl-CPAN perl-YAML perl-Time-HiRes perl-DBD-MySQL
cpan
install MogileFS::Server #其中依赖自动解决
install MogileFS::Utils
#Sys::Syscall的0.25版本 数据副本只能保存一份 需要降级到0.23
[root@martin ~]# wget
[root@martin ~]# tar xf Sys-Syscall-0.23.tar.gz
[root@martin ~]# cd Sys-Syscall-0.23
[root@martin Sys-Syscall-0.23]# perl Makefile.PL
[root@martin Sys-Syscall-0.23]# make && make install
if /etc/mogilefs/ not exist
1 [root@lucia ~]# mkdir /etc/mogilefs/
if user mogilefs not exist
1 [root@lucia ~]# useradd -r mogilefs
[root@martin mogilefs]# vim /etc/mogilefs/mogstored.conf
maxconns = 10000 #最大并发连接数
httplisten = 0.0.0.0:7500 #http监听的地址
mgmtlisten = 0.0.0.0:7501 #管理接口监听地址
docroot =/mydata/mogilefs/data #用于存储的目录
[root@martin mogilefs]# mkdir /mydata/mogilefs/data -p
[root@martin mogilefs]# chown -R mogilefs.mogilefs /mydata/mogilefs/
启动脚本:
[root@martin mogilefs]# su - mogilefs -c "mogstored -c /etc/mogilefs/mogstored.conf --daemon"
[root@martin mogilefs]# ss -lntup |grep 7500
tcp LISTEN 0 128 *:7500 *:* users:(("mogstored",41190,4))
[root@martin mogilefs]# ss -lntup |grep 7501
tcp LISTEN 0 128 *:7501 *:* users:(("mogstored",41190,9))
Tracker Nodes
[root@martin mogilefs]# mogadm --trackers=192.168.1.222:7001 check
Checking trackers...
192.168.1.222:7001 ... OK
Checking hosts...
No devices found on tracker(s).
123456 [root@martin mogilefs]# mogadm check
Checking trackers...
127.0.0.1:7001 ... OK
Checking hosts...
No devices found on tracker(s).
12345678 [root@martin ~]# mogstats -h
Usage:
mogstats --db_dsn="DBI:mysql:mfs:host=mfshost" --db_user="mfs"
--db_pass="mfs" --verbose --stats="devices,files"
mogstats --stats="all"
mogstats [all options in ~/.mogilefs.conf]
valid stats: all, delete-queue, devices, domains, fids, files, general-queues, replication, replication-queue
为trackers添加mysql信息
[root@martin ~]# vim .mogilefs.conf #家目录下
--db_dsn="DBI:mysql:mogilefs:host=192.168.1.222"
--db_user="mogilefs"
--db_pass="222222"
--verbose
--stats="devices,files"
添加主机 node1 node2:
[root@martin ~]# mogadm --trackers=192.168.1.222:7001 host add node1 --ip=192.168.1.222 --status=alive
[root@martin ~]# mogadm --trackers=192.168.1.222:7001 host add node2 --ip=192.168.1.223 --status=alive
查看添加主机:
[root@martin ~]# mogadm --trackers=192.168.1.222:7001 host list
node1 [1]: alive
IP: 192.168.1.222:7500
node2 [2]: alive
IP: 192.168.1.223:7500
为节点添加设备 列出设备:
[root@martin ~]# mogadm --trackers=192.168.1.222:7001 device add node1 001 #001 设备id 不可重用
[root@martin ~]# mogadm --trackers=192.168.1.222:7001 device add node2 002
[root@martin ~]# mogadm --trackers=192.168.1.222:7001 device list
node1 [1]: alive
used(G) free(G) total(G) weight(%)
dev1: alive 0.000 0.000 0.000 100
node2 [2]: alive
used(G) free(G) total(G) weight(%)
dev2: alive 0.000 0.000 0.000 100