CREAT" />
最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

hive-mysql安裝配置

來源:懂視網 責編:小采 時間:2020-11-09 19:15:16
文檔

hive-mysql安裝配置

hive-mysql安裝配置:默認情況下,hive的元數據信息存儲在內置的Derby數據中。Facebook將hive元數據存儲在關系數據庫1、安裝好mysql ,sudo apt-get install mysql-server2、創(chuàng)建mysql用戶hadoop $ mysql -u root -p 進入root用戶 mysql> CREAT
推薦度:
導讀hive-mysql安裝配置:默認情況下,hive的元數據信息存儲在內置的Derby數據中。Facebook將hive元數據存儲在關系數據庫1、安裝好mysql ,sudo apt-get install mysql-server2、創(chuàng)建mysql用戶hadoop $ mysql -u root -p 進入root用戶 mysql> CREAT

默認情況下,hive的元數據信息存儲在內置的Derby數據中。Facebook將hive元數據存儲在關系數據庫

1、安裝好mysql ,sudo apt-get install mysql-server

2、創(chuàng)建mysql用戶hadoop

$ mysql -u root -p 進入root用戶

mysql> CREATE USER 'hadoop'@'localhost' IDENTIFIED BY 'hadoop';

3、授權:mysql> GRANT ALL PRIVILEGES ON *.* TO'hadoop'@'localhost' WITH GRANT OPTION;

4、登錄到hadoop 用戶 $ mysql -u hadoop -p

5、創(chuàng)建數據庫hive

mysql>create database hive;

6、修改hive中hive-site.xml


hive.metastore.local
true
Thrift uri for the remote metastore. Used by metastore client to connect to remote metastore.


javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true
JDBC connect string for a JDBC metastore


javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name for a JDBC metastore


javax.jdo.PersistenceManagerFactoryClass
org.datanucleus.jdo.JDOPersistenceManagerFactory
class implementing the jdo persistence


javax.jdo.option.DetachAllOnCommit
true
detaches all objects from session so that they can be used after transaction is committed


javax.jdo.option.NonTransactionalRead
true
reads outside of transactions


javax.jdo.option.ConnectionUserName
hadoop
username to use against metastore database


javax.jdo.option.ConnectionPassword
hadoop
password to use against metastore database

7、將mysql jdbc driver拷貝到hive的lib下

8、測試:

hive> create table tmp(info int);
OK
Time taken: 0.66 seconds
hive> show tables;
OK
tmp
Time taken: 0.138 seconds
hive> exit;
hadoop@hadoop-VirtualBox:~/hive-0.10.0$ mysql -u hadoop -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 50
Server version: 5.5.37-0ubuntu0.12.10.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.

mysql> use hive;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------+
| Tables_in_hive |
+---------------------------+
| BUCKETING_COLS |
| CDS |
| COLUMNS_V2 |
| DATABASE_PARAMS |
| DBS |
| PARTITION_KEYS |
| SDS |
| SD_PARAMS |
| SEQUENCE_TABLE |
| SERDES |
| SERDE_PARAMS |
| SKEWED_COL_NAMES |
| SKEWED_COL_VALUE_LOC_MAP |
| SKEWED_STRING_LIST |
| SKEWED_STRING_LIST_VALUES |
| SKEWED_VALUES |
| SORT_COLS |
| TABLE_PARAMS |
| TBLS |
+---------------------------+
19 rows in set (0.01 sec)

mysql> select * from COLUMNS_V2;
+-------+---------+-------------+-----------+-------------+
| CD_ID | COMMENT | COLUMN_NAME | TYPE_NAME | INTEGER_IDX |
+-------+---------+-------------+-----------+-------------+
| 1 | NULL | info | int | 0 |
+-------+---------+-------------+-----------+-------------+
1 row in set (0.01 sec)

mysql> select * from tbls;
ERROR 1146 (42S02): Table 'hive.tbls' doesn't exist
mysql> select * from TBLS;
+--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+
| TBL_ID | CREATE_TIME | DB_ID | LAST_ACCESS_TIME | OWNER | RETENTION | SD_ID | TBL_NAME | TBL_TYPE | VIEW_EXPANDED_TEXT | VIEW_ORIGINAL_TEXT |
+--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+
| 1 | 1399452288 | 1 | 0 | hadoop | 0 | 1 | tmp | MANAGED_TABLE | NULL | NULL |
+--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+
1 row in set (0.02 sec)

mysql> exit;

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

hive-mysql安裝配置

hive-mysql安裝配置:默認情況下,hive的元數據信息存儲在內置的Derby數據中。Facebook將hive元數據存儲在關系數據庫1、安裝好mysql ,sudo apt-get install mysql-server2、創(chuàng)建mysql用戶hadoop $ mysql -u root -p 進入root用戶 mysql> CREAT
推薦度:
標簽: 信息 安裝 Facebook
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top