你會發現/usr/hive/apache-hive-2.3.4-bin/conf/並無hive-site.xml文件
直接新建一個就行java
個人環境中已經配置了Hive-MetaStore,因此我這個文件以前就新建過了,若是是你新安裝的hive ,那麼你要本身新建一個hive-site.xml文件node
整個文件完整內容以下:mysql
其中粗體字部分是和hiveserver2有關的重要配置sql
<?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://localhost:3306/hive?createDatabaseIfNotExist=true&useSSL=false</value>
<description>JDBC connect string for a JDBC metastore</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.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>password to use against metastore database</description>
</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>shell<property>
<name>hive.server2.thrift.bind.host</name>
<value>127.0.0.1</value>
</property>express</configuration>apache
core-site.xml完整代碼以下:bash
綠色粗體代碼部分是核心配置app
name標籤中的hadoop.proxyuser.${用戶名}.groupsless
這個${用戶名}就是增長容許用來鏈接hiveserver2的username
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- 指定HDFS老大(namenode)的通訊地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://127.0.0.1:9000</value>
</property>
<!-- 指定hadoop運行時產生文件的存儲路徑 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop/hadoop-temp</value>
</property>
<!-- 若是鏈接不上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.chenjun.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.chenjun.groups</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hive.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hive.groups</name>
<value>*</value>
</property></configuration>
#以nohup形式啓動hiveserver2 cd $HIVE_HOME nohup hiveserver2>> hiveserver2.log 2>&1 &
回車以後
切換到root ,看看10000端口的進程是否是起來了
lsof -i:10000
如上圖所示,能夠看到 進程已經起來了
訪問一下 localhost:10002 看看能不能打開
能夠看到服務確實啓動了
Zeppelin安裝只需啓動一個shell文件就完成了,及其簡單 ,此處略去安裝步驟
而後會進入一個表單填寫的界面
1. default.driver 填寫 org.apache.hive.jdbc.HiveDrivera
2. default.url 填寫 jdbc:hive2://localhost:10000/test
3. default.user 填寫 chenjun
4.Dependencies部分,把驅動加入到Dependencies中 ,以下圖,
注意:
第三項的user填寫必需要和以前上面提到的core-site.xml配置的user同樣!
第四項的版本必須兼容你的hive版本 ,好比我hive是2.3.4, 天然使用了2.3.4的jar驅動
配置完成以後保存, 而後在Zeppelin中新建一個notebook
而後就說編寫SQL,進行測試
此處我預先建了一張表 t_plate_num_report (車輛信息表)
等待執行完畢,自動展現圖表