MogileFS 安装

一、使用用cpan

 # cpan  
# cpan> installIO::AIO      
# cpan> install DBI  
# cpan> install DBD::mysql  
  
# cpan> install MogileFS::Server  
       install Gearman::Client   
       install Gearman::Server   
       install Sys::Syscall   
       install Perlbal   
       install Net::Netmask   
       install Danga::Socket   
       install Gearman::Client::Async   
      
# cpan> install MogileFS::Utils  
       install MogileFS::Client

二、使用包安装,依次安装如下顺序安装

BSD-Resource-1.2901.tar.gz
Sys-Syscall-0.22.tar.gz(
安装过程中提醒,Warning: prerequisite Test::More 0 notfound.安装Test-Simple-1.001003.tar.gz即可)

Time-HiRes-1.9715.tar.gz
Danga-Socket-1.57.tar.gz

Net-Netmask-1.9015.tar.gz
IO-AIO-3.07.tar.gz (
本包要求Perl v5.8.8以上)若提示Warning: prerequisite common::sense 0 notfound.安装common-sense-3.72.tar.gz即可)

test-simple.tar.gz
Perlbal-1.71.tar.gz(提示:

Warning: prerequisite HTTP::Date 0 not found.
Warning: prerequisite HTTP::Response 0 notfound.

安装 HTTP-Date-6.02.tar.gz

HTTP-Message-6.06.tar

libwww-perl-6.06.tar.gz(此包中间又要依赖好多包,通过yum installperl-libwww-perl,

String-CRC32-1.4.tar.gz
Gearman-1.07.tar.gz
Gearman-Client-Async-0.93.tar.gz

(

t/async.t ......... skipped: Can't findserver to test with

t/err1.t .......... skipped: Can't findserver to test with

t/err2.t .......... skipped: Can't findserver to test with

t/err3.t .......... skipped: Can't findserver to test with

t/err4.t .......... skipped: Can't findserver to test with

t/err5.t .......... skipped: Can't findserver to test with

t/err6.t .......... skipped: Can't findserver to test with

t/err7.t .......... skipped: Can't findserver to test with

t/err8.t .......... skipped: Can't findserver to test with

)
Gearman-Server-1.08.tar.gz

#make test
有可能会有一个错误,不用管它
DBI-1.607.tar.gz
DBD-mysql-4.008.tar.gz

#以下命令假设MySQL服务器是在本机
perl Makefile.PL -testhost=localhost -testuser=root -testpassword=123456-testdb=mogile -mysql_config=/usr/bin/mysql_config
编译这一段的代码的时候出现很多问题,

错误日志贴上来

In file included from dbdimp.c:20:
dbdimp.h:22:49: error: mysql.h: No such file or directory
dbdimp.h:23:45: error: mysqld_error.h: No such file or directory
dbdimp.h:25:49: error: errmsg.h: No such file or directory
In file included from dbdimp.c:20:
dbdimp.h:147: error: expected specifier-qualifier-list before 'MYSQL'
dbdimp.h:239: error: expected specifier-qualifier-list before 'MYSQL_RES'
In file included from dbdimp.c:20:
dbdimp.h:296: error: expected ')' before '*' token
dbdimp.h:299: error: expected '=', ',', ';', 'asm' or '__attribute__' before'mysql_st_internal_execute'
dbdimp.h:331: error: expected '=', ',', ';', 'asm' or '__attribute__' before'*' token
dbdimp.c: In function 'count_params':
dbdimp.c:94: warning: suggest parentheses around assignment used as truth value
dbdimp.c:137: warning: suggest parentheses around assignment used as truthvalue
dbdimp.c: At top level:
dbdimp.c:507: error: expected ')' before '*' token
dbdimp.c:809: error: 'FIELD_TYPE_VAR_STRING' undeclared here (not in afunction)
dbdimp.c:819: error: 'FIELD_TYPE_DECIMAL' undeclared here (not in a function)
dbdimp.c:829: error: 'FIELD_TYPE_TINY' undeclared here (not in a function)
dbdimp.c:839: error: 'FIELD_TYPE_SHORT' undeclared here (not in a function)
dbdimp.c:849: error: 'FIELD_TYPE_LONG' undeclared here (not in a function)
dbdimp.c:859: error: 'FIELD_TYPE_FLOAT' undeclared here (not in a function)
dbdimp.c:869: error: 'FIELD_TYPE_DOUBLE' undeclared here (not in a function)
dbdimp.c:892: error: 'FIELD_TYPE_TIMESTAMP' undeclared here (not in a function)
dbdimp.c:902: error: 'FIELD_TYPE_LONGLONG' undeclared here (not in a function)
dbdimp.c:912: error: 'FIELD_TYPE_INT24' undeclared here (not in a function)
dbdimp.c:922: error: 'FIELD_TYPE_DATE' undeclared here (not in a function)
dbdimp.c:932: error: 'FIELD_TYPE_TIME' undeclared here (not in a function)
dbdimp.c:942: error: 'FIELD_TYPE_DATETIME' undeclared here (not in a function)
dbdimp.c:952: error: 'FIELD_TYPE_YEAR' undeclared here (not in a function)
dbdimp.c:962: error: 'FIELD_TYPE_NEWDATE' undeclared here (not in a function)
dbdimp.c:972: error: 'FIELD_TYPE_ENUM' undeclared here (not in a function)
dbdimp.c:982: error: 'FIELD_TYPE_SET' undeclared here (not in a function)
dbdimp.c:992: error: 'FIELD_TYPE_BLOB' undeclared here (not in a function)
dbdimp.c:1002: error: 'FIELD_TYPE_TINY_BLOB' undeclared here (not in afunction)
dbdimp.c:1012: error: 'FIELD_TYPE_MEDIUM_BLOB' undeclared here (not in afunction)
dbdimp.c:1022: error: 'FIELD_TYPE_LONG_BLOB' undeclared here (not in afunction)
dbdimp.c:1032: error: 'FIELD_TYPE_STRING' undeclared here (not in a function)
dbdimp.c: In function 'mysql_dr_error':
dbdimp.c:1420: warning: unused variable 'errstate'
dbdimp.c: At top level:
dbdimp.c:1499: error: expected '=', ',', ';', 'asm' or '__attribute__' before'*' token
dbdimp.c: In function 'my_login':
dbdimp.c:1978: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: error: 'MYSQL' undeclared (first use in this function)
dbdimp.c:1979: error: (Each undeclared identifier is reported only once
dbdimp.c:1979: error: for each function it appears in.)
dbdimp.c:1979: warning: comparison between pointer and integer
dbdimp.c:1979: error: invalid operands to binary /
dbdimp.c:1979: warning: comparison between pointer and integer
dbdimp.c:1979: error: expected expression before ')' token
dbdimp.c:1979: error: invalid operands to binary *
dbdimp.c:1979: error: invalid operands to binary *
dbdimp.c:1979: error: invalid operands to binary *
dbdimp.c:1979: error: invalid operands to binary *
dbdimp.c:1979: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: error: invalid operands to binary *
dbdimp.c:1979: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: warning: passing argument 3 of '__builtin___memset_chk' makesinteger from pointer without a cast
dbdimp.c:1979: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c:1979: error: invalid operands to binary *
dbdimp.c:1979: warning: passing argument 3 of '__memset_ichk' makes integerfrom pointer without a cast
dbdimp.c:1979: warning: left-hand operand of comma expression has no effect
dbdimp.c:1979: warning: value computed is not used
dbdimp.c:1981: warning: implicit declaration of function 'mysql_dr_connect'
dbdimp.c:1981: error: 'imp_dbh_t' has no member named 'pmysql'
dbdimp.c: In function 'mysql_db_login':
dbdimp.c:2018: error: 'imp_dbh_t' has no member named 'stats'
dbdimp.c:2018: error: request for member 'auto_reconnects_ok' in something nota structure or union
dbdimp.c:2018: warning: statement with no effect
dbdimp.c:2019: error: 'imp_dbh_t' has no member named 'stats'
dbdimp.c:2019: error: request for member 'auto_reconnects_failed' in somethingnot a structure or union
dbdimp.c:2019: warning: statement with no effect
dbdimp.c:2020: error: 'imp_dbh_t' has no member named 'bind_type_guessing'
dbdimp.c:2020: warning: statement with no effect
dbdimp.c:2021: error: 'imp_dbh_t' has no member named 'bind_comment_placeholders'
dbdimp.c:2021: warning: statement with no effect
.

.

.

中间省略一点,太长了,浪费版面.

最终解决方式是:

/etc/ld.so.conf/下加入你的mysql lib库文件路径与*.h头文件路径

加入

/usr/lib64

/usr/lib64/mysql

/usr/include/mysql

/usr/bin
最后运行通过

Compress-Raw-Bzip2-2.064.tar.gz

IO-Compress-Zlib-2.015.tar.gz

IO-Compress-Base-2.015.tar.gz
Compress-Zlib-2.015.tar.gz
IO-stringy-2.110.tar.gz

Encode-Locale-1.03.tar.gz

MogileFS-Client-1.08.tar.gz

MogileFS-Utils-2.13.tar.gz
mogilefs-server-2.20.tar.gz

 

 

三、【配置MogileFS

以下操作除非明确指定,不然是以root用户来运行,当然,你也可以使用自己的帐户来执行(除了一些特权操作),另外10.15.6.28是本机IP,本试验只使用了一台机器。如果配置过程不太顺利,请反复检查后反复试验。

1. 创建数据库(初始化)
可以预先在数据库服务器上建立好一个叫做mogilefs的数据库,便于进行下面的步骤.
# mogdbsetup -dbhost=localhost-dbname=mogilefs -dbuser=root -dbpass=123456 -dbrootuser=root -dbrootpass=123456

 

–dbhost 是数据库主机地址,–dbname是数据库名,–dbuser是访问该数据库的用户,如果有密码请加上–dbpass选项,最好访问数据库的是超级用户root或者具有很高权限的新建数据库用户,因为MogileFS需要一些比较高权限的初始化操作。

第二步,新建tracker配置文件 
# vim /etc/mogilefsd.conf 
db_dsn DBI:mysql:mogilefs:127.0.0.1
db_user mogilefs
db_pass jongin
conf_port 6001
listener_jobs 5

第三步,启动trackers.

#adduser mogile
# su mogile
# mogilefsd -c /etc/mogilefsd.conf --daemon

第四步,初始化storage server数据

mogadm --trackers=192.168.1.221:6001 host addmogilestorage2 --ip=192.168.1.221 --port=7600 --status=alive检测是否生效: 
# mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.1.221:6001 host list
添加设备到storage server
# mogadm -lib=/usr/lib/perl5/5.8.8 -trackers=192.168.1.221:6001 device addmogilestorage 1
检测是否生效:
# mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.1.221:6001 devicelist

还可以执行如下命令来查看详细的硬盘资料

mogadm--trackers=192.168.1.221:6001check

 

第五步,新建Storage配置文件
# vim 
/etc/mogstored.conf

httplisten=192.168.1.221:7500 
docroot=/data/mdata

建立存储目录->mkdir -p /data/mdata/dev1

第六步,运行MogileFS

#mogstored -c /etc/mogstored.conf --daemon

查看你所有的服务都起来没有
# ps -ef | grep mogilefsd
# ps -ef | grep mogstored

第七部,测试运行

生成domain
# mogadm --trackers=192.168.1.221:6001domain add domain1
加一个 class 到domain
# mogadm  --trackers=192.168.1.221:6001 class add domain1 domainclass

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值