Install Hive on CENTOS6.5

This article mainly describes the installation of Hive on CentOS6.5 and the problems and solutions encountered during the installation process. It is divided into three parts: MySQL installation, Hive installation configuration and testing, problems encountered and solutions.

1. Install MySQL

1. Download MySQL

   Go to MySQL official website: https://dev.mysql.com/downloads/mysql/5.5.html#downloads to download MySQL5.5.57

2. Install MySQL

   First check whether MySQL is installed, and execute rpm -qa|grep MySQL to check whether MySQL is installed. If the MySQL that comes with the system has been installed, you need to execute rpm -e --nodeps to uninstall it, and install it after the uninstallation is complete.

   rpm -ivh MySQL-server-5.5.57-1.el7.x86_64.rpm, rpm -ivh MySQL-client-5.5.57-1.el7.x86_64.rpm, mainly for these two, if you need to rely on the installation process For other rpm packages, please install them yourself.

    After the installation is complete, start and set the boot to start automatically

    [root@hadoop ~]# service mysql start

    Set the root user's password

    [root@hadoop ~]# mysql –uroot

    mysql>update mysql.user set password=PASSWORD('root@123 ') where User='root';

    mysql> flush privileges;

    Set up to start automatically

    [root@hadoop ~]# chkconfig --level 2345 mysql on

3. Create hive user and library

      [root@hadoop ~]# mysql –uroot -proot@123

     mysql>insert into mysql.user(Host,User,Password) values("localhost","hive",password("hive"));

    mysql>create database hive;
    mysql>grant all on hive.* to hive@'%'  identified by 'hive';
    mysql>grant all on hive.* to hive@'localhost'  identified by 'hive';
    mysql>flush privileges; 
    mysql>exit;
    Authenticate hive user
     

 2. Install Hive
1. Download Hive
    The hive-2.11 version is used in the installation process of this article. The download address is https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-2.1.1/ , and the download file is apache-hive-2.1.1 -bin.tar.gz.
2. Install Hive
  Upload the downloaded file to the /opt directory of CentOS and switch to the /opt directory to extract the installation package
  cd / opt
  tar -zxvf  apache-hive-2.1.1-bin.tar.gz
 Create soft links
  ln -s  apache-hive-2.1.1-bin hive
 Modify environment variables
  vim /etc/profile
 Add the following
   export HIVE_HOME=/opt/hive
  export PATH=$PATH:$HIVE_HOME/bin
  Exit after modification, source /etc/profile to make it take effect immediately
  Modify the configuration file
  cp hive-default.xml.template hive-site.xml
  vim hive-site.xml
  First clear the content in the middle of the <configuration></configuration> tag and add the following content
<property> 
   <name>javax.jdo.option.ConnectionURL</name> 
   <value>jdbc:mysql://localhost:3306/hive</value> 
</property> 
<property> 
   <name>javax.jdo.option.ConnectionDriverName</name> 
   <value>com.mysql.jdbc.Driver</value> 
</property>
<property> 
   <name>javax.jdo.option.ConnectionPassword</name> 
   <value>hive</value> 
</property> 
<property> 
   <name>hive.hwi.listen.port</name> 
   <value>9999</value> 
   <description>This is the port the Hive Web Interface will listen on</description> 
</property> 
<property> 
   <name>datanucleus.autoCreateSchema</name> 
   <value>true</value> 
</property> 
<property> 
<name>datanucleus.fixedDatastore</name> 
   <value>false</value> 
</property> 
<property>
<name>javax.jdo.option.ConnectionUserName</name>
  <value>hive</value>
  <description>Username to use against metastore database</description>
</property>
<property>
  <name>hive.exec.local.scratchdir</name>
  <value>/opt/hive/iotmp</value>
  <description>Local scratch space for Hive jobs</description>
</property>
<property>
  <name>hive.downloaded.resources.dir</name>
  <value>/opt/hive/iotmp</value>
  <description>Temporary local directory for added resources in the remote file system.</description>
</property>
<property>
  <name>hive.querylog.location</name>
  <value>/opt/hive/iotmp</value>
  <description>Location of Hive run time structured log file</description>
</property>
  Copy mysql-connector-java-5.1.38.jar and jline-2.12.jar to the lib directory of hive
  Create a temporary directory for hive runtime
  mkdir /opt/hive/iotmp
3. Verify the installation


 
So far, the installation and operation of the stand-alone version of Hive has been completed. Before installation, Hadoop-2.7.3 has been installed on the local machine.
3. Problems encountered during installation and solutions
The following error occurred when the installation was completed and verified:


 At this point, you need to modify hive-site.xml and add the following configuration
<property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
  </property>
At this time, when verifying again, the following error occurs:


 At this point, you need to execute the following command
 
[root@hadoop conf]# schematool -dbType mysql -initSchema
At this point, it is completely correct when verifying again.
The above is the whole process of installing Hive and the errors I encountered, which are sorted out here for your reference.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326295979&siteId=291194637