2017年1月4日水曜日

HDP SandboxにHUEをインストールする

1)何がインストールされているか確認
[root@sandbox ~]# yum list installed | grep -i hue
Failed to set locale, defaulting to C
hue.x86_64                              2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-beeswax.x86_64                      2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-common.x86_64                       2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-hcatalog.x86_64                     2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-oozie.x86_64                        2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-pig.x86_64                          2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-sandbox.noarch                      1.2.1-88                      @sandbox
hue-server.x86_64                       2.6.1.2.4.0.0-169.el6         @HDP-2.4
hue-tutorials.noarch                    1.2.1-88                      @sandbox

2)アンインストール
[root@sandbox ~]# yum remove hue hue-common
...
[root@sandbox ~]# yum list installed | grep -i hue
Failed to set locale, defaulting to C
[root@sandbox ~]#

3)適当にレポファイルを変更 (例は2.5.3.0)
[root@sandbox ~]# sed -i.bak 's@^baseurl=.*$@baseurl=http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.3.0@' /etc/yum.repos.d/HDP.repo

4)HDP2.5.3のHUEをインストール
[root@sandbox ~]# yum clean all
[root@sandbox ~]# yum install hue

5)/etc/hue/conf/hue.iniを編集する
localhostをsandbox.hortonworks.comに変更する

まとめ:

# まず、Repoファイルを確認(不必要なファイルは取り除く):
grep -E 'HDP-[23]' /etc/yum.repos.d/*

_os_type="centos6"
_hdp_ver="`hdp-select versions | tail -n 1 | cut -d '-' -f 1`"
_repo="`grep -lE 'HDP-[23]' /etc/yum.repos.d/*`"
_user="root"

service hue stop
yum remove hue hue-common -y
sed -i.bak "s/^baseurl=.*$/baseurl=http:\/\/public-repo-1.hortonworks.com\/HDP\/${_os_type}\/2.x\/updates\/${_hdp_ver}/" ${_repo}
#yum clean all
yum install hue -y
#mv -f /etc/yum.repos.d/${_repo}.bak /etc/yum.repos.d/${_repo}
sed -i.bak "s/localhost/`hostname -f`/g" /etc/hue/conf/hue.ini
sed -i "s/server_user=hue$/server_user=${_user}/" /etc/hue/conf/hue.ini
sed -i.bak "s/^USER=hue$/USER=${_user}/" /etc/init.d/hue
chown -R ${_user}:hadoop /usr/lib/hue
service hue start # or restart




補足:データベースをHiveで使っているMySQLに変更する


[root@sandbox ~]# mysql -u root -h localhost -phadoop

mysql> create user hue identified by 'hue';
Query OK, 0 rows affected (0.23 sec)

mysql> grant all privileges on *.* to 'hue'@'localhost' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on hue.* to 'hue'@'localhost' identified by 'hue'
    -> ;
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> ^DBye

[root@sandbox ~]# mysql -u hue -phue

mysql> create database hue;
Query OK, 1 row affected (0.12 sec)

mysql> ^DBye


[root@sandbox ~]# service hue stop

[root@sandbox ~]# /usr/lib/hue/build/env/bin/hue dumpdata > /tmp/hue_db_dump.json

[root@sandbox ~]# vim /etc/hue/conf/hue.ini
    engine=mysql
    host=localhost
    ## host=sandbox.hortonworks.com
    port=3306
    user=hue
    password=hue
    name=hue

su - hue
cd /usr/lib/hue
source build/env/bin/activate
hue syncdb --noinput
hue migrate
hue loaddata /tmp/hue_db_dump.json
deactivate


NOTE: if python error: ibmysqlclient_r.so.16: cannot open shared object file: No such file or directory
(env)[root@sandbox hue]# pip uninstall mysql-python
(env)[root@sandbox hue]# yum install mysql-devel
(env)[root@sandbox hue]# pip install mysql-python

NOTE2: IntegrityError: (1062, "Duplicate entry 'oozie-bundle' for key 'app_label'")
mysqldump -uhue -phue hue > /tmp/hue.sql
(env)-bash-4.1$ mysql -uhue -phue -e 'SET GLOBAL foreign_key_checks=0;DELETE FROM hue.django_content_type;'
Then immediately set to 1

0 件のコメント:

コメントを投稿