[root@node1 ~]# rpm -ivh perl-MogileFS-Client-1.14-1.el6.noarch.rpm perl-Net-Netmask-1.9015-8.el6.noarch.rpm perl-Perlbal-1.78-1.el6.noarch.rpm [root@node1 ~]# yum -y install MogileFS-Server-mogstored-2.46-2.el6.noarch.rpm MogileFS-Utils-2.19-1.el6.noarch.rpm MogileFS-Server-2.46-2.el6.noarch.rpm MogileFS-Server-mogilefsd-2.46-2.el6.noarch.rpm perl-IO-AIO # 安装好之后修改配置文件,只需要修改以下几项就可以了 # mysql指使用的数据库是什么,MariaDB也是写mysql;mogdb指数据库名;host=172.16.27.88指定安装数据的地址 [root@node1 ~]# vim /etc/mogilefs/mogilefsd.conf db_dsn = DBI:mysql:mogdb:host=172.16.27.1 db_user = moguser # 指登录mogdb数据所使用的用户名 db_pass = linux # 登录mogdb数据所使用密码 listen = 0.0.0.0:7001 # 0.0.0.0表示监听所有地址 # 再编辑mogstored.conf这个配置文件 maxconns = 10000 httplisten = 0.0.0.0:7500 mgmtlisten = 0.0.0.0:7501 docroot = /dfs/mogdata # 把这项改一个特定的目录,以便存储数据,最好是一个独立分区 [root@node1 ~]# mkdir -pv /dfs/mogdata/dev1 # 创建修改的docroot目录 [root@node1 ~]# chown -R mogilefs.mogilefs /dfs/mogdata/dev1 # 修改属主属组 [root@node1 ~]# chown -R mogilefs.mogilefs /var/run/mogilefsd/ [root@node1 ~]# cd /etc/mogilefs [root@node1 ~]# scp mogilefsd.conf mogstored.conf root@172.16.27.2:/etc/mogilefs/ # 复制修改好的配置文件到node2的mogilefs目录下,覆盖即可,两个节点都安装配置好之后先不要启动服务,数据库还没有安装
在node2上的安装和配置,这里的配置文件由node1上复制过来就可以了;
[root@node2 ~]# rpm -ivh perl-MogileFS-Client-1.14-1.el6.noarch.rpm perl-Net-Netmask-1.9015-8.el6.noarch.rpm perl-Perlbal-1.78-1.el6.noarch.rpm [root@node2 ~]# yum -y install MogileFS-Server-mogstored-2.46-2.el6.noarch.rpm MogileFS-Utils-2.19-1.el6.noarch.rpm MogileFS-Server-2.46-2.el6.noarch.rpm MogileFS-Server-mogilefsd-2.46-2.el6.noarch.rpm perl-IO-AIO [root@node2 ~]# mkdir -pv /dfs/mogdata/dev2 # 创建修改的docroot目录 [root@node1 ~]# chown -R mogilefs.mogilefs /var/run/mogilefsd/ [root@node2 ~]# chown -R mogilefs.mogilefs /dfs/mogdata/dev2 # 修改属主属组
第二步:安装nginx和MariaDB,这里安装Nginx需要编译安装,因为他需要装载第三方模块才可以使用mogilefs,MariaDB安装这里就不再说明了;
在node0节点上的安装步骤:
# 解决依赖关系 [root@node0 ~]# yum -y groupinstall "Development Tools" "Server Platform Development" [root@node0 ~]# yum -y install openssl-devel pcre-devel [root@node0 ~]# groupadd -r nginx [root@node0 ~]# useradd -r -g nginx nginx [root@node0 ~]# tar xf nginx-1.4.2.tar.gz [root@node0 ~]# unzip nginx-mogilefs-module-master.zip [root@node0 ~]# cd nginx-1.4.2 [root@node0 nginx-1.4.2]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src [root@node0 nginx-1.4.2]# ./configure \ > --prefix=/usr \ > --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=/var/tmp/nginx/client/ \ > --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ > --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ > --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ > --http-scgi-temp-path=/var/tmp/nginx/scgi \ > --with-pcre \ > --with-debug \ > --add-module=/root/nginx-mogilefs-module-master # 这里要指定编译的模块 [root@node0 nginx-1.4.2]# make && make install # 这里MariaDB安装过程不再说明了,可以参数前面的博文,编译安装好之后就可以可以启动MariaDB和去配置Nginx的相关配置了,还要给nginx提供一个服务脚本; [root@node0 support-files]# service mysqld start Starting MySQL... [ OK ] [root@node0 nginx-1.4.2]# vim /etc/rc.d/init.d/nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processname: nginx # config: /etc/nginx/nginx.conf # config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/etc/nginx/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx make_dirs() { # make required directories user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` options=`$nginx -V 2>&1 | grep 'configure arguments:'` for opt in $options; do if [ `echo $opt | grep '.*-temp-path'` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done } start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac [root@node0 nginx-1.4.2]# chmod +x /etc/init.d/nginx [root@node0 nginx-1.4.2]# vim /etc/profile.d/nginx.sh export PATH=/usr/sbin/nginx:$PATH [root@node0 nginx-1.4.2]# . /etc/profile.d/nginx.sh [root@node0 nginx-1.4.2]# service nginx start Starting nginx: [ OK ] [root@node0 nginx-1.4.2]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 :::111 :::* LISTEN 0 128 *:111 *:* LISTEN 0 128 *:80 *:*
测试访问一下nginx的页面: