安装MogileFS
安装步骤如下
1:需要先安装MySql,
2:安装MySql的开发包devel,下载了MySQL-devel-5.5.25-1.rhel5.i386.rpm,
安装: rpm -ivh MySQL-devel-5.5.25-1.rhel5.i386.rpm
3:安装MySql的share包,下载了MySQL-shared-5.6.19-1.rhel5.i386.rpm,
安装: rpm -ivh MySQL-shared-5.6.19-1.rhel5.i386.rpm 安装后可以使用 rpm -qa|grep-i mysql 来查看安装的包
4:需要有Perl的环境,服务器已经自带了5.8.8版本的
5:安装CPANMinus wget http://xrl.us/cpanm --no-check-certificate -O /sbin/cpanm然后授权chmod+x /sbin/cpanm 或者wget-O- http://cpanmin.us --no-check-certificate | perl---sudo--self-upgrade 这个会自动安装到/usr/bin/cpanm 6:利用cpanm来安装MogileFS的Perl模块,依次按照如下步骤
(1):cpanm DBD::mysql
(2):cpanm MogileFS::Server
(3):cpanm MogileFS::Utils
(4):cpanm MogileFS::Client
基本配置步骤如下
1:在MySql数据库中创建MogileFS要使用的数据库和用户名
CREATE DATABASE MogileFSDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL ON MogileFS.* TO 'mogile'@'%' IDENTIFIED BY 'mogile'; UPDATE mysql.userSET Password=PASSWORD('cc') where USER='mogile'; FLUSH PRIVILEGES; //刷新数据库
2:配置和初始化数据库
./mogdbsetup--dbhost=localhost--dbname=MogileFS--dbuser=mogile--dbpass=cc
安装时遇到如下问题:
Failed to load MogileFS::Store::MySQL: Can't load '/usr/local/lib64/perl5/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.16: 无法打开共享对象文件: 没有那个文件或目录 at /usr/lib64/perl5/DynaLoader.pm line 200.
at /usr/local/share/perl5/MogileFS/Store/MySQL.pm line 5
Compilation failed in require at /usr/local/share/perl5/MogileFS/Store/MySQL.pm line 5.
BEGIN failed--compilation aborted at /usr/local/share/perl5/MogileFS/Store/MySQL.pm line 5.
Compilation failed in require at (eval 10) line 1.
3:创建配置文件的目录和Tracker配置文件 比如在/usr/common下面 mkdirmogilefs文件夹,在下面nanomogilefsd.conf
文 件,基本内容如下:
# Database connection information
db_dsn = DBI:mysql:MogileFS:host=localhost
db_user = mogile
db_pass = cc
# IP:PORT to listen on for MogileFSclient requests
listen = 0.0.0.0:7001
# Optional, if you don't define the port above.
conf_port = 7001
# Number of query workers to start by default.
query_jobs = 10
# Number of delete workers to start by default.
delete_jobs = 1
# Number of replicate workers to start by default.
replicate_jobs = 5
# Number of reaper workers to start by default.
# (you don't usually need to increase this)
reaper_jobs = 1
注意: "="之间一定拿空格隔开,否则会报错,错误内容:
Malformed config file (line 2) at /usr/local/share/perl5/MogileFS/Config.pm line 136, <$cf> line 2.
主要就是刚才写的配置文件有误
4:由于mogilefsd不能用root用户启动,所以添加mogile用户,并使用它来启动调度器
adduser mogile
su mogile
mogilefsd -c /usr/common/mogilefs/mogilefsd.conf --daemon
可ps看看mogilefsd的进程,能看到他启动了那些组件,分别做什么作用
ps-ef|grep mogilefsd
终止服务:pkill mogilefsd
5:存储节点配置,创建一个storage.conf文件,内容如下:
maxconns= 10000 //最大连接数
httplisten= 0.0.0.0:7500 //监听的http服务的地址
mgmtlisten= 0.0.0.0:7501 //管理的监听
docroot=/usr/common/mogilefs/mogilefsdata/ //指定真实上传的文件的起始位置
数据存在什么根路径是由docroot来设置的
注意:在/usr/common/mogilefs/目录下创建文件夹mogilefsdata,用来存储数据文件
6:启动存储节点,这个可以用root用户
mogstored -c /usr/common/mogilefs/storage.conf --daemon
停止:pkill mogstored
安装步骤如下
1:需要先安装MySql,
2:安装MySql的开发包devel,下载了MySQL-devel-5.5.25-1.rhel5.i386.rpm,
安装: rpm -ivh MySQL-devel-5.5.25-1.rhel5.i386.rpm
3:安装MySql的share包,下载了MySQL-shared-5.6.19-1.rhel5.i386.rpm,
安装: rpm -ivh MySQL-shared-5.6.19-1.rhel5.i386.rpm 安装后可以使用 rpm -qa|grep-i mysql 来查看安装的包
4:需要有Perl的环境,服务器已经自带了5.8.8版本的
5:安装CPANMinus wget http://xrl.us/cpanm --no-check-certificate -O /sbin/cpanm然后授权chmod+x /sbin/cpanm 或者wget-O- http://cpanmin.us --no-check-certificate | perl---sudo--self-upgrade 这个会自动安装到/usr/bin/cpanm 6:利用cpanm来安装MogileFS的Perl模块,依次按照如下步骤
(1):cpanm DBD::mysql
(2):cpanm MogileFS::Server
(3):cpanm MogileFS::Utils
(4):cpanm MogileFS::Client
基本配置步骤如下
1:在MySql数据库中创建MogileFS要使用的数据库和用户名
CREATE DATABASE MogileFSDEFAULT CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL ON MogileFS.* TO 'mogile'@'%' IDENTIFIED BY 'mogile'; UPDATE mysql.userSET Password=PASSWORD('cc') where USER='mogile'; FLUSH PRIVILEGES; //刷新数据库
2:配置和初始化数据库
./mogdbsetup--dbhost=localhost--dbname=MogileFS--dbuser=mogile--dbpass=cc
安装时遇到如下问题:
Failed to load MogileFS::Store::MySQL: Can't load '/usr/local/lib64/perl5/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.16: 无法打开共享对象文件: 没有那个文件或目录 at /usr/lib64/perl5/DynaLoader.pm line 200.
at /usr/local/share/perl5/MogileFS/Store/MySQL.pm line 5
Compilation failed in require at /usr/local/share/perl5/MogileFS/Store/MySQL.pm line 5.
BEGIN failed--compilation aborted at /usr/local/share/perl5/MogileFS/Store/MySQL.pm line 5.
Compilation failed in require at (eval 10) line 1.
BEGIN failed--compilation aborted at (eval 10) line 1.
这个问题是因为没有安装perl连接mysql的驱动引起的,安装perl-DBD-MySQL即可。
通过命令:yum install perl-DBD-MySQL
根据下面的命令查看mysql的安装情况
rpm -qa|grep -i mysql
3:创建配置文件的目录和Tracker配置文件 比如在/usr/common下面 mkdirmogilefs文件夹,在下面nanomogilefsd.conf
文 件,基本内容如下:
# Database connection information
db_dsn = DBI:mysql:MogileFS:host=localhost
db_user = mogile
db_pass = cc
# IP:PORT to listen on for MogileFSclient requests
listen = 0.0.0.0:7001
# Optional, if you don't define the port above.
conf_port = 7001
# Number of query workers to start by default.
query_jobs = 10
# Number of delete workers to start by default.
delete_jobs = 1
# Number of replicate workers to start by default.
replicate_jobs = 5
# Number of reaper workers to start by default.
# (you don't usually need to increase this)
reaper_jobs = 1
注意: "="之间一定拿空格隔开,否则会报错,错误内容:
Malformed config file (line 2) at /usr/local/share/perl5/MogileFS/Config.pm line 136, <$cf> line 2.
![](https://i-blog.csdnimg.cn/blog_migrate/567ca6f656e40e9f791fa396a5b2ce2b.png)
主要就是刚才写的配置文件有误
4:由于mogilefsd不能用root用户启动,所以添加mogile用户,并使用它来启动调度器
adduser mogile
su mogile
mogilefsd -c /usr/common/mogilefs/mogilefsd.conf --daemon
可ps看看mogilefsd的进程,能看到他启动了那些组件,分别做什么作用
ps-ef|grep mogilefsd
终止服务:pkill mogilefsd
5:存储节点配置,创建一个storage.conf文件,内容如下:
maxconns= 10000 //最大连接数
httplisten= 0.0.0.0:7500 //监听的http服务的地址
mgmtlisten= 0.0.0.0:7501 //管理的监听
docroot=/usr/common/mogilefs/mogilefsdata/ //指定真实上传的文件的起始位置
数据存在什么根路径是由docroot来设置的
注意:在/usr/common/mogilefs/目录下创建文件夹mogilefsdata,用来存储数据文件
6:启动存储节点,这个可以用root用户
mogstored -c /usr/common/mogilefs/storage.conf --daemon
停止:pkill mogstored