目录
1. 安装前准备
1.1下载Hue安装包
1.2安装依赖
2.安装Hue
2.1Hue纳入Ambari的管理
2.2版本修改
2.3重启Ambari Server
2.4通过Ambari界面来安装Hue
2.5安装Hue
2.6手动安装Hue
2.7修改Hue配置文件hue.ini
2.8生成Hue数据库表
2.9其他组件配置修改
2.10启动Hue
2.11登录Hue
2.12安装参考链接
3.整合问题
问题1
问题2
问题3
1. 安装前准备
1.1下载Hue安装包
环境:
Ambari:2.5.2.0
HDP:2.6.2.0
HDP-UTILS:1.1.0.21
Centos6.7
Hue下载地址:http://gethue.com/downloads/releases/3.12.0/hue-3.12.0.tgz
下载后,将文件拷贝到本地yum源的/var/www/html/HDP/centos6/hue/目录下。
1.2在Hue安装节点安装依赖
yum install -y ant
yum install -y gcc g++
yum install -y libkrb5-dev libmysqlclient-dev
yum install -y libssl-dev libsasl2-dev libsasl2-modules-gssapi-mit
yum install -y libsqlite3-dev
yum install -y libtidy-0.99-0 libxml2-dev libxslt-dev
yum install -y maven
yum install -y libldap2-dev
yum install -y python-dev python-simplejson python-setuptools
没安装成功的,不需要管。
2. 安装Hue
2.1Hue纳入Ambari的管理
在主节点上执行如下三个命令
①.VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'`
②.rm -rf /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE
③.sudo git clone https://github.com/EsharEditor/ambari-hue-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE
2.2版本修改
上一步下载下来的文件中涉及到的Hue版本与所要安装的Hue版本(3.12)是不一致的。所以需要修改相关文件。
涉及到版本的文件如下:
metainfo.xml
README.md
package/scripts/params.py
package/scripts/setup_hue.py
将3.11.0替换成3.12.0即可
2.3重启Ambari Server
在主节点执行命令:service ambari-server restart
2.4通过Ambari界面来安装Hue
重启Ambari Server后就能发现,可安装的服务中有Hue了。
2.5选择Hue,安装
安装前,需要在MySQL上创建Hue数据库。
这个过程中,Hue安装成功,但是启动失败。实际原因还是因为Hue没有安装成功。
Hue的默认安装在机器的/usr/local/hue目录下。失败后,需要进行手动安装。
2.6手动安装Hue
进入部署Hue的节点上,将/usr/local/hue目录下所有文件删除。将/usr/local/hue-3.12.0目录删除。
执行命令:
chown -R hue:hue /usr/local/hue
chmod -R 777 /usr/local/hue
将hue-3.12.0.tgz解压缩到/usr/local/目录下。
进入/usr/local/hue-3.12.0目录,执行命令:make install
一切正常同时/usr/local/hue/build/env/bin/目录如下就表明安装成功。
2.7修改Hue配置文件hue.ini
配置文件在/usr/local/hue/desktop/conf/目录下。从头到尾配置。需要配置mysql、hive、hdfs、webhdfs、yarn等等。
2.8生成hue数据库表
进入/usr/local/hue/build/env/bin/目录,执行如下两条命令:
hue syncdb
hue migrate
如果hue数据库中类似如下,那么说明成功:
2.9其他组件配置修改
l Hadoop配置
在Custom hdfs-site添加如下两个配置:
hadoop.proxyuser.hue.groups=*
hadoop.proxyuser.hue.hosts=*
同时开启webhdfs
2.10启动Hue
在Ambari界面启动Hue
2.11登录Hue
用户名、密码:hue
2.12安装参考链接
http://gethue.com/hadoop-hue-3-on-hdp-installation-tutorial/
http://blog.csdn.net/lusyoe/article/details/72896480
https://github.com/EsharEditor/ambari-hue-service
3.整合问题
问题1:启动Hue失败,报编码问题UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 3462: ordinal not in range(128)
解决办法:在Hue安装节点上修改sudo.py
vim /usr/lib/python2.6/site-packages/resource_management/core/sudo.py
添加
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
参考链接:https://github.com/EsharEditor/ambari-hue-service/issues/19
问题2:Hue首页PREFERRED_STORAGE_ENGINE We recommend MySQL InnoDB engine over MyISAM which does not support transactions.
解决办法:执行如下两个命令
mysql -u root -proot -e \
"SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=InnoDB;') \
FROM information_schema.tables \
WHERE engine = 'MyISAM' AND table_schema = 'hue';" \
| grep "ALTER TABLE hue" > /tmp/set_engine_innodb.ddl
mysql -u root -proot < /tmp/set_engine_innodb.ddl
参考链接: https://www.cloudera.com/documentation/enterprise/5-8-x/topics/hue_trb_misconfig.html
问题3:不管Hue使用的执行引擎(Tez、Mapreduce)是什么,即使HiveServer2运行正常,但是在使用Hue时,第一次一切正常,但后面就会显示如下信息:HiveThe application won't work without a running HiveServer2.
hiveserver2.log日志文件输入如下错误信息:
Thread-95]: thrift.ThriftHttpServlet (ThriftHttpServlet.java:doPost(145)) - Could not validate cookie sent, will try to generate a new cookie
2017-10-13 16:05:56,038 ERROR [HiveServer2-HttpHandler-Pool: Thread-95]: thrift.ThriftHttpServlet (ThriftHttpServlet.java:doPost(209)) - Error:
org.apache.hive.service.auth.HttpAuthenticationException: Authorization header received from the client is empty.
at org.apache.hive.service.cli.thrift.ThriftHttpServlet.getAuthHeader(ThriftHttpServlet.java:548)
at org.apache.hive.service.cli.thrift.ThriftHttpServlet.getAuthHeaderTokens(ThriftHttpServlet.java:529)
at org.apache.hive.service.cli.thrift.ThriftHttpServlet.getUsername(ThriftHttpServlet.java:507)
at org.apache.hive.service.cli.thrift.ThriftHttpServlet.doPasswdAuth(ThriftHttpServlet.java:355)
at org.apache.hive.service.cli.thrift.ThriftHttpServlet.doPost(ThriftHttpServlet.java:164)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
解决办法:在hive配置界面,将Run as end user instead of Hive user(hive.server2.enable.doas)设置为false,重启Hive即可。
默认情况下,HiveServer2以提交查询的用户执行查询(true),如果hive.server2.enable.doAs设置为false,查询将以运行hiveserver2进程的用户运行。