大家好,欢迎来到IT知识分享网。
解压hive压缩包
apache-hive-2.1.0-bin.tar.gz(官网下载)
配置HADOOP_HOME环境变量
配置HIVE_HOME环境变量
在$HIVE_HOME/conf下创建hive-site.xml,并输入增加以下配置:
<?xml version=”1.0″ ?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl” ?>
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/tmp/hive</value>
</property>
<property>
<name>hive.server2.logging.operation.log.location</name>
<value>/tmp/hive/operation_logs</value>
<description>Top level directory where operation logs are stored if logging functionality is enabled</description>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/tmp/hive</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/tmp/hive/resources</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>bigdata</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.server2.thrift.bind.host</name>
<value>0.0.0.0</value>
<description>Bind host on which to run the HiveServer2 Thrift interface.
Can be overridden by setting $HIVE_SERVER2_THRIFT_BIND_HOST</description>
</property>
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
<description>Port number of HiveServer2 Thrift interface.
Can be overridden by setting $HIVE_SERVER2_THRIFT_PORT</description>
</property>
<property>
<name>hive.server2.enable.doAs</name>
<value>false</value>
<description>Set true to use user who login hiveserver2 for executing hadoop job.Otherwise, use the user who run hiveserver2.</description>
</property>
</configuration>
安装mysql,创建指定主机能访问的用于hive的的用户及密码,并授予所有权限,如果javax.jdo.option.ConnectionURL属性没有加createDatabaseIfNotExist=true,那么需要手动创建用于hive的数据库
拷贝mysql驱动JAR包到$HIVE_HOME/lib目录下:
cp mysql-connector-java-5.1.39-bin.jar $HIVE_HOME/lib/
执行schematool -initSchema -dbType mysql
下载hive-jdbc-2.1.0-standalone.jar并放入$HIVE_HOME/lib下。(因为使用beeline方式连接hive时需要)
使用以下命令启动hive服务:
hive –service hiveserver2 >/dev/null 2>/dev/null &
检查HiveServer是否启动成功的最快捷的方法就是使用netstat命令查看10000端口是否打开并监听连接:netstat -nl|grep 10000
Hive提供了配置变量hive.start.cleanup.scratchdir,默认值是false,将这个属性设置为true的话,那么就会在每次重启HiveServer服务时清理掉临时目录。
如果metastore不在server同一台主机上,需要配置:
hive.metastore.local为false
hive.metastore.uris为远程metastore服务地址,如:thrift://metastore_server:9083
且需要手动在远程主机上执行hive –service metastore >/dev/null 2>/dev/null & 来启动metastore,可以用netstat -an|grep 9083检查源数据服务是否启动。
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/6189.html