CentOS 6.6 安裝 Infobright 教程詳解

來源:互聯網
上載者:User

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`);
需要主要的是:為了不出現中文亂碼問題,不管是建立庫還是建立表,亦或是匯入資料,都需要制定字元集。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.