码迷,mamicode.com
首页 > 其他好文 > 详细

mogilefs分布式部署及说明

时间:2017-01-02 00:13:13      阅读:1322      评论:0      收藏:0      [点我收藏+]

标签:mogilefs

一、mogilefs介绍

二、mogilefs原理

三、mogilefs架构说明

四、mogile安装部署


一、mogilefs介绍

MogileFS是我们的开源分布式文件系统。其性能和特点包括:

(1)应用程序级别 - 不需要特殊的内核模块。

   没有单点故障 -  MogileFS设置的所有三个组件(存储节点,跟踪器和跟踪器的数据库)可以在多台机器上运行,因此没有单点故障。 (您可以在与存储节点相同的计算机上运行跟踪器,因此您不需要4台计算机...)建议至少使用2台计算机。

(2)自动文件复制

   基于文件“类”的文件在足够不同的存储节点之间自动复制,以满足其类所请求的最小复制计数。例如,对于照片托管网站,您可以使原始JPEG的最小副本计数为3,但缩略图和缩放版本只有副本计数为1或2.如果你失去了缩略图的唯一副本,  应用程序可以重建它。以这种方式,MogileFS(无RAID)可以在不必要地存储多个数据副本的磁盘上节省资金。         

(3)比RAID更好

   在非SAN RAID设置中,磁盘是冗余的,但主机不是。如果丢失整个机器,则文件无法访问。 MogileFS在不同主机上的设备之间复制文件,因此文件始终可用。

(4) Flat Namespace      

   文件由平面的全局命名空间中的命名键标识。您可以创建任意数量的命名空间,因此具有可能冲突的键的多个应用程序可以在同一个MogileFS安装上运行。

(5) Shared-Nothing

    MogileFS不依赖于具有共享磁盘的昂贵的SAN。每台机器都维护自己的本地磁盘。

(6)不需要RAID  

   MogileFS存储节点上的本地磁盘可以位于RAID中,也可以不位于RAID中。它不是更便宜,因为RAID不会买你任何安全,MogileFS尚未提供。

(7)与本地文件系统无关联

   MogileFS存储节点上的本地磁盘可以使用您选择的文件系统(ext3,XFS等)进行格式化。 MogileFS有自己的内部目录哈希,因此它不会遇到文件系统限制,如“每个目录的最大文件数”或“每个目录最大目录数”。使用你舒适的。


二、mogilefs原理

Tracker(mogilefsd进程)

  基于事件的父进程/消息总线,管理来自应用程序的所有客户端通信(请求执行操作),包括将这些请求负载平衡到“查询工作器”,并处理mogilefsd子进程之间的所有通信。您应该在不同的主机上运行2个跟踪程序,为HA或更多负载均衡(如果您需要超过2)。 mogilefsd下的子进程包括:

    Replication - 复制文件

    Deletion- 命名空间中的删除是立即的;从文件系统的删除是异步的

    Query - 应答来自客户端的请求

    Reaper  - 在磁盘发生故障后重新排列文件以进行复制

    Monitor  - 监视主机和设备的运行状况和状态

    ... ...

数据库

  存储MogileFS元数据(命名空间,哪些文件位于哪里)的数据库。这应该在HA配置中设置,所以你没有单点故障。

存储节点

  存储文件的位置。存储节点只是执行DELETE,PUT等的HTTP服务器。任何WebDAV服务器都很好,但建议使用mogstored。 mogilefsd可以配置为使用不同端口上的两个服务器... mogstored用于所有WebDAV操作(和边带监控),以及您的快速/轻量级HTTP服务器,用于GET操作。通常人们每个安装点有一个SATA磁盘,每个安装在/var/mogdata/devNN。


三、mogilefs架构说明

技术分享


四、安装部署

mogilefs+tracker部署在47,48,49上,三个安装一致,这里只写47的安装方法

1.安装mogilefs

下载地址:https://github.com/mogilefs/

由于mogilefs没有提供rpm包,这里使用原生的安装方法,如果需要使用rpm,去下载他人生成好的RPM


1.1.安装需要的依赖包:

yum install perl-DBD-mysql perl-CPAN perl-YAML gcc-c++

添加用户

adduser mogilefs

1.2.安装MogileFS-Server

unzip MogileFS-Server-master.zip
cd MogileFS-Server-master
per Makefile.PL
make
make install

1.3.安装MogileFS-Network

cd MogileFS-Network-master/
perl Makefile.PL
make
make install

1.4.安装MogileFS-Utils

cd MogileFS-Utils-master/
per Makefile.PL
make
make install

1.5.安装perl-MogileFS-Client

cd perl-MogileFS-Client-master/
per Makefile.PL
make
make install

1.6.Perl安装插件

perl -MCPAN -e ‘install Danga::Socket‘
perl -MCPAN -e ‘install Gearman::Client‘
perl -MCPAN -e ‘install Gearman::Server‘ 
perl -MCPAN -e ‘install Gearman::Client::Async‘ 
perl -MCPAN -e ‘install Net::Netmask‘ 
perl -MCPAN -e ‘install IO::WrapTie‘ 
perl -MCPAN -e ‘install IO::AIO‘ 
perl -MCPAN -e ‘install List::MoreUtils‘
perl -MCPAN -e ‘install Path::Class‘ 
perl -MCPAN -e ‘install Perlbal‘

2.配置数据库

数据库172.16.110.50

2.1.数据库安装略过

2.2.创建数据库及添加账号

添加root管理账号

MariaDB [mysql]> grant all on *.* to ‘root‘@‘172.16.110.%‘ identified by ‘ckl893‘;
Query OK, 0 rows affected (0.01 sec)

创建数据库:

MariaDB [mysql]> create database mogilefs;
Query OK, 1 row affected (0.00 sec)

添加mogilefs远程连接用户:

MariaDB [mysql]> grant all on mogilefs.* to ‘moguser‘@‘172.16.110.%‘ identified by ‘mogpass‘;
Query OK, 0 rows affected (0.00 sec)

2.3.生成数据表操作

修改生成脚本:

# vim mogdbsetup
....
my %args = (
            dbhost => "172.16.110.50",
            dbport => 3306,
            dbname => "mogilefs",
            dbrootuser => "root",
            dbrootpass => "ckl893",
            dbuser => "moguser",
            dbpass => "mogpass",
            );
....

在47上生成数据库表:

./mogdbsetup --dbhost=172.16.110.50 --dbname=mogilefs --dbuser=moguser --dbpassword=mogpass

This will attempt to setup or upgrade your MogileFS database.
It won‘t destroy existing data.
Run with --help for more information.  Run with --yes to shut up these prompts.

Continue? [N/y]: y

查看数据表:

MariaDB [mogilefs]> show tables;
+----------------------+
| Tables_in_mogilefs   |
+----------------------+
| checksum             |
| class                |
| device               |
| domain               |
| file                 |
| file_on              |
| file_on_corrupt      |
| file_to_delete       |
| file_to_delete2      |
| file_to_delete_later |
| file_to_queue        |
| file_to_replicate    |
| fsck_log             |
| host                 |
| server_settings      |
| tempfile             |
| unreachable_fids     |
+----------------------+
17 rows in set (0.00 sec)

3.配置文件及脚本

3.1.创建配置文件目录及权限

mkdir /etc/mogilefs/
chown -R mogilefs.mogilefs /etc/mogilefs/
cp /tmp/soft/MogileFS-Server-master/conf/mogilefsd.conf /etc/mogilefs/
cp /tmp/soft/MogileFS-Server-master/conf/mogstored.conf /etc/mogilefs/

3.2.mogilefsd配置文件说明

#vim /etc/mogilefs/mogilefsd.conf
daemonize = 1  守护进程运行
pidfile = /var/run/mogilefsd/mogilefsd.pid  pid文件
db_dsn = DBI:mysql:mogilefs:host=172.16.110.50  指定数据库连接地址
db_user = moguser       数据库连接用户
db_pass = mogpass       数据库连接密码
listen = 0.0.0.0:7001   tracker监听端口
conf_port = 7001       配置端口
query_jobs = 10        查询线程
delete_jobs = 1        删除线程
replicate_jobs = 5     复制线程
reaper_jobs = 1        复制线程

3.3.mogstored配置文件说明

#vim /etc/mogilefs/mogstored.conf
maxconns = 10000   #最大连接数
httplisten = 0.0.0.0:7500  #访问端口
mgmtlisten = 0.0.0.0:7501  #管理端口
docroot = /var/mogdata     #数据目录
pidfile = /var/run/mogstored/mogstored.pid #pid文件,如果脚本指定,这里必须有

3.4.mogilefsd启动脚本

vim /etc/init.d/mogilefsd 
#!/bin/sh
#
# mogilefsd    Startup script for the MogileFS tracker
#
# chkconfig: - 85 15
# description: MogileFS tracker
# processname: mogilefsd
# config: /etc/mogilefs/mogilefs.conf
# pidfile: /var/run/mogilefsd/mogilefsd.pid 
 
# Source function library.
. /etc/init.d/functions
 
# Check that networking is up.
. /etc/sysconfig/network
 
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
 
mogilefsd="/usr/local/bin/mogilefsd"
 
MOGILEFS_CONF_FILE="/etc/mogilefs/mogilefsd.conf"
SUDO_USER=mogilefs
 
lockfile=/var/lock/subsys/mogilefsd
 
start() {
         echo -n $"Starting mogilefsd: "
         #sudo -u $SUDO_USER $mogilefsd -c $MOGILEFS_CONF_FILE --daemon --no_schema_check
         daemon --user $SUDO_USER $mogilefsd -c $MOGILEFS_CONF_FILE --daemon
         retval=$?
         echo
         [ $retval = 0 ] && touch ${lockfile}
         return $retval
}
stop() {
         echo -n $"Stopping $prog: "
         killproc mogilefsd
         retval=$?
         echo
         [ $retval = 0 ] && rm -f ${lockfile}
         return $retval
}
reload() {
     echo -n $"Reloading mogilefsd: "
     killproc mogilefsd -HUP
     retval=$?
     echo
}
 
# See how we were called.
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   status)
         status mogilefsd
         retval=$?
         ;;
   restart)
         stop
         start
         ;;
   reload)
         reload
         ;;
   *)
         echo $"Usage: mogilefsd {start|stop|restart|reload|status}"
         exit 1
esac
 
exit $retval

3.5.mogstored启动脚本

vim /etc/init.d/mogstored 
#!/bin/sh
#
# mogstored    Startup script for the Mogstored Storage
#
# chkconfig: - 85 15
# description: MogileFS storage
# processname: mogstored
# config: /etc/mogilefs/mogstored.conf
# pidfile: /var/run/mogstored/mogstored.pid
 
# Source function library.
. /etc/init.d/functions
 
# Check that networking is up.
. /etc/sysconfig/network
 
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
 
mogstored="/usr/local/bin/mogstored"
 
MOGILEFS_CONF_FILE="/etc/mogilefs/mogstored.conf"
SUDO_USER=mogilefs
 
lockfile=/var/lock/subsys/mogstored
 
start() {
         echo -n $"Starting mogstored: "
#         sudo -u $SUDO_USER $mogilefsd -c $MOGILEFS_CONF_FILE --daemon --no_schema_check
         $mogstored --config=$MOGILEFS_CONF_FILE --daemon
#         daemon --user $SUDO_USER $mogstored -c $MOGILEFS_CONF_FILE --daemon
         retval=$?
         echo
         [ $retval = 0 ] && touch ${lockfile}
         return $retval
}
stop() {
         echo -n $"Stopping $prog: "
         killproc mogstored
         retval=$?
         echo
         [ $retval = 0 ] && rm -f ${lockfile}
         return $retval
}
reload() {
     echo -n $"Reloading mogstored: "
     killproc mogstored -HUP
     retval=$?
     echo
}
 
# See how we were called.
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   status)
         status mogstored
         retval=$?
         ;;
   restart)
         stop
         start
         ;;
   reload)
         reload
         ;;
   *)
         echo $"Usage: mogstored {start|stop|restart|reload|status}"
         exit 1
esac
 
exit $retval

3.6.启动进程:

启动查看mogilefsd进程

# systemctl start mogilefsd.service
# ss -ntl
State      Recv-Q Send-Q                      Local Address:Port                                     Peer Address:Port              
LISTEN     0      128                                     *:111                                                 *:*                  
LISTEN     0      128                                     *:22                                                  *:*                  
LISTEN     0      128                                     *:7001                                                *:*                  
LISTEN     0      100                             127.0.0.1:25                                                  *:*                  
LISTEN     0      128                                    :::111                                                :::*                  
LISTEN     0      128                                    :::22                                                 :::*                  
LISTEN     0      100                                   ::1:25                                                 :::*

启动查看mogstored进程:

# systemctl status mogstored.service
# ss -ntl
State      Recv-Q Send-Q                      Local Address:Port                                     Peer Address:Port              
LISTEN     0      128                                     *:7500                                                *:*                  
LISTEN     0      128                                     *:7501                                                *:*                  
LISTEN     0      128                                     *:111                                                 *:*                  
LISTEN     0      128                                     *:22                                                  *:*                  
LISTEN     0      128                                     *:7001                                                *:*                  
LISTEN     0      100                             127.0.0.1:25                                                  *:*                  
LISTEN     0      128                                    :::111                                                :::*                  
LISTEN     0      128                                    :::22                                                 :::*                  
LISTEN     0      100                                   ::1:25                                                 :::*

4.添加节点

为每个host增加节点,方法一直,随便选择一个tracker即可

4.1.增加节点:

# mogadm --trackers=172.16.110.47:7001 host add node1 --ip=172.16.110.47 --status=alive
# mogadm --trackers=172.16.110.48:7001 host add node2 --ip=172.16.110.48 --status=alive
# mogadm --trackers=172.16.110.49:7001 host add node3 --ip=172.16.110.49 --status=alive

删除节点:

mogadm --trackers=172.16.110.49:7001 host delete node1

查看增加的节点:

# mogadm --trackers=172.16.110.49:7001 host list        
node1 [1]: alive
  IP:       172.16.110.47:7500
node2 [2]: alive
  IP:       172.16.110.48:7500
node3 [3]: alive
  IP:       172.16.110.49:7500

4.2.添加设备存储节点:

(注意,最后一列的ID号同创建的目录的序号,如dev4 就是 4)

# mogadm --trackers=172.16.110.49:7001 device add node1 4
# mogadm --trackers=172.16.110.49:7001 device add node2 5
# mogadm --trackers=172.16.110.49:7001 device add node3 6

创建物理存储节点路径:

node1:

mkdir -pv /var/mogdata/dev4
chown -R mogilefs.mogilefs /var/mogdata/dev4

node2:

mkdir -pv /var/mogdata/dev5
chown -R mogilefs.mogilefs /var/mogdata/dev5

node3:

mkdir -pv /var/mogdata/dev6
chown -R mogilefs.mogilefs /var/mogdata/dev6

查看添加的节点:    

# mogadm --trackers=172.16.110.49:7001 device list
node1 [1]: alive
                    used(G)    free(G)   total(G)  weight(%)
   dev4:   alive      1.786      6.200      7.986        100
node2 [2]: alive
                    used(G)    free(G)   total(G)  weight(%)
   dev5:   alive      1.792      6.194      7.986        100
node3 [3]: alive
                    used(G)    free(G)   total(G)  weight(%)
   dev6:   alive      1.928      6.059      7.986        100

删除设备存储节点:

mogadm --trackers=172.16.110.49:7001 device mark node1 1 dead

4.3.检查节点状态:

# mogadm --trackers=172.16.110.49:7001 check
Checking trackers...
  172.16.110.49:7001 ... OK
Checking hosts...
  [ 1] node1 ... OK
  [ 2] node2 ... OK
  [ 3] node3 ... OK
Checking devices...
  host device         size(G)    used(G)    free(G)   use%   ob state   I/O%
  ---- ------------ ---------- ---------- ---------- ------ ---------- -----
  [ 1] dev4             7.986      1.786      6.200  22.37%  writeable   0.0
  [ 2] dev5             7.986      1.793      6.193  22.45%  writeable   0.0
  [ 3] dev6             7.986      1.929      6.058  24.15%  writeable   0.0
  ---- ------------ ---------- ---------- ---------- ------
             total:    23.959      5.508     18.451  22.99%

5.添加域

5.1.创建域:

# mogadm --trackers=172.16.110.49:7001 domain add img
# mogadm --trackers=172.16.110.49:7001 domain add html
# mogadm --trackers=172.16.110.49:7001 domain add file

查看域信息:

# mogadm --trackers=172.16.110.49:7001 domain list    
 domain               class                mindevcount   replpolicy   hashtype
-------------------- -------------------- ------------- ------------ -------
 file                 default                   2        MultipleHosts() NONE   
 html                 default                   2        MultipleHosts() NONE   
 img                  default                   2        MultipleHosts() NONE

6.添加类

默认会创建默认类,这里我们创建测试:

6.1.默认类:

# mogadm --trackers=172.16.110.49:7001 class list
 domain               class                mindevcount   replpolicy   hashtype
-------------------- -------------------- ------------- ------------ -------
 file                 default                   2        MultipleHosts() NONE   
 html                 default                   2        MultipleHosts() NONE   
 img                  default                   2        MultipleHosts() NONE

6.2.创建自定义类:

# mogadm --trackers=172.16.110.49:7001 class add html ckltext --mindevcount=3

查看类列表:

# mogadm --trackers=172.16.110.49:7001 class list
 domain               class                mindevcount   replpolicy   hashtype
-------------------- -------------------- ------------- ------------ -------
 file                 default                   2        MultipleHosts() NONE   
 html                 ckltext                   3        MultipleHosts() NONE   
 html                 default                   2        MultipleHosts() NONE   
 img                  default                   2        MultipleHosts() NONE

7.文件上传

7.1.上传测试:

# mogupload --trackers=172.16.110.49:7001 --domain=file --key=‘ckl_cron.txt‘ --file=/data/ckl_cron.txt
# mogupload --trackers=172.16.110.49:7001 --domain=img --key=‘001‘ --file=/data/001.jpg
# mogupload --trackers=172.16.110.49:7001 --domain=html --class=ckltext --key=‘index.html‘ --file=/data/index.html 上传到指定域指定类

7.2.查看文件上传信息

# mogfileinfo --trackers=172.16.110.49:7001 --domain=file --key=‘ckl_cron.txt‘
- file: ckl_cron.txt
     class:              default
  devcount:                    1
    domain:                 file
       fid:                   17
       key:         ckl_cron.txt
    length:                   78
 - http://172.16.110.48:7500/dev5/0/000/000/0000000017.fid
# mogfileinfo --trackers=172.16.110.49:7001 --domain=img --key=‘001‘    
- file: 001
     class:              default
  devcount:                    1
    domain:                  img
       fid:                   18
       key:                  001
    length:                68539
 - http://172.16.110.47:7500/dev4/0/000/000/0000000018.fid
# mogfileinfo --trackers=172.16.110.49:7001 --domain=html --key=‘index.html‘
- file: index.html
     class:              ckltext
  devcount:                    1
    domain:                 html
       fid:                   19
       key:           index.html
    length:                  131
 - http://172.16.110.48:7500/dev5/0/000/000/0000000019.fid

7.3.查看设备存储信息

# mogstats --config=/etc/mogilefs/mogilefsd.conf 
Fetching statistics... (all)

Statistics for devices...
  device     host                   files     status
  ---------- ---------------- ------------ ----------
  dev4       node1               1      alive
  dev5       node2               3      alive
  ---------- ---------------- ------------ ----------

Statistics for file ids...
  Max file id: 20

Statistics for files...
  domain               class           files    size (m)  fullsize (m)
  -------------------- ----------- ---------- ----------- -------------
  file                 default             1           0             0
  html                 ckltext             1           0             0
  img                  default             2           0             0
  -------------------- ----------- ---------- ----------- -------------

Statistics for replication...
  domain               class        devcount      files
  -------------------- ----------- ---------- ----------
  file                 default             1          1
  html                 ckltext             1          1
  img                  default             1          2
  -------------------- ----------- ---------- ----------

Statistics for replication queue...
  status                      count
  -------------------- ------------
  deferred                        4
  -------------------- ------------

Statistics for delete queue...
  status                      count
  -------------------- ------------
  -------------------- ------------

Statistics for general queues...
  queue           status                      count
  --------------- -------------------- ------------
  --------------- -------------------- ------------

done

8.访问测试

http://172.16.110.48:7500/dev5/0/000/000/0000000017.fid

技术分享

http://172.16.110.48:7500/dev5/0/000/000/0000000019.fid

技术分享

http://172.16.110.48:7500/dev5/0/000/000/0000000020.fid

技术分享

9.nginx反向代理配置

下载nginx_mogilefs_module-1.0.4.tar.gz模块

地址:http://www.grid.net.ru/nginx/mogilefs.en.html

9.1.安装zlib

tar -xf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make insatll

9.2.安装pcre

tar -xf pcre-8.37.tar.gz
cd pcre-8.37
./configure
make
make install

9.3.安装openssl

tar -xf openssl-1.0.2.tar.gz
cd openssl-1.0.2
./config --prefix=/usr/local --openssldir=/usr/local/openssl
make
make insatll

9.4.安装nginx

tar -xf nginx-1.6.3.tar.gz
cd nginx-1.6.3/
./configure  --prefix=/app/local/nginx --pid-path=/app/local/nginx --user=nginx --group=nginx --with-threads --with-file-aio --with-http_ssl_module --with-pcre=/tmp/soft/pcre-8.37 --with-openssl=/tmp/soft/openssl-1.0.2 --add-module=/tmp/soft/nginx_mogilefs_module-1.0.4
make
make isntall

9.5.nginx配置

参考http://www.grid.net.ru/nginx/mogilefs.en.html

user  nginx;
worker_processes  8;
error_log  /app/local/log/nginx/error.log warn;
pid        /app/local/nginx/logs/nginx.pid;

events {
        use epoll;
        worker_connections  5120;
        multi_accept on;    
}


http {

    server_names_hash_bucket_size 64;
    proxy_headers_hash_max_size 51200;
    proxy_headers_hash_bucket_size 6400;
    include       /app/local/nginx/conf/mime.types;
    default_type  application/octet-stream;

    log_format main "$http_cdn_src_ip | $time_local | $request | $status | $body_bytes_sent | "
                "$request_body | $content_length | $http_referer | $http_user_agent | "
                "$http_x_forwarded_for | $remote_addr | $upstream_response_time | $request_time | $http_tracecode";

    access_log  /app/local/log/nginx/access.log  main;
    client_header_buffer_size 16k;
    large_client_header_buffers 4 64k;

    server_tokens off;
    sendfile    on;
    tcp_nopush  on;
    tcp_nodelay on;

    keepalive_timeout  65;
    client_header_timeout 20;
    client_body_timeout 20;
    reset_timedout_connection on;
    send_timeout 30;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 4;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    open_file_cache max=409600 inactive=30s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    upstream mog_tracker {
        server 172.16.110.47:7001;
        server 172.16.110.48:7001;
        server 172.16.110.49:7001;
    }

    server {

    listen       80;
    location ~* /html/ {
        mogilefs_tracker mog_tracker;
        mogilefs_domain html;
        mogilefs_pass  {
             proxy_pass $mogilefs_path;
             proxy_hide_header Content-Type;
             proxy_buffering off;
        }
    }

    location ~* /img/  {
       mogilefs_tracker mog_tracker;
       mogilefs_domain img;
       mogilefs_pass  {
            proxy_pass $mogilefs_path;
            proxy_hide_header Content-Type;
            proxy_buffering off;
       }
    }

    location ~* /file/ {  
            mogilefs_tracker mog_tracker;
            mogilefs_domain file;
            mogilefs_methods GET PUT DELETE;
            mogilefs_pass {
                proxy_pass $mogilefs_path;
                proxy_hide_header Content-Type;
                proxy_buffering off;
           }
     }
   }

}

启动nginx:

systemctl start nginx.service

10.测试文件

技术分享

技术分享

技术分享

错误说明:

启动报错1:

Jan 01 12:05:42 www3.ckl.com runuser[48364]: pam_unix(runuser:session): session opened for user root by (uid=0)
Jan 01 12:05:42 www3.ckl.com mogilefsd[48363]: Starting mogilefsd: Can‘t locate Sys/Syslog.pm in @INC (@INC contains: lib /us...ne 25.
Jan 01 12:05:42 www3.ckl.com mogilefsd[48363]: BEGIN failed--compilation aborted at /usr/local/share/perl5/MogileFS/Server.pm line 25.
Jan 01 12:05:42 www3.ckl.com mogilefsd[48363]: Compilation failed in require at /usr/local/bin/mogilefsd line 16.
Jan 01 12:05:42 www3.ckl.com mogilefsd[48363]: BEGIN failed--compilation aborted at /usr/local/bin/mogilefsd line 16.
Jan 01 12:05:42 www3.ckl.com mogilefsd[48363]: [FAILED]
Jan 01 12:05:42 www3.ckl.com systemd[1]: mogilefsd.service: control process exited, code=exited status=1
Jan 01 12:05:42 www3.ckl.com systemd[1]: Failed to start SYSV: MogileFS tracker.
Jan 01 12:05:42 www3.ckl.com systemd[1]: Unit mogilefsd.service entered failed state.
Jan 01 12:05:42 www3.ckl.com systemd[1]: mogilefsd.service failed.
Warning: mogilefsd.service changed on disk. Run ‘systemctl daemon-reload‘ to reload units.
Hint: Some lines were ellipsized, use -l to show in full.

解决1:

yum install perl-core

启动报错2:

Jan 01 13:35:29 www3.ckl.com systemd[1]: Starting SYSV: MogileFS storage...
Jan 01 13:35:30 www3.ckl.com mogstored[50356]: Starting mogstored:
Jan 01 13:35:30 www3.ckl.com systemd[1]: PID file /var/run/mogstored/mogstored.pid not readable (yet?) after start.

解决2:

配置文件增加 pidfile = /var/run/mogstored/mogstored.pid

编译nginx报错:

/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c: In function ‘ngx_http_mogilefs_handler’:
/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c:320:12: error: ‘ngx_peer_connection_t’ has no member named ‘lock’
     u->peer.lock = &r->connection->lock;
            ^
/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c:320:34: error: ‘ngx_connection_t’ has no member named ‘lock’
     u->peer.lock = &r->connection->lock;
                                  ^
/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c: In function ‘ngx_http_mogilefs_create_request’:
/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c:739:37: error: variable ‘request’ set but not used [-Werror=unused-but-set-variable]
     ngx_str_t                       request, domain;
                                     ^
/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c: In function ‘ngx_http_mogilefs_create_spare_location’:
/tmp/soft/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c:1532:39: error: variable ‘pclcf’ set but not used [-Werror=unused-but-set-variable]
     ngx_http_core_loc_conf_t  *clcf, *pclcf, *rclcf;
                                       ^
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.o] Error 1
make[1]: Leaving directory `/tmp/soft/nginx-1.8.1‘
make: *** [build] Error 2

解决:

CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g

去掉 -Werror

CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g

(系统7.3,nginx:1.6.3,以后的版本会编译出错,跳过也不行)


本文出自 “深呼吸再出击” 博客,谢绝转载!

mogilefs分布式部署及说明

标签:mogilefs

原文地址:http://ckl893.blog.51cto.com/8827818/1888071

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!