데이터 베이스 MySQL 튜토리얼 hive-mysql安装配置

hive-mysql安装配置

Jun 01, 2016 pm 01:15 PM
facebook mysql 정보 관계형 데이터베이스

默认情况下,hive的元数据信息存储在内置的Derby数据中。Facebook将hive元数据存储在关系数据库

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

2、创建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、创建数据库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;

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

PHP의 빅데이터 구조 처리 능력 PHP의 빅데이터 구조 처리 능력 May 08, 2024 am 10:24 AM

PHP의 빅데이터 구조 처리 능력

PHP에서 MySQL 쿼리 성능을 최적화하는 방법은 무엇입니까? PHP에서 MySQL 쿼리 성능을 최적화하는 방법은 무엇입니까? Jun 03, 2024 pm 08:11 PM

PHP에서 MySQL 쿼리 성능을 최적화하는 방법은 무엇입니까?

PHP에서 MySQL 백업 및 복원을 사용하는 방법은 무엇입니까? PHP에서 MySQL 백업 및 복원을 사용하는 방법은 무엇입니까? Jun 03, 2024 pm 12:19 PM

PHP에서 MySQL 백업 및 복원을 사용하는 방법은 무엇입니까?

PHP를 사용하여 MySQL 테이블에 데이터를 삽입하는 방법은 무엇입니까? PHP를 사용하여 MySQL 테이블에 데이터를 삽입하는 방법은 무엇입니까? Jun 02, 2024 pm 02:26 PM

PHP를 사용하여 MySQL 테이블에 데이터를 삽입하는 방법은 무엇입니까?

MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법 MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법 Dec 09, 2024 am 11:42 AM

MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법

PHP에서 MySQL 저장 프로시저를 사용하는 방법은 무엇입니까? PHP에서 MySQL 저장 프로시저를 사용하는 방법은 무엇입니까? Jun 02, 2024 pm 02:13 PM

PHP에서 MySQL 저장 프로시저를 사용하는 방법은 무엇입니까?

PHP를 사용하여 MySQL 테이블을 만드는 방법은 무엇입니까? PHP를 사용하여 MySQL 테이블을 만드는 방법은 무엇입니까? Jun 04, 2024 pm 01:57 PM

PHP를 사용하여 MySQL 테이블을 만드는 방법은 무엇입니까?

오라클 데이터베이스와 mysql의 차이점 오라클 데이터베이스와 mysql의 차이점 May 10, 2024 am 01:54 AM

오라클 데이터베이스와 mysql의 차이점

See all articles