hive_hiveserver2 hive-site.xml config and start
hive-site.xml
# vi hive-site.xml <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://sd-9c1f-2eac:3306/hive?createDatabaseIfNotExist=true</value> </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.ConnectionUserName</name> <value>hive</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> <description>password to use against metastore database</description> </property> <property> <name>hive.hwi.listen.host</name> <value>0.0.0.0</value> <description>This is the host address the Hive Web Interface will listen on</description> </property> <property> <name>hive.hwi.listen.port</name> <value>9999</value> <description>This is the port the Hive Web Interface will listen on</description> </property> <property> <name>hive.hwi.war.file</name> <value>lib/hive-hwi-2.1.1.war</value> <description>This is the WAR file with the jsp content for Hive Web Interface</description> </property> <property> <name>hive.exec.local.scratchdir</name> <value>/home/hadoop/iotmp</value> <description>Local scratch space for Hive jobs</description> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/home/hadoop/iotmp</value> <description>Temporary local directory for added resources in the remote file system.</description> </property> <property> <name>hive.server2.transport.mode</name> <value>binary</value> </property> <property> <name>hive.server2.thrift.http.port</name> <value>10001</value> </property> <property> <name>hive.server2.thrift.http.max.worker.threads</name> <value>500</value> </property> <property> <name>hive.server2.thrift.http.min.worker.threads</name> <value>5</value> </property> <property> <name>hive.server2.thrift.http.path</name> <value>cliservice</value> </property> <property> <name>hive.server2.thrift.min.worker.threads</name> <value>5</value> </property> <property> <name>hive.server2.thrift.max.worker.threads</name> <value>500</value> </property> <property> <name>hive.server2.thrift.port</name> <value>10000</value> </property> <property> <name>hive.server2.thrift.bind.host</name> <value>sd-9c1f-2eac</value> </property> <property> <name>hive.server2.authentication</name> <value>NONE</value> </property> </configuration>
启动mysql
[Dev root @ sd-9c1f-2eac /usr/local/src/apache-hive-2.1.1-bin/conf]
# service mysql start
Starting MySQL...
启动hiveserver2
# hive --service metastore &
# hive --service hiveserver2 &
hiveserver2 连接 mysql
[Dev root @ sd-9c1f-2eac /usr/local/src/apache-hive-2.1.1-bin]
# $HIVE_HOME/bin/beeline -u jdbc:hive2://localhost:10000
which: no hbase in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/src/jdk1.8.0_112/bin:/usr/local/src/hadoop-2.7.3/bin:/usr/local/src/apache-hive-2.1.1-bin/bin:/home/pl62716/spark-2.1.0-bin-hadoop2.6/bin:/home/pl62716/apache-maven-3.3.9/bin://home/pl62716/sbt-launcher-packaging-0.13.13/bin:/root/bin) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/hive-jdbc-2.1.1-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/local/src/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/local/src/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] Connecting to jdbc:hive2://localhost:10000 Connected to: Apache Hive (version 2.1.1) Driver: Hive JDBC (version 2.1.1) 17/05/08 03:38:46 [main]: WARN jdbc.HiveConnection: Request to set autoCommit to false; Hive does not support autoCommit=false. Transaction isolation: TRANSACTION_REPEATABLE_READ Beeline version 2.1.1 by Apache Hive 0: jdbc:hive2://localhost:10000>