数据仓库工具安装使用

【工具安装和配置】 infobright安装和配置

2017-12-14  本文已影响48人  开心跳蚤

安装infobright
在usr目录下创建新目录infobright目录,将我们下载的安装文件infobright-4.0.7-0-linux_x86_64-ice.rpm放到此目录下,打开终端,切换到infobright目录下:

[root@localhost /]# cd /usr/infobright/
[root@localhost infobright]# ls
infobright-4.0.7-0-linux_x86_64-ice.rpm
[root@localhost infobright]#

然后执行安装命令:

[root@localhost infobright]# rpm -ivh  infobright-4.0.7-0-linux_x86_64-ice.rpm --prefix=/usr/infobright/

执行后显示如下信息:

准备中...                          ################################# [100%]
Installing infobright 4.0.7-0 (x86_64)
The installer will generate /tmp/ib4.0.7-0-install.log install trace log.
正在升级/安装...
   1:infobright-4.0.7-0               ################################# [100%]
Creating/Updating datadir and cachedir
Creating user mysql and group mysql
Installing default databases
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/infobright/infobright-4.0.7-x86_64/bin/mysqladmin -u root password 'new-password'
/usr/infobright/infobright-4.0.7-x86_64/bin/mysqladmin -u root -h localhost password 'new-password'

Alternatively you can run:
/usr/infobright/infobright-4.0.7-x86_64/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/infobright/infobright-4.0.7-x86_64 ; /usr/infobright/infobright-4.0.7-x86_64/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/infobright/infobright-4.0.7-x86_64/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/infobright/infobright-4.0.7-x86_64/scripts/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

System Physical memory: 2000(MB)
Infobright optimal ServerMainHeapSize is set to 600(MB)
Infobright optimal LoaderMainHeapSize is set to 320(MB)
Infobright server installed into folder /usr/infobright/infobright
Installation log file /tmp/ib4.0.7-0-install.log
--------------------------------------
To activate infobright server, please run ./postconfig.sh script from /usr/infobright/infobright-4.0.7-x86_64.
Example command: cd /usr/infobright/infobright-4.0.7-x86_64; ./postconfig.sh

通过阅读上述打印信息,我们可以获知很多操作提示(已经告知我们详细的操作命令,在此不在赘述);安装完成后,我们需要执行命令./postconfig.sh

[root@localhost infobright]# cd /usr/infobright/infobright-4.0.7-x86_64
[root@localhost infobright-4.0.7-x86_64]# ./postconfig.sh

提示是否注册,选择“N”,不注册。

启动infobright

[root@localhost infobright-4.0.7-x86_64]# /etc/init.d/mysqld-ib start
Starting MySQL. SUCCESS! 
[root@localhost infobright-4.0.7-x86_64]# 

停止infobright

[root@localhost infobright-4.0.7-x86_64]# /etc/init.d/mysqld-ib stop
Shutting down MySQL. SUCCESS! 
[root@localhost infobright-4.0.7-x86_64]# 

卸载infobright

[root@localhost ~]# rpm -e infobright

设置进入infobright的root用户的密码

[root@localhost infobright-4.0.7-x86_64]# bin/mysqladmin -u root password '123456'
Warning: bin/mysqladmin: unknown variable 'loose-local-infile=1'

进入infobright

[root@localhost infobright-4.0.7-x86_64]# mysql-ib -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.40 build number (revision)=IB_4.0.7_r16961_17249(ice) (static)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

如果不设置进入infobright的用户名和密码,则可以直接使用命令mysql-ib进入上述界面。

应用:

mysql> create database warehouse;

mysql> use warehouse
Database changed
mysql> create table user( 
      user_id int(10) not null, 
      user_name varchar(20) not null, 
      age int(30) not null 
)ENGINE=BRIGHTHOUSE DEFAULT CHARSET=UTF8;

mysql> select * from user;

mysql> 

使用的引擎是 BRIGHTHOUSE 主键,为空,自动递增...此引擎都不支持。

导入数据

load data  [low_priority] [local] infile 'file_name txt' [replace | ignore]
into table tbl_name
[fields
[terminated by't']
[OPTIONALLY] enclosed by '']
[escaped by'\' ]]
[lines terminated by'n']
[ignore number lines]
[(col_name,   )]

low_priority:那么MySQL将会等到没有其他人读这个表的时候,才把插入数据;
replace和ignore:控制对现有的唯一键记录的重复的处理。如果你指定replace,新行将代替有相同的唯一键值的现有行。如果你指定ignore,跳过有唯一键的现有行的重复行的输入。如果你不指定任何一个选项,当找到重复键时,出现一个错误,并且文本文件的余下部分被忽略;
fields:关键字指定了文件字段的分割格式:
terminated by:是以什么字符作为分隔符;
enclosed by:字段括起字符;
lines:指定了每条记录的分隔符默认为'\n'即为换行符;

新建数据文件 info.txt

10001,"Tom",10
10002,"Jean",11
10003,"jerry",5

将文本中的数据导入到数据仓库的表中

mysql> load data infile '/usr/infobright/info.txt' ignore into table user character set utf8 fields terminated by ',' enclosed by '"' lines terminated by '\n';

Query OK, 3 rows affected (0.07 sec)
Records: 3  Deleted: 0  Skipped: 0  Warnings: 0

查询数据是否插入成功:

mysql> select * from user;
+---------+-----------+-----+
| user_id | user_name | age |
+---------+-----------+-----+
|   10001 | Tom       |  10 |
|   10002 | Jean      |  11 |
|   10003 | jerry     |   5 |
+---------+-----------+-----+
3 rows in set (0.00 sec)
上一篇下一篇

猜你喜欢

热点阅读