1.編輯Hive的hive-site.xml
<property> <!-- hiveserver2用戶名 --> <name>beeline.hs2.connection.user</name> <value>hive2</value> </property> <property> <!-- hiveserver2密碼 --> <name>beeline.hs2.connection.password</name> <value>hive2</value> </property> <property> <!-- hiveserver2端口 --> <name>beeline.hs2.connection.hosts</name> <value>localhost:10000</value> </property> 2.測試是否成功
啟動hiveserver2
$HIVE_HOME/bin/hiveserver2
連接方式一
$HIVE_HOME/bin/beeline -u jdbc:hive2://localhost:10000;auth=hive2;password=hive2
連接方式二
先啟動beeline
然后在beeline中連接hiveserver2:!connect jdbc:hive2://localhost:10000