CentOS 에서 Hive 2.0.0 단기 모드 설치 상세 설명

본 논문 의 환경 은 다음 과 같다.운영 체제:CentOS 6 32 비트 Hive 버 전:2.0.0 JDK 버 전:1.8.077 32 위 Hadoop 버 전:2.6.4
1.필요 한 환경
Hive 2.0 은 다음 과 같은 실행 환경 이 필요 합 니 다.Java 1.7 이상(Java 1.8 사용 을 강력 히 권장 합 니 다)Hadoop 2.X
2.하 이브 설치 팩 다운로드,압축 풀기
Hive 홈 페이지 주소:http://hive.apache.org/ 예 를 들 면:
wget "http://mirrors.cnnic.cn/apache/hive/hive-2.0.0/apache-hive-2.0.0-bin.tar.gz"
tar -xzvf apache-hive-2.0.0-bin.tar.gz
mv apache-hive-2.0.0-bin /opt/hive-2.0.0

3.환경 변수 설정(선택 가능)
접근 하기 편리 하도록 hive-2.0.0/bin 을 path 에 추가 합 니 다.
vi /etc/profile

끝 에 추가:
HIVE_HOME=/opt/hive-2.0.0
PATH=$PATH:$HIVE_HOME/bin

4.단기 모드 시작
하 이브 는 Hadoop 과 마찬가지 로 3 가지 작 동 모드 가 있 는데 그것 이 바로 단기 모드,의사 분포 모드,분포 모드 이다.여기 서 먼저 단기 모드 의 작 동 방식 을 말씀 드 리 겠 습 니 다.클 러 스 터 모드 설치http://blog.csdn.net/lnho2015/article/details/51355511
4.1 프로필 수정
cd /opt/hive-2.0.0/conf
vi hive-site.xml //    hive-default.xml.template

다음 내용 을 입력 하고 저장:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
    <name>hive.metastore.warehouse.dir</name>
    <value>/opt/hive-2.0.0/warehouse</value>
    <description>location of default database for the warehouse</description>
</property>
<property>
   <name>javax.jdo.option.ConnectionURL</name>
   <value>jdbc:derby:/opt/hive-2.0.0/metastore_db;create=true</value>
   <description>JDBC connect string for a JDBC metastore</description>
</property>
</configuration>

4.2 데이터베이스 초기 화
schematool -initSchema -dbType derby

다음 몇 줄 설명 초기 화 성공:
Starting metastore schema initialization to 2.0.0
Initialization script hive-schema-2.0.0.derby.sql
Initialization script completed
schemaTool completed

4.3 시작 프로그램
mkdir -p /opt/hive-2.0.0/warehouse       //           
chmod a+rwx /opt/hive-2.0.0/warehouse    //       
hive
hive>프롬프트 가 나타 나 면 시작 성공 을 설명 합 니 다.
5.흔히 볼 수 있 는 오류
5.1 하 이브 리드 를 실행 할 때 나타 나 기
Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)

오류 원인:데이터베이스 가 초기 화 되 지 않 았 습 니 다.4.2 참조 하 십시오.
5.2 schematool 을 사용 하여 데이터 베 이 스 를 초기 화 할 때 나타 납 니 다.
Initialization script hive-schema-2.0.0.derby.sql
Error: FUNCTION 'NUCLEUS_ASCII' already exists. (state=X0Y68,code=30000) org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
*** schemaTool failed ***

오류 원인:데이터베이스 폴 더 에 파일 이 이미 존재 합 니 다.해결 방법 은 데이터베이스 폴 더 를 비 우 는 것 입 니 다(즉,앞에서 설정 한/opt/hive-2.0.0/metastore_db폴 더 입 니 다)

좋은 웹페이지 즐겨찾기