[转]安装 mogilefs 测试系统,在一台机器上,用于测试环境

 

安装 mogilefs 测试系统,在一台机器上,用于测试环境

一 下载
wget http://www.danga.com/dist/Sys-Syscall/Sys-Syscall-0.20.tar.gz
wget http://www.danga.com/dist/Perlbal/Perlbal-1.41.tar.gz
wget http://www.danga.com/dist/Danga-Socket/Danga-Socket-1.48.tar.gz
wget http://www.danga.com/dist/MogileFS/server/mogilefs-server-1.00.tar.gz
wget http://www.danga.com/dist/MogileFS/server/patches/fid-no-reuse-patch.txt
也可以直接从cvs中下,据说cvs中的代码也是很稳定的

wget http://search.cpan.org/CPAN/authors/id/J/JH/JHI/BSD-Resource-1.24.tar.gz

export CVSROOT=:pserver:[email protected]:/home/cvspub
cvs login
cvs co wcmtools/mogilefs

wget http://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/Linux-AIO-1.9.tar.gz

wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-3.0002.tar.gz

wget http://search.cpan.org/CPAN/authors/id/M/MU/MUIR/modules/Net-Netmask-1.9012.tar.gz
二 安装

pelr Makefile.PL
make
make test
make install

aio  make test 出现了错误

三配置
由于没有空的分区了,用一个文件代替
dd if=/dev/zero of=disk-image10  count=409600
dd if=/dev/zero of=disk-image20  count=409600
dd if=/dev/zero of=disk-image30  count=409600
mkfs.ext3 disk-image10
mkfs.ext3 disk-image20
mkfs.ext3 disk-image30

四 配置数据库

CREATE DATABASE `mogile` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

CREATE USER ’mogile’@ ’localhost’ IDENTIFIED BY ’******’;

GRANT USAGE ON * . * TO ’mogile’@ ’localhost’ IDENTIFIED BY ’******’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

GRANT ALL PRIVILEGES ON `mogile` . * TO ’mogile’@’localhost’ WITH GRANT OPTION ;

建立基本的表

-- MySQL dump 9.11
--
-- Host: localhost    Database: mogilefs
-- ------------------------------------------------------
-- Server version       4.0.24_Debian-10sarge1-log

--
-- Table structure for table `class`
--

CREATE TABLE `class` (
  `dmid` smallint(5) unsigned NOT NULL default ’0’,
  `classid` tinyint(3) unsigned NOT NULL default ’0’,
  `classname` varchar(50) default NULL,
  `mindevcount` tinyint(3) unsigned NOT NULL default ’0’,
  PRIMARY KEY  (`dmid`,`classid`),
  UNIQUE KEY `dmid` (`dmid`,`classname`)
) TYPE=MyISAM;


-- Table structure for table `device`
--

CREATE TABLE `device` (
  `devid` mediumint(8) unsigned NOT NULL default ’0’,
  `hostid` mediumint(8) unsigned NOT NULL default ’0’,
  `status` enum(’alive’,’dead’,’down’,’readonly’) default NULL,
  `weight` mediumint(9) default ’100’,
  `mb_total` mediumint(8) unsigned default NULL,
  `mb_used` mediumint(8) unsigned default NULL,
  `mb_asof` int(10) unsigned default NULL,
  PRIMARY KEY  (`devid`),
  KEY `status` (`status`)
) TYPE=MyISAM;

--
-- Table structure for table `domain`
--

CREATE TABLE `domain` (
  `dmid` smallint(5) unsigned NOT NULL default ’0’,
  `namespace` varchar(255) default NULL,
  PRIMARY KEY  (`dmid`),
  UNIQUE KEY `namespace` (`namespace`)
) TYPE=MyISAM;

--
-- Dumping data for table `domain`

--
-- Table structure for table `file`
--

CREATE TABLE `file` (
  `fid` int(10) unsigned NOT NULL default ’0’,
  `dmid` smallint(5) unsigned NOT NULL default ’0’,
  `dkey` varchar(255) default NULL,
  `length` int(10) unsigned default NULL,
  `classid` tinyint(3) unsigned NOT NULL default ’0’,
  `devcount` tinyint(3) unsigned NOT NULL default ’0’,
  PRIMARY KEY  (`fid`),
  UNIQUE KEY `dkey` (`dmid`,`dkey`),
  KEY `devcount` (`dmid`,`classid`,`devcount`)
) TYPE=MyISAM;

--
-- Dumping data for table `file`
--


--
-- Table structure for table `file_on`
--

CREATE TABLE `file_on` (
  `fid` int(10) unsigned NOT NULL default ’0’,
  `devid` mediumint(8) unsigned NOT NULL default ’0’,
  PRIMARY KEY  (`fid`,`devid`),
  KEY `devid` (`devid`)
) TYPE=MyISAM;

--
-- Dumping data for table `file_on`
--


--
-- Table structure for table `file_on_corrupt`
--

CREATE TABLE `file_on_corrupt` (
  `fid` int(10) unsigned NOT NULL default ’0’,
  `devid` mediumint(8) unsigned NOT NULL default ’0’,
  PRIMARY KEY  (`fid`,`devid`)
) TYPE=MyISAM;

--
-- Dumping data for table `file_on_corrupt`
--


--
-- Table structure for table `file_to_delete`
--

CREATE TABLE `file_to_delete` (
  `fid` int(10) unsigned NOT NULL default ’0’,
  PRIMARY KEY  (`fid`)
) TYPE=MyISAM;

--
-- Dumping data for table `file_to_delete`

--
-- Table structure for table `host`
--

CREATE TABLE `host` (
  `hostid` mediumint(8) unsigned NOT NULL default ’0’,
  `status` enum(’alive’,’dead’,’down’) default NULL,
  `http_port` mediumint(8) unsigned default ’7500’,
  `http_get_port` mediumint(8) unsigned default NULL,
  `hostname` varchar(40) default NULL,
  `hostip` varchar(15) default NULL,
  `altip` varchar(15) default NULL,
  `altmask` varchar(18) default NULL,
  `remoteroot` varchar(60) default NULL,
  PRIMARY KEY  (`hostid`),
  UNIQUE KEY `hostname` (`hostname`),
  UNIQUE KEY `hostip` (`hostip`),
  UNIQUE KEY `altip` (`altip`)
) TYPE=MyISAM;

--
-- Dumping data for table `host`
--


--
-- Table structure for table `server_settings`

CREATE TABLE `server_settings` (
  `field` varchar(50) NOT NULL default ’’,
  `value` varchar(255) default NULL,
  PRIMARY KEY  (`field`)
) TYPE=MyISAM;

--
-- Dumping data for table `server_settings`
--

INSERT INTO `server_settings` VALUES (’schema_version’,’5’);

--
-- Table structure for table `tempfile`
--

CREATE TABLE `tempfile` (
  `fid` int(10) unsigned NOT NULL auto_increment,
  `createtime` int(10) unsigned NOT NULL default ’0’,
  `classid` tinyint(3) unsigned NOT NULL default ’0’,
  `dmid` smallint(5) unsigned NOT NULL default ’0’,
  `dkey` varchar(255) default NULL,
  `devids` varchar(60) default NULL,
  PRIMARY KEY  (`fid`)
) TYPE=MyISAM;

--
-- Dumping data for table `tempfile`


--
-- Table structure for table `unreachable_fids`
--

CREATE TABLE `unreachable_fids` (
  `fid` int(10) unsigned NOT NULL default ’0’,
  `lastupdate` int(10) unsigned NOT NULL default ’0’,
  PRIMARY KEY  (`fid`),
  KEY `lastupdate` (`lastupdate`)
) TYPE=MyISAM;

--
-- Dumping data for table `unreachable_fids`
--




运行 ./mogdbsetup


建立初始环境

telnet localhost 6001

create_domain domain=domain_test01
create_class domain=domain_test01&class=fileclass_test01&mindevcount=2



create_host 没有成功,直接修改数据库
INSERT INTO `host` ( `hostid` , `status` , `http_port` , `http_get_port` , `hostname` , `hostip` , `altip` , `altmask` , `remoteroot` )
VALUES (
create_device devid=20&hostid=10&status=alive&weight=10&mb_total=200&mb_used=0
create_device devid=30&hostid=10&status=alive&weight=10&mb_total=200&mb_used=0



mount /home/wuhao/disk-image10  dev10/ -o loop
mount /home/wuhao/disk-image20  dev20/ -o loop
mount /home/wuhao/disk-image30  dev30/ -o loop


mkdir -p dev10/0/000/000/
mkdir -p dev20/0/000/000/
mkdir -p dev30/0/000/000/

运行自己的测试程序 OK
 

’10’ , ’alive’ , ’7500’ , NULL , ’storage01.mogilfs.bokee.net’ , ’192.168.0.129’ , NULL , NULL , NULL
) ;

create_device devid=10&hostid=10&status=alive&weight=10&mb_total=200&mb_used=0
Source: http://hzlinux.blog.bokee.net/bloggermodule/blog_viewblog.do?id=87397

你可能感兴趣的:(File,测试,table,null,domain,structure)