1. MariaDB 설치 (Install)
MariaDB installation file download
http://www.mariadb.org/
- 다운로드 폴더에 mariaDB 설치파일 다운
MariaDB-10.0.15-centos7_0-x86_64-client.rpm
MariaDB-10.0.15-centos7_0-x86_64-common.rpm
MariaDB-10.0.15-centos7_0-x86_64-server.rpm
mariadb-java-client-1.3.5.jar
# cd 다운로드/
# yum -y remove mariadb-libs
# yum -y localinstall Maria*
Hive library 넣어주기
# mv mariadb-java-client-1.3.5.jar /usr/local/hive-1.0.1/lib
HIVE가 접근할 수 있는 hive 계정 생성
# systemctl restart mysql
# systemctl status mysql
서비스 상시가동
# chkconfig mysql on
# mysqladmin -u root password '111111'
# mysql -u root -p
MariaDB [(none)]> use mysql
hive 계정 권한 변경
localhost 에서 들어오는 모든 접근에 hive 계정 권한을 열어준다
MariaDB [mysql]> grant all privileges on *.* to hive@'localhost' identified by '111111';
모든ip에서 들어오는 접근에 hive 계정 권한을 주겠다.
MariaDB [mysql]> grant all privileges on *.* to hive@'%' identified by '111111';
Hive 계정에서 사용할 database 생성 MariaDB [mysql]> create database hive_db;
MariaDB [mysql]> commit;
MariaDB [mysql]> show databases;
MariaDB [(none)]> use hive_db
Database changed
MariaDB [hive_db]>
1. Hive 설치
Hive다운로드
# tar xvfz apache-hive-1.0.1-bin.tar.gz
# cp -r apache-hive-1.0.1-bin /usr/local/hive-1.0.1
2. profile
# vi /etc/profile
HIVE_HOME=/usr/local/hive-1.0.1
export HIVE_HOME
PATH=$HADOOP_HOME/bin:$JAVA_HOME/bin:$HIVE_HOME/bin:$PATH
. /etc/profile
3. Hive-MariaDB connector
MariaDB library 를 hive에서 사용할 수 있도록 lib 파일에 넣어준다
mariadb-java-client-1.3.5.jar
# cd 다운로드
# cp mariadb-java-client-1.3.5.jar /usr/local/hive-1.0.1/lib
4. hive가 사용할 하둡내부의 공간
- hadoop data : tmp 폴더 권한을 열어줘야 hive 실행 가능
# hadoop dfs -mkdir /tmp/hive
# hadoop dfs -chmod 777 /tmp
# hadoop dfs -chmod 777 /tmp/hive
# hive
5. Database Structure 저장할 폴더 지정
- warehouse 안만들면 현재폴더에에 db_ 생성됌
# hadoop dfs -mkdir /user/root/warehouse
# hadoop dfs -chmod 777 /user/root/warehouse
6. Database Structure 저장할 폴더 지정
# cd /usr/local/hive-1.0.1/conf/
# touch hive-site.xml
# vi hive-site.xml
<configuration>
<property>
<name>hive.metastore.local</name>
<value>true</value>
<description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mariadb://localhost:3306/hive_db?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.mariadb.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<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>111111</value>
<description>password to use against metastore database</description>
</property>
</configuration>
7. Hadoop 실행 -> Hive 실행
# start-all.sh
# hive