Hiveのインストール+対応問題

6571 ワード

Hiveのインストール
ダウンロード
http://mirror.bit.edu.cn/apache/hive/

wget http://mirror.bit.edu.cn/apache/hive/hive-3.1.1/apache-hive-3.1.1-bin.tar.gz
インストール+設定
  • インストール
      tar -zxvf apache-hive-3.1.1-bin.tar.gz
      mv apache-hive-3.1.1-bin   hive
      rm apache-hive-3.1.1-bin.tar.gz
    
  • 構成
      vim  /etc/profile
        
    
      #hive env
      export HIVE_HOME=/root/hive
      export PATH=$PATH:$HIVE_HOME/bin
    
      source /etc/profile
    
  • hiveプロファイル
  • は、プロファイル
      cd  hive/conf
      cp hive-default.xml.template hive-site.xml
      cp hive-env.sh.template hive-env.sh
    
  • を生成する。
  • プロファイル
      vim hive-env.sh
      HADOOP_HOME=${HADOOP_HOME}
    
    
    
      vim hive-site.xml 
        
    
      
      
          javax.jdo.option.ConnectionUserName   ( 4     ,            !)
          root
      
      
          javax.jdo.option.ConnectionPassword  
          LLTllt19970518
      
      
          javax.jdo.option.ConnectionURLmysql
          jdbc:mysql://maoerfei.cn:3306/hive
      
      
          javax.jdo.option.ConnectionDriverNamemysql    
          com.mysql.jdbc.Driver
      
      
    
  • mysql.driverドライバ+対応mysqlのdatabaseをダウンロードします。
        wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.zip
    
         mysql-connector-java-5.1.18-bin.jar   hive/lib   
    
        mysql     database :hive   (   )
    
    hadoopを起動する(またはhdfsを起動する)+hive
        hadoop sbin   
        start-all.sh
        
          hive
        hive
    
    試行コマンド
        show databases;
    
    エラー処理
    エラー:3210行の未知の文字
  • コメントを解決しました。3210行
  • です。
    エラー:{system:java.io.tmpdir}のURISyntxは解析できません。
  • 表示
      Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
          at org.apache.hadoop.fs.Path.initialize(Path.java:254)
          at org.apache.hadoop.fs.Path.(Path.java:212)
          at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:644)
          at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:563)
          at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:531)
          at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
          at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.hadoop.util.RunJar.run(RunJar.java:234)
          at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
      Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
          at java.net.URI.checkPath(URI.java:1823)
          at java.net.URI.(URI.java:745)
          at org.apache.hadoop.fs.Path.initialize(Path.java:251)
          ... 12 more
    
  • 解決vim/conf/hive-site.xml
          
    
      
          Hive.exec.local.scratchdir
          /root/hive/tmp//${system:user.name}
          Local scratch space for Hive jobs
        
      
        
          hive.downloaded.resources.dir
          /root/hive/tmp/${hive.session.id}_resources
          Temporary local directory for added resources in the remote file system.
        
      
      
          hive.server2.logging.operation.log.location
          /root/hive/tmp/root/operation_logs
          Top level directory where operation logs are stored if logging functionality is enabled
        
    
  • ブログ
      https://blog.csdn.net/wodedipang_/article/details/72718138
    
  • エラー:mysqlメタデータを読み込めません。標準のデータベースしか使えません。
  • 表示
      SLF4J: Class path contains multiple SLF4J bindings.
      SLF4J: Found binding in [jar:file:/root/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/root/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
      SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
      Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
      Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
      Metastore connection User:       APP
      Starting metastore schema initialization to 3.1.0
      Initialization script hive-schema-3.1.0.mysql.sql
      
      
      Error: Syntax error: Encountered "" 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
      Use --verbose for detailed
    
  • 解決
       hive-site.xml          (           ,    )
    
    
      
      javax.jdo.option.ConnectionUserName
      mysql  
      
      
      javax.jdo.option.ConnectionPassword
      mysql  
      
      
      javax.jdo.option.ConnectionURLmysql
      jdbc:mysql://localhost:3306/hive
      
      
      javax.jdo.option.ConnectionDriverName
      com.mysql.jdbc.Driver
       
      
      
      
      hive.metastore.schema.verification
      false
      
    
    
           
      schematool -initSchema -dbType mysql
    
  • $system:java.io.tmpdirは検索できないという意味です。
  • 説明
      hive> show databases;
      OK
      Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D
    
  • 解決
       hive-site.xml       -> /root/hive/tmp     
    
  • ブログのご案内
    https://www.cnblogs.com/dxxblog/p/8193967.html