我要评分
获取效率
正确性
完整性
易理解

Modifying the Hive Configuration Files

  1. All Hive configuration files are stored in the $HIVE_HOME/conf directory. Before modifying the configuration files, go to the $HIVE_HOME/conf directory first.
    1
    cd $HIVE_HOME/conf
    
  2. Modify the hive-env.sh file.
    1. Copy the Hive log configuration template file to generate an editable configuration file.
      1
      cp hive-env.sh.template hive-env.sh
      
    2. Open hive-env.sh.
      1
      vi hive-env.sh
      
    3. Press i to enter the insert mode and add the following content to the file:
      1
      2
      3
      export JAVA_HOME=/usr/local/jdk8u252-b09
      export HADOOP_HOME=/usr/local/hadoop
      export HIVE_CONF_DIR=/usr/local/hive/conf
      
    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Modify the hive-log4j2.properties log configuration file.
    1. Copy the Hive log configuration template file to generate an editable configuration file.
      1
      cp hive-log4j2.properties.template hive-log4j2.properties
      
    2. Open the hive-log4j2.properties file.
      1
      vi hive-log4j2.properties
      
    3. Press i to enter the insert mode and modify parameters in the hive-log4j2.properties file.
      1
      property.hive.log.dir = /usr/local/hive/log
      
    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Modify the hive-site.xml file.
    1. Change the name of the hive-default.xml.template file to hive-site.xml.
      1
      cp hive-default.xml.template hive-site.xml
      
    2. Run the following command to replace for&# with for to prevent encoding problems during initialization:
      1
      sed -i 's/for&#/for/g' hive-site.xml
      
    3. Open the file.
      1
      vi hive-site.xml
      
    4. Press i to enter the insert mode. Modify the values of related parameters in the hive-site.xml file or add the values to the end of the hive-site.xml file as follows.
      Set the user name, password, and ZooKeeper IP address and port.
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      <property>
          <name>javax.jdo.option.ConnectionURL</name>
          <value>jdbc:mysql://server1:3306/hive?createDatabaseIfNotExist=true</value>
      </property>
      <property>
          <name>javax.jdo.option.ConnectionDriverName</name>
          <value>com.mysql.jdbc.Driver</value>
      </property>
      <property>
          <name>javax.jdo.option.ConnectionUserName</name>
          <value>root</value>
      </property>
      <property>
          <name>javax.jdo.option.ConnectionPassword</name>
          <value>xxxxxxxx</value>
      <!--The password is the database password set when installing MariaDB.-->
      </property>
      <property>
          <name>hive.exec.local.scratchdir</name>
          <value>/tmp/hive</value>
      </property>
      <property>
          <name>hive.downloaded.resources.dir</name>
          <value>/tmp/${hive.session.id}_resources</value>
      </property>
      <property>
          <name>hive.querylog.location</name>
          <value>/tmp/hive</value>
      </property>
      <property>
          <name>hive.server2.logging.operation.log.location</name>
          <value>/tmp/hive/operation_logs</value>
      </property>
      <property>
          <name>hive.tez.exec.print.summary</name>
          <value>true</value>
      </property>
      <property>
          <name>hive.tez.container.size</name>
          <value>10240</value>
      </property>
      <property>
          <name>hive.exec.dynamic.partition.mode</name>
          <value>nonstrict</value>
      </property>
        <property>
          <name>hive.exec.max.dynamic.partitions</name>
          <value>100000</value>
        </property>
        <property>
          <name>hive.exec.max.dynamic.partitions.pernode</name>
          <value>100000</value>
        </property>
        <property>
          <name>hive.exec.max.created.files</name>
          <value>1000000</value>
        </property>
      <property>
          <name>hive.execution.engine</name>
          <value>tez</value>
      </property>
      <property>
          <name>hive.zookeeper.quorum</name>
          <value>agent1:2181,agent2:2181,agent3:2181</value>
      </property>
      
    5. Press Esc, type :wq!, and press Enter to save the file and exit.