Hive cluster installation (hive-2.1.0)

Source: Internet
Author: User
Tags character set chmod mixed mkdir hdfs dfs
apache-hive-2.1.0 Installation Installing Hive

Install the Namenode on Hadoop and copy the installation files to Linux/usr/hadoop/apache-hive-2.1.0-bin.tar.gz

Extract:

TAR–ZXVF apache-hive-2.1.0-bin.tar.gz

Add to environment variable

Vi/etc/profile

Edit

#hive

Export Hive_home=/usr/hadoop/apache-hive-2.1.0-bin

Export path= $PATH: $HIVE _home/bin

Keep it in effect after saving:

Source/etc/profile

installing MySQL as Hive's Metastore

First check if MySQL is installed:

Rpm-qa | Grep-i MySQL

Results:

Mysql-libs-5.1.71-1.el6.x86_64

Remove the installed MySQL

Yum-y Remove mysql-libs*

Tar xvf Mysql-5.5.49-1.linux2.6.x86_64.rpm-bundle.tar

rpm-ivhmysql-server-5.5.49-1.linux2.6.x86_64.rpm

rpm-ivhmysql-devel-5.5.49-1.linux2.6.x86_64.rpm

rpm-ivhmysql-client-5.5.49-1.linux2.6.x86_64.rpm

Start MySQL

Service Mysqlstart

When you first install, the default password is blank, you can use the following command to modify the root password

Mysqladmin-uroot Password MyPassword

MyPassword The new password you set for you

Log in to MySQL

Mysql-u root–p

RPM package installed MySQL is not installed/etc/my.cnf files, the solution, only need to copy the/usr/share/mysql directory my-huge.cnf files to/etc directory, and renamed to MY.CNF can

Cp/usr/share/mysql/my-huge.cnf/etc/my.cnf

MySQL defaults to remote access, set remote access

--grant all privileges on * * to ' root ' @ '% ' with GRANT OPTION;

The above sentence remote Access does not require a password, if you need a password to use the following sentence

GRANT allprivileges on * * to ' root ' @ '% ' identified by ' sa ' with GRANT OPTION;

To enable permissions to take effect:

FLUSH privileges;

Set the etc/my.cnf file so that binlog_format=mixed

VI etc/my.cnf

Remove the comment from the comment binlog_format=mixed and save it and restart MySQL

Service Mysqlrestart Configuring hive

Create a new directory in HDFs/user/hive/warehouse

HDFs dfs–mkdir/tmp

HDFs Dfs–mkdir/user

HDFs dfs–mkdir/user/hive

HDFs dfs–mkdir-p/user/hive/warehouse

HDFs Dfs-chmod g+w/tmp

HDFs Dfs-chmod G+w/user/hive/warehouse

Copy the MySQL driver jar package Mysql-connector-java-5.1.7-bin.jar into the Hive's Lib directory

Go to hive under the Conf directory and copy the hive-default.xml.template name named: hive-site.xml

CP Hive-default.xml.template Hive-site.xml

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>

<DESCRIPTION>JDBC connect string for a jdbcmetastore</description>

</property>

<property>

<name>javax.jdo.option.ConnectionDriverName</name>

<value>com.mysql.jdbc.Driver</value>

<description>driver class name for a jdbcmetastore</description>

</property>

<property>

<name>javax.jdo.option.ConnectionUserName</name>

<value>root</value>

<description>username to use against metastoredatabase</description>

</property>

<property>

<name>javax.jdo.option.ConnectionPassword</name>

<value>123456</value>

<description>password to use against metastoredatabase</description>

</property>

<property>

<name>hive.exec.local.scratchdir</name>

<value>/usr/hadoop/apache-hive-2.1.0-bin/tmp</value>

<description>local scratch space for Hive jobs</description>

</property>

<property>

<name>hive.downloaded.resources.dir</name>

<value>/usr/hadoop/apache-hive-2.1.0-bin/tmp/resources</value>

<description>temporary Local directory for added resources in theremote file system.</description>

</property>

<property>

<name>hive.querylog.location</name>

<value>/usr/hadoop/apache-hive-2.1.0-bin/tmp/querylog</value>

<description>location of Hive run time structured logfile</description>

</property>

<property>

<name>hive.server2.logging.operation.log.location</name>

<value>/usr/hadoop/apache-hive-2.1.0-bin/tmp/operation_logs</value>

<description>toplevel directory where operation logs is stored if logging functionality isenabled</description >

</property>

Use Schematool to initialize the schema of the Metastore:

Schematool-initschema-dbtype MySQL

To start the hive command:

In the first window, type: Hive--service hiveserver2 or Hiveserver2

Then open a window input: beeline-u jdbc:hive2://localhost:10000-n root

ALTER DATABASE hive character set latin1;

Setcharacter_set_client=latin1;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.