Hadoop安裝 Hadoop安裝 Hive元數據三種存儲方式 Derby:hive預設的存儲模式,不可以併發調用hive 本地MySQL 遠程MySQL 採用第二種方式,安裝MySQL,啟動並創建Hive用戶,創建Hive元資料庫 insert into mysql.user(Host,User,...
Hadoop安裝
Hive元數據三種存儲方式
- Derby:hive預設的存儲模式,不可以併發調用hive
- 本地MySQL
- 遠程MySQL
採用第二種方式,安裝MySQL,啟動並創建Hive用戶,創建Hive元資料庫
insert into mysql.user(Host,User,Password) values("localhost","hive",password("hive"));
create database hive;
grant all on hive.* to hive@'%' identified by 'hive';
grant all on hive.* to hive@'localhost' identified by 'hive';
flush privileges;
配置Hive環境變數
vim /etc/profile
修改Hive配置
修改hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL </name>
<value>jdbc:mysql://localhost:3306/hive </value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName </name>
<value>com.mysql.jdbc.Driver </value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword </name>
<value>hive </value>
</property>
<property>
<name>hive.hwi.listen.port </name>
<value>9999 </value>
<description>This is the port the Hive Web Interface will listen on </descript ion>
</property>
<property>
<name>datanucleus.autoCreateSchema </name>
<value>true</value>
</property>
<property>
<name>datanucleus.fixedDatastore </name>
<value>false</value>
</property>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>Username to use against metastore database</description>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/home/hdpsrc/hive/iotmp</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/home/hdpsrc/hive/iotmp</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
<property>
<name>hive.querylog.location</name>
<value>/home/hdpsrc/hive/iotmp</value>
<description>Location of Hive run time structured log file</description>
</property>
註意事項
- 找到mysql的jdbc驅動,比如mysql-connector-java-5.1.6-bin.jar拷貝到hive/lib目錄下
- hive/lib/jline-2.12.jar拷貝到/hadoop/yarn/lib/目錄下
啟動Hive,測試
在hive中新建表
在MySQL中查看