참고한 블로그 : https://velog.io/@yje876/220128
중간에 systemctl 사용하려하면
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
에러 뜬다. 이럴 때 systemctl start mariadb.service 대신에 service mariadb start 를 사용한다.
hive 를 다운받기 위해서
https://dlcdn.apache.org/hive/ 여기서 원하는 버전을 다운로드 받으면 된다.
wget https://dlcdn.apache.org/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gztar -xvzf apache-hive-3.1.3-bin.tar.gzhadoop 다운로드 : wget https://dlcdn.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz
mariadb java client 다운로드: wget https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/3.1.4/mariadb-java-client-3.1.4.jar
hdfs 안먹힐 경우, PATH 확인해보고, source ~/.profile로 한번 업데이트 해줘야함.
schematool -initSchema -dbType mysql 에서
Error: Syntax error: Encountered "<EOF>" at line 1, column 64. (state=42X01,code=30000)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
com.my.sql.cj.jdbc.Driver 대신에 com.my.sql.jdbc.Driver 으로 사용Underlying cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException : Unknown database 'hive'
SQL Error code: 1049service mariadb startmysql -u root -pshow databases; 했을 때 hive 없으면create database hive; 하기.Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
위의 에러가 뜬다면 hive 기본이 java 8 버전과 어울리는데, hadoop3 이상은 java 11과 잘맞는다. 그래서 나도 jdk11을 쓰고ㅠ 있었는데 위의 오류가 떠서 apt install openjdk-8-jdk 로 재설치 하고, vi ~/.profile 로 JAVA_HOME 의 변수 위치 설정을 다시 해줬다. (11 -> 8 로 단순하게 바꿈)
Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
hive-site.xml 에 들어가서
위치 : /opt/hive/apache-hive-3.1.3-bin/conf
<property>
<name>system:java.io.tmpdir</name>
<value>/tmp/hive/java</value>
</property>
<property>
<name>system:user.name</name>
<value>${user.name}</value>
</property>
을 추가하면 해결!
출처 : https://stackoverflow.com/questions/27099898/java-net-urisyntaxexception-when-starting-hive
hive 에서 SQL 입력 시 에러
Error: Table 'CTLGS' already exists (state=42S01,code=1050)
hive SQL 입력시 에러
hive> create table T1(id string); // 하자마자 에러뜸
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
hive --service metastore & 입력 후 다른 터미널 창을 열어 hive를 실행하면 된다. 왜 이렇게 하면 될까..?