一、vim hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <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://hadoop02:3306/hive_metastore?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF8&useSSL=false</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>zhyx</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>zhyxmysql22</value> <description>password to use against metastore database</description> </property> <!-- Hive 元数据存储版本的验证 --> <property> <name>hive.metastore.schema.verification</name> <value>false</value> </property> <!--元数据存储授权--> <property> <name>hive.metastore.event.db.notification.api.auth</name> <value>false</value> </property> <!-- 修改hive在hdfs上的目录--> <property> <name>hive.metastore.warehouse.dir</name> <value>/user/hive3/warehouse</value> <description>location of default database for the warehouse</description> </property> <property> <name>hive.cli.print.header</name> <value>true</value> </property> <property> <name>hive.metastore.uris</name> <value>thrift://hadoop02:9083</value> </property> <property> <name>hive.server2.thrift.bind.host</name> <value>hadoop02</value> </property> <property> <name>hive.server2.thrift.port</name> <value>10000</value> </property> <!--Spark依赖位置(注意:端口号8020必须和namenode的端口号一致)--> <property> <name>spark.yarn.jars</name> <value>hdfs://hadoop01:8020/spark-jars/*</value> </property> <!--Hive执行引擎--> <property> <name>hive.execution.engine</name> <value>spark</value> </property> </configuration>