最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
CentOS 6.6 安装 Infobright 教程详解
时间:2022-06-30 21:06:53 编辑:袖梨 来源:一聚教程网
infobright 是基于mysql的,但不装mysql亦可,因为它本身就自带了一个。mysql可以粗分为逻辑层和物理存储引擎,infobright主要实现的就是一个存储引擎,但因为它自身存储逻辑跟关系型数据库根本不同,所以,它不能像InnoDB那样直接作为插件挂接到mysql,它的逻辑层是mysql的逻辑 层加上它自身的优化器。
Infobright是一个非常强大的列式存储数据库,先前的文章也介绍过。本次主要是针对Infobright的具体安装的记录。中间有可能存在遗漏的,供以后再做完善。
由于Infobright官方已经提供好了rpm的包,所以安装起来相对来说较为简单:
cd /usr/local/src
wget http://www.infobright.org/downloads/ice/infobright-4.0.7-0-x86_64-ice.rpm
rpm -ivh infobright-4.0.7-0-x86_64-ice.rpm
默认情况下,infobright会安装到/usr/local/infobright-4.0.7-0-x86_64,可以通过添加–prefix参数指定安装目录,如:
rpm -ivh infobright-4.0.7-0-x86_64-ice.rpm --prefix=/usr/local/infobright
这样就会安装到/usr/local/infobright/infobright-4.0.7-0-x86_64。
对于整个安装过程,相当的简单,比较繁琐的是对于相关参数的设置:
A、配置内存大小
vim /usr/local/infobright-4.0.7-x86_64/data/brighthouse.ini
修改内存的配置可参加其建议值进行设置:
############ Critical Memory Settings ############
# System Memory Server Main Heap Size Server Compressed Heap Size Loader Main Heap Size
# 32GB 24000 4000 800
# 16GB 10000 1000 800
# 8GB 4000 500 800
# 4GB 1300 400 400
# 2GB 600 250 320
B、系统自带配置功能
sh /usr/local/infobright-4.0.7-x86_64/postconfig.sh
这个脚本可以改变datadir,cachedir,socket,port等配置,需要root来执行,执行后返回的信息如下:(如无需修改,则全部N即可)
Infobright post configuration
--------------------------------------
Using postconfig you can:
--------------------------------------
(1) Move existing data directory to other location,
(2) Move existing cache directory to other location,
(3) Configure server socket,
(4) Configure server port,
(5) Relocate datadir path to an existing data directory.
Please type 'y' for option that you want or press ctrl+c for exit.
Current configuration:
--------------------------------------
Current config file: [/etc/my-ib.cnf]
Current brighthouse.ini file: [/usr/local/infobright-4.0.7-x86_64/data/brighthouse.ini]
Current datadir: [/usr/local/infobright-4.0.7-x86_64/data]
Current CacheFolder in brighthouse.ini file: [/usr/local/infobright-4.0.7-x86_64/cache]
Current socket: [/tmp/mysql-ib.sock]
Current port: [5029]
--------------------------------------
(1) Do you want to copy current datadir [/usr/local/infobright-4.0.7-x86_64/data] to a new location? [y/n]:n
(2) Do you want to move current CacheFolder [/usr/local/infobright-4.0.7-x86_64/cache] to a new location? [y/n]:n
(3) Do you want to change current socket [/tmp/mysql-ib.sock]? [y/n]:n
(4) Do you want to change current port [5029]? [y/n]:n
(5) Do you want to relocate to an existing datadir? Current datadir is [/usr/local/infobright-4.0.7-x86_64/data]. [y/n]:n
--------------------------------------
--------------------------------------
No changes has been made.
--------------------------------------
C、设置字符集
infobright默认情况下不支持中文,为了更好的支持中文,需要设置默认的字符集。
vim /etc/my-ib.cnf
找到如下内容
collation_server=latin1_bin
character_set_server=latin1
将其修改为:
collation_server=utf8_bin
character_set_server=utf8
D、安装启动脚本
cp /usr/local/infobright-4.0.7-x86_64/share/mysql/mysql.server /etc/init.d/mysqld-ib
vim /etc/init.d/mysqld-ib
找到如下两行代码:
conf=@BH_CONF@
user=@BH_USER@
修改为:
conf=/etc/my-ib.cnf
user=mysql
上面的配置文件中使用了 mysql 用户,在配置完成后需要确定下mysql用户是否真的存在:
cat /etc/passwd | grep mysql
如果不存在,则需要执行如下内容进行用户的添加:
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
接下来就试着启动infobright
/etc/init.d/mysql-ib start
系统无法启动,显示如下信息,:
Starting MySQL/etc/init.d/mysqld-ib: line 175: lsb_release: command not found
........ ERROR!
要解决如上问题执行如下操作即可:
yum install -y redhat-lsb
重新执行启动命令后还是存在报错:
Starting MySQL........ [FAILED]
查看错误日志:
cat /usr/local/infobright-4.0.7-x86_64/data/bh.err
错误日志中的内容为:
150312 18:20:15 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
初步判断是mysql没有权限,可能安装的时候使用的是root安装,具体怎么修改权限暂时未搞通,暂时的方案是修改/etc/init.d/mysqld-ib文件中的user为root,修改后即可正常运行。
相关的其他指令:
/etc/init.d/mysqld-ib stop
/etc/init.d/mysqld-ib restart
添加开机启动:
chkconfig --add mysqld-ib
E、Mysql安全设置
PATH=$PATH:/usr/local/infobright-4.0.7-x86_64/bin
mysql_secure_installation
执行完指令后就会进入的相关设置的引导页面:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
完成后再给mysql添加一个远程连接的账号,只想如下命令进入mysql client:
mysql -uroot -p
添加完远程用户方法如下:
GRANT ALL PRIVILEGES ON *.* TO 'infobright'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
至此配置基本完成,可以使用SQLyog尝试连接下。
CREATE DATABASE `dw`CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE `dw`.`dim_day`( `DateKey` INT, `CalDate` DATE, `CalYear` INT, `CalQuarter` VARCHAR(8), `CalMonth` INT, `CalWeek` VARCHAR(8), `CalDay` INT, `Holiday` VARCHAR(8), `YearQuarter` VARCHAR(8), `YearMonth` INT ) ENGINE=BRIGHTHOUSE CHARSET=utf8 COLLATE=utf8_bin;
LOAD DATA LOCAL INFILE 'C:\Users\biaodianfu\Desktop\dim_day.csv' INTO TABLE `dw`.`dim_day` CHARACTER SET 'utf8' FIELDS ESCAPED BY '\' TERMINATED BY ',' LINES TERMINATED BY 'n' (`DateKey`, `CalDate`, `CalYear`, `CalQuarter`, `CalMonth`, `CalWeek`, `CalDay`, `Holiday`, `YearQuarter`, `YearMonth`);
需要主要的是:为了不出现中文乱码问题,不管是创建库还是创建表,亦或是导入数据,都需要制定字符集。
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20