基于MySQL和Infobright的数据仓库技术

来源:这里教程网 时间:2026-02-27 12:43:22 作者:

用户设置ulimit -SHn 65535mkdir -p /home/mysql/infobright/usr/sbin/groupadd mysql/usr/sbin/useradd -g mysql mysqlcd /usr/

用户设置
ulimit -shn 65535
mkdir -p /home/mysql/infobright
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
cd /usr/local/soft/

下载解压
64位系统
wget
tar zxvf infobright-3.3.1-x86_64-ice.tar.gz
mv infobright-3.3.1-x86_64 infobright

32位系统
wget
tar zxvf infobright-3.3.1-i686-ice.tar.gz
mv infobright-3.3.1-i686 infobright

安装步骤
cd infobright
./install-infobright.sh --datadir=/home/mysql/infobright/data --cachedir=/home/mysql/infobright/cache --config=/home/mysql/infobright/my.cnf --port=3307 --socket=/tmp/mysqlinfobright.sock --user=mysql --group=mysql

内存限制
vi /home/mysql/infobright/data/brighthouse.ini

启动与停止
cd /usr/local/infobright/; ./bin/mysqld_safe --defaults-file=/home/mysql/infobright/my.cnf 2>&1 > /dev/null &
cd /usr/local/infobright/; ./bin/mysqladmin -uroot -p -s /tmp/mysqlinfobright.sock shutdown
/usr/local/infobright/bin/mysql -s /tmp/mysqlinfobright.sock

测试导出
/usr/local/mysql/bin/mysql -uroot -p -dt2011 -e "select username,user_id,regtime into outfile '/home/test.csv' fields terminated by ',' enclosed by '"'  escaped by '\' lines terminated by ' ' from users limit 300;"

测试导入
/usr/local/infobright/bin/mysql -s /tmp/mysqlinfobright.sock -uroot -p  -dt2011_logs --skip-column-names -e "load data infile '/home/test.csv' into table access_log fields terminated by ',' escaped by '\' lines terminated by ' ';"

设置权限
/usr/local/mysql/bin/mysql -uroot
/usr/local/infobright/bin/mysql -s /tmp/mysqlinfobright.sock
grant all privileges on *.* to 'addcn'@'localhost' identified by '123456';
set password for 'addcn'@'localhost' = old_password('addcn2011');
flush privileges;

grant all privileges on *.* to 'addcn'@'%' identified by '123456';
set password for 'addcn'@'%' = old_password('addcn2011');

/usr/local/infobright/bin/mysql -s /tmp/mysqlinfobright.sock -uaddcn -paddcn2011  -dt2011_logs --skip-column-names -e "load data infile '/home/test.csv' into table access_log fields terminated by ',' escaped by '\' lines terminated by ' ';"

其它数据
create database `t2011_logs` ;
create table `access_log` (
  `sid` varchar(50) not null,
  `user_id` int(11) not null,
  `timestamp` int(11) not null
) engine=brighthouse default charset=latin1;

1,1001,1282815666
2,1002,1282815668
3,1003,1282815675
load data infile '/home/test.csv' into table `access_log` fields terminated by ',' escaped by '' lines terminated by ' ';

select * from access_log;

压缩比例:
1,660,546数据,,1498mb后为56179kb
1 533 952 / 56 179 = 27.3047224

内容超出字段类型:
error 2 (hy000) at line 1: wrong data or column definition. row: 3, field: 16.

相关推荐