hiveserver2 configuration and startup

Configuring hive-site.xml

2. Configure core-site.xml file in hadoop
3. Test

First, the hive installation

Then change the section of the configuration file

[Root @ master hive] # cd apache-hive-2.3.3-bin / conf / # Create a file

[root@master conf]# touch hive-site.xml #编辑 [root@master conf]

# vim hive-site.xml

Configuring hive-site.xml

Xshell use tools to connect the virtual machine

Conf hive file into the installation directory folder, change hive-site.xml profile
configuration in which the reference hive installation configuration in hive-site.xml

You will find /usr/hive/apache-hive-2.3.3-bin/conf/ not hive-site.xml file
directly to create a new line

[root@master hive]# cd apache-hive-2.3.3-bin/conf/
#创建文件
[root@master conf]# touch hive-site.xml
#编辑
[root@master conf]# vim hive-site.xml 

Written in hive-site.xml

ip changed their

<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
        <property>
                <name>javax.jdo.option.ConnectionURL</name>
                <value>jdbc:mysql://192.168.134.154:3306/hive</value>
        </property>

        <property>
                <name>javax.jdo.option.ConnectionDriverName</name>
                <value>com.mysql.jdbc.Driver</value>
        </property>

        <property>
                <name>javax.jdo.option.ConnectionUserName</name>
                <value>root</value>
        </property>

        <property>
                <name>javax.jdo.option.ConnectionPassword</name>
                <value>root</value>
        </property>

        <property>
                <name>hive.metastore.schema.verification</name>
                <value>false</value>
        </property>
	<property> 
   		 <name>hive.cli.print.current.db</name>
		 <value>true</value>
	</property>
	<property> 
	         <name>hive.cli.print.header</name>
	         <value>true</value>
	</property>
	<!-- 这是hiveserver2 -->
	<property>
       		 <name>hive.server2.thrift.port</name>
     		 <value>10000</value>
	</property>

    	<property>
       		<name>hive.server2.thrift.bind.host</name>
       		<value>192.168.134.154</value>
     	</property>

</configuration>

2. Configure core-site.xml file in hadoop

Into etc / hadoop hadoop installation directory file folders, wherein the core-site.xml configuration file

注意:如果是hadoop集群而不是单机版,需要更改所有虚拟机上的core-site.xml文件

In the last added

<!-- 如果连接不上10000 -->

<property>     
	<name>hadoop.proxyuser.root.hosts</name>     
	<value>*</value>
 </property> 
<property>     
	<name>hadoop.proxyuser.root.groups</name>    
    <value>*</value> 
</property>
<property>     
	<name>hadoop.proxyuser.zhaoshb.hosts</name>     
	<value>*</value> 
</property> 
<property>     
	<name>hadoop.proxyuser.zhaoshb.groups</name>     
	<value>*</value> 
</property>

 

3. Test

First, start your Hadoop cluster and Zookeeper

Then start hiveserver2 installed on the host of the hive

Because configured the hive environment variables so we can run directly in any folder
otherwise need to advance to the next bin hive installation directory

[root@master ~]# hiveserver2
#或者
[root@master ~]# hive --service hiveserver2
  • 1
  • 2
  • 3

This time your page will always be stuck in here, this is normal, because you are a service launched
Here Insert Picture Description

You just need to open a window connected to Xshell

Here Insert Picture Description

In the newly opened window operation

#进入beeline
[root@master ~]# beeline
#连接10000端口
beeline> !connect jdbc:hive2://192.168.134.154:10000
Connecting to jdbc:hive2://192.168.134.154:10000
Enter username for jdbc:hive2://192.168.134.154:10000: root #用户名root
Enter password for jdbc:hive2://192.168.134.154:10000: **** #密码root

Then use the browser in your 192.168.134.154 (host ip address hive of installation): View 10002

Here Insert Picture Description

Next hiveserver2 may operate in the basic operation, and as in hive

0: jdbc:hive2://192.168.134.154:10000> show databases;
+----------------+
| database_name  |
+----------------+
| default        |
+----------------+
1 row selected (2.51 seconds)
 

Guess you like

Origin www.cnblogs.com/wangchaoqi/p/12019752.html