mogilefs部署

mogilefs实验环境:
1.需要两台tracker主机
2.一台mariadb
3.nginx_mogilefs_module模块要编译安装

在tracker主机:

1.上下载rpm包

mkdir mogilefs/

cd mogilefs

lftp 172.16.0.1

get

MogileFS-Server-2.46-2.el7.centos.noarch.rpm

MogileFS-Server-mogilefsd-2.46-2.el7.centos.noarch.rpm

MogileFS-Server-mogstored-2.46-2.el7.centos.noarch.rpm

MogileFS-Utils-2.19-1.el7.centos.noarch.rpm

perl-Danga-Socket-1.61-1.el6.rf.noarch.rpm

perl-MogileFS-Client-1.14-1.el7.centos.noarch.rpm

perl-Perlbal-1.78-1.el6.noarch.rpm

scp *.rpm 172.16.42.8:/root/mogilefs/

2.安装依赖关系,安装包

yum install perl-Net-Netmask perl-IO-stringy perl-Sys-Syslog perl-IO-AIO -y

yum install *.rpm -y

3.初始化数据库

mogdbsetup –dbhost=172.16.42.9 –dbrootuser=root –dbrootpass=mageedu –dbuser=moguser –dbpass=mageedu –dbname=mogilefs –yes

4.配置mogilefsd

vim /etc/mogilefs/mogilefsd.conf

db_dsn = DBI:mysql:mogilefs:host=172.16.42.9

db_user = moguser

db_pass = mageedu

listen = 0.0.0.0:7001

5.配置mogstored

vim /etc/mogilefs/mogstored.conf

maxconns = 10000 #最大连接数

httplisten = 0.0.0.0:7500 #http监听地址

mgmtlisten = 0.0.0.0:7501 #mgm监听地址

docroot = /mogdata #数据存放位置

6.将文件同步至另一个节点

scp /etc/mogilefs/* 172.16.42.8:/etc/mogilefs/

7.创建挂载点,并将磁盘挂载至此目录

mkdir /mogdata/dev1 -pv

chown -R mogilefs.mogilefs /mogdata/

8.启动服务

systemctl start mogilefsd

systemctl start mogilefsd

9.添加节点

mogadm –trackers=172.16.42.2:7001 host add 172.16.42.2 –ip=172.16.42.2 –status=alive

mogadm –trackers=172.16.42.2:7001 host add 172.16.42.8 –ip=172.16.42.8 –status=alive

10.添加设备

mogadm device add 172.16.42.2 1

mogadm device add 172.16.42.8 2

11.创建domain

mogadm –trackers=172.16.10.123:7001 domain add files

mogadm –trackers=172.16.10.123:7001 domain add html

mogadm –trackers=172.16.10.123:7001 domain add images

12.上传测试

mogupload –trackers=172.16.42.2:7001 –domain=html –key=’fstab.html’ –file=’/etc/fstab’

mogupload –trackers=172.16.42.2:7001 –domain=images –key=’test.jpg’ –file=’/root/test.jpg’

13.获取数据

mogfileinfo –trackers=172.16.42.2 –domain=files –key=’/fstab.txt’

在另个tracker主机:

mkdir /mogdata/dev2 -pv

chown -R mogilefs.mogilefs /mogdata/

mariadb主机上:

yum install mariadb-server -y

1.编辑配置文件

vim /etc/my.cnf.d/server.cnf

[mysqld]

skip_name_resolve=1

innodb_file_per_table = 1

systemctl start mariadb

2.授权

mysql

GRANT ALL ON *.* TO ‘root’@’172.16.42.%’ IDENTIFIED BY ‘mageedu’;

GRANT ALL ON mogilefs.* TO ‘moguser’@’172.16.42.%’ IDENTIFIED BY ‘mageedu’;

CREATE DATABASE mogilefs;

FLUSH PRIVILEGES;

quit

nginx模块编译安装:

1.下载nginx模块

wget http://www.grid.net.ru/nginx/download/nginx_mogilefs_module-1.0.4.tar.gz

tar xvf nginx_mogilefs_module-1.0.4.tar.gz

2.安装开发环境

yum groupinstall “Development Tools” “Server Platform Development” -y

yum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel

useradd -r nginx

tar xvf nginx-1.10.3.tar.gz

cd nginx-1.10.3

3.编译安装nginx

./configure \

> –prefix=/usr/local/nginx \

> –sbin-path=/usr/sbin/nginx \

> –conf-path=/etc/nginx/nginx.conf \

> –error-log-path=/var/log/nginx/error.log \

> –http-log-path=/var/log/nginx/access.log \

> –pid-path=/var/run/nginx/nginx.pid \

> –lock-path=/var/lock/nginx.lock \

> –user=nginx \

> –group=nginx \

> –with-http_ssl_module \

> –with-http_flv_module \

> –with-http_stub_status_module \

> –with-http_gzip_static_module \

> –http-client-body-temp-path=/usr/local/nginx/client/ \

> –http-proxy-temp-path=/usr/local/nginx/proxy/ \

> –http-fastcgi-temp-path=/usr/local/nginx/fcgi/ \

> –http-uwsgi-temp-path=/usr/local/nginx/uwsgi \

> –http-scgi-temp-path=/usr/local/nginx/scgi \

> –with-pcre \

> –with-debug \

> –add-module=../nginx_mogilefs_module-1.0.4

vim objs/Makefile

#把-Werror删除掉

make && make install

4.修改nginx配置文件

cd /usr/local/nginx/conf/

vi nginx.conf

upstream trackers {

server 172.16.42.2:7001 weight=1;

server 172.16.42.8:7001 weight=1;

check interval=1000 rise=2 fall=5 timeout=1000;

}

location /images/ {

mogilefs_tracker trackers;

mogilefs_domain images;

mogilefs_methods GET;

mogilefs_noverify on;

mogilefs_pass {

proxy_pass $mogilefs_path;

proxy_hide_header Content-type;

proxy_buffering off;

}

}

nginx

重读磁盘:echo ‘- – -‘ >/sys/class/scsi_host/host2/scan

原创文章,作者:z long,如若转载,请注明出处:/84256

发表评论

登录后才能评论

联系我们

400-080-6560

在线咨询:点击这里给我发消息

邮件:1823388528@qq.com

工作时间:周一至周五,9:30-18:30,节假日同时也值班

友情链接:万达娱乐主管  guoqibee.com  万达招商  万达娱乐直属  万达娱乐主管  万达娱乐招商QQ  万达登录  万达主管QQ  测试  万达娱乐开户