dnf install mariadb-server
dnf search maria
systemctl start mariadb.service
mysql_secure_installation
Enter current password for root (enter for none): 그냥 Enter
Set root password? [Y/n] Y
New password: 1234
Re-enter new password: 1234
Remove anonymous users? [Y/n] n
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] n
Reload privilege tables now? [Y/n] y
https://devocean.sk.com/blog/techBoardDetail.do?ID=163549
mysql -u root -p
-> 1234
show databases;
use mysql
show tables;
desc user;
MariaDB [mysql]> select host, user, password from user;
quit
systemctl start mariadb.service
mysql -u root -p
systemctl restart mariadb.service
계정 생성
grant all privileges on *.* to 'hive'@'localhost' identified by 'hive' with grant option;
grant all privileges on *.* to 'hive'@'%' identified by 'hive' with grant option;
flush privileges;
쿼리 실행
use mysql
select user,host from user;
select host from mysql.user where user='hive';
exit
참고 : https://thinmug.tistory.com/33
.bashrc
HADOOP_HOME 경로 설정
HADOOP_HOME=/home/hadoop/hadoop-3.2.2
HIVE_HOME 경로 설정
HIVE_HOME=/home/hadoop/hive-3.1.2
PATH에 HIVE_HOME/bin 설정
hive conf hive-env.sh 설정
hive-env.sh
가필요hive-site.xml
이 필요함cp hive-default.xml.template hive-site.xml
vi hive-site.xml
jdbc:mysql://192.168.56.102:3306/hive?createDatabaseIfNotExist=true
변경 (자기주소 or localhost)com.mysql.jdbc.Driver
hive
hive
/home/hadoop/iotmp
ture
[hadoop@hadoop00 ~]$ mkdir -p /home/hadoop/iotmp
[hadoop@hadoop00 ~]$ chmod -R 775 /home/hadoop/iotmp/
mariadb-... .jar
파일 /hadoop-3.2.2/lib/ 경로에 복사cd /tmp
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.38.tar.gz
tar xzvf mysql-connector-java-5.1.38.tar.gz
cd mysql-connector-java-5.1.38
mv mysql-connector-java-5.1.38-bin.jar /home/hadoop/hive-3.1.2/lib
ls my*
ls maria*
hdfs dfs -mkdir /tmp
hdfs dfs -mkdir -p /user/hive/warehouse
hdfs dfs -chmod -R 777 /tmp
hdfs dfs -chmod -R 777 /user/hive/warehouse
schematool -initSchema -dbType mysql
schematool -initSchema -dbType mysql -userName hive -passWord hive
[hadoop@hadoop00 lib]$ ls guava*
guava-19.0.jar
[hadoop@hadoop00 lib]$ mv guava-19.0.jar ~guava-19.0.jar
[hadoop@hadoop00 lib]$
[hadoop@hadoop00 lib]$ ls ~*
'~guava-19.0.jar'
[hadoop@hadoop00 lib]$
cp ./guava-27.0-jre.jar / home/hadoop/hive-3.1.2/lib
[hadoop@hadoop00 lib]$ ls /home/hadoop/hive-3.1.2/lib/gua*
/home/hadoop/hive-3.1.2/lib/guava-27.0-jre.jar
[hadoop@hadoop00 lib]$
systemctl stop mariadb.service
-> systemctl start mariadb.service
3) /home/hadoop/hive-3.1.2/lib 여기 경로에 ls *gu*
~guava-19.0.jar 얘가 있으면
경로 변경해주기
mv \~guava-19.0.jar ~
(home dir로 변경 )
schematool -initSchema -dbType mysql
use mysql
show database
show tables
-> 나오면 성공
[hadoop@hadoop00 ~]$ hdfs dfs -ls -R /user
[hadoop@hadoop00 ~]$ hdfs dfs -ls -R /user/hive/warehouse
hive의 목적은 map-reduce
hive
접속
테이블 생성 create table T1(id string);
데이터 확인 hive (default)> select * from T1;
데이터 inserthive (default)> insert into T1 values("Tom");
확인 select * from T1;
count 함수 select count(*) from T1;
하이브에서 만들어진 데이터 warehouse에 올라감
[hadoop@hadoop00 ~]$ hdfs dfs -ls -R /user/hive/warehouse
참고 사이트 :
https://devocean.sk.com/blog/techBoardDetail.do?ID=163549
https://thinmug.tistory.com/33 (설치)
https://corock.tistory.com/347 (hive 예제)
http://databaser.net/moniwiki/wiki.php/Hive%EC%98%88%EC%A0%9C%ED%8C%8C%EC%9D%BC (hive 예제)