hive單使用者多點模式配置
阿新 • • 發佈:2018-11-28
簡介
單使用者多點模式也稱遠端服務模式,使用者非java客戶端訪問元資料庫,在服務端啟動MetaStoreServer,客戶端利用Thrift協議通過MetaStoreServer訪問元資料庫。
mysql安裝以及配置
安裝mysql
apt預設安裝,佔據3306埠
安裝機器 : dev01
sudo apt-get install mysql-server
sudo apt-get install mysql-client
配置hive使用者
登陸mysql
mysql -u root -p xxxxxx
建立hive使用者
create user 'hive'@'%' identified by 'hive';
給hive使用者許可權
grant all privileges on *.* to 'hive'@'%' with grant option;
flush privileges;
服務端配置
修改 $HIVE_HOME/conf/hive-site.xml
<configuration> #配置mysql <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</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>hive.metastore.warehouse.dir</name> <value>/usr/hive/warehouse</value> </property> # 配置MySQL的登入名和密碼 <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.exec.scratchdir</name> <value>/usr/hive/tmp</value> </property> <property> <name>hive.querylog.location</name> <value>/usr/hive/log</value> </property> <property> <name>hive.metastore.uris</name> <value>thrift://dev01:9083</value> </property> </configuration>
客戶端配置
修改 $HIVE_HOME/conf/hive-site.xml
<configuration> # 9083是服務端 metastore 啟動以後的預設埠 <property> <name>hive.metastore.uris</name> <value>thrift://dev01:9083</value> <description>IP address (or fully-qualified domain name) and port of the metastore host</description> </property> <property> <name>hive.metastore.warehouse.dir</name> <value>/usr/hive/warehouse</value> </property> <property> <name>hive.metastore.local</name> <value>false</value> </property> <property> <name>hive.exec.scratchdir</name> <value>/usr/hive/tmp</value> </property> <property> <name>hive.querylog.location</name> <value>/usr/hive/log</value> </property> </configuration>
啟動hive
服務端
啟動metastore
hive --service metastore
客戶端
beeline -u jdbc:hive2://