在tracker主机:
1.上下载rpm包mkdir mogilefs/cd mogilefslftp 172.16.0.1getMogileFS-Server-2.46-2.el7.centos.noarch.rpmMogileFS-Server-mogilefsd-2.46-2.el7.centos.noarch.rpmMogileFS-Server-mogstored-2.46-2.el7.centos.noarch.rpmMogileFS-Utils-2.19-1.el7.centos.noarch.rpmperl-Danga-Socket-1.61-1.el6.rf.noarch.rpmperl-MogileFS-Client-1.14-1.el7.centos.noarch.rpmperl-Perlbal-1.78-1.el6.noarch.rpmscp *.rpm 172.16.42.8:/root/mogilefs/2.安装依赖关系,安装包yum install perl-Net-Netmask perl-IO-stringy perl-Sys-Syslog perl-IO-AIO -yyum install *.rpm -y3.初始化数据库mogdbsetup –dbhost=172.16.42.9 –dbrootuser=root –dbrootpass=mageedu –dbuser=moguser –dbpass=mageedu –dbname=mogilefs –yes4.配置mogilefsdvim /etc/mogilefs/mogilefsd.confdb_dsn = DBI:mysql:mogilefs:host=172.16.42.9db_user = moguserdb_pass = mageedulisten = 0.0.0.0:70015.配置mogstoredvim /etc/mogilefs/mogstored.confmaxconns = 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 -pvchown -R mogilefs.mogilefs /mogdata/8.启动服务systemctl start mogilefsdsystemctl start mogilefsd9.添加节点mogadm –trackers=172.16.42.2:7001 host add 172.16.42.2 –ip=172.16.42.2 –status=alivemogadm –trackers=172.16.42.2:7001 host add 172.16.42.8 –ip=172.16.42.8 –status=alive10.添加设备mogadm device add 172.16.42.2 1mogadm device add 172.16.42.8 211.创建domainmogadm –trackers=172.16.10.123:7001 domain add filesmogadm –trackers=172.16.10.123:7001 domain add htmlmogadm –trackers=172.16.10.123:7001 domain add images12.上传测试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 -pvchown -R mogilefs.mogilefs /mogdata/
mariadb主机上:
yum install mariadb-server -y1.编辑配置文件vim /etc/my.cnf.d/server.cnf[mysqld]skip_name_resolve=1innodb_file_per_table = 1systemctl start mariadb2.授权mysqlGRANT 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.gztar xvf nginx_mogilefs_module-1.0.4.tar.gz2.安装开发环境yum groupinstall “Development Tools” “Server Platform Development” -yyum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-develuseradd -r nginxtar xvf nginx-1.10.3.tar.gzcd nginx-1.10.33.编译安装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.4vim objs/Makefile#把-Werror删除掉make && make install4.修改nginx配置文件cd /usr/local/nginx/conf/vi nginx.confupstream 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
原创文章,作者:z long,如若转载,请注明出处:http://www.178linux.com/84256