Bind hive to a local mysql database

Source: Internet
Author: User

Bind hive to a local mysql database

I suddenly wrote an article about changing the hive metadatabase from the default local derby to bind to a remote mysql database. I flipped through the cloud notes and found that it was actually true, share it with you now ~~

Environment:
Operating System: Centos6.5mysql: 5.6 hive: 0.13.1hadoop: 1.2.1

1. Configure mysql
1. Install mysql (refer to centos mysql installation and configuration (non-default installation)

2. Create a hive metadatabase in mysql named hiveMysql> create database hive;

3. Authorize Hadoopuser <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vc3Ryb25nPgoKPHA + forward + CjxwPjxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20150530/20150530094337178.png" alt = "\">

Ii. install and configure hive

1. Install hive

Rename hive

2. Configure hive

Configure hive environment variables:

# Vim/etc/profile

After modification and saving, remember the source.

# Source/etc/profile

Copy A hive-env.sh.template template to rename it as a hive-env.sh and modify the content:

# Cp hive-env.sh.template hive-env.sh

# Vim hive-env.sh.

Modify hadoop_home to the hadoop installation path.

Copy A hive-default.xml.template and rename it as a hive-site.xml

# Cp hive-default.xml.template hive-site.xml

# Vim hive-site.xml.

Change the following in the hive-site.xml:

Note:

<Property>

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

<Value> jdbc: mysql: // localhost/hive? CreateDatabaseIfNotExist = true </value>

<Description> JDBC connect string for a JDBC metastore </description>

</Property>

The highlighted location is the mysql database name used. Therefore, you must grant all permissions to the mysql user on hive.

Here is the username and password for logging on to mysql. It was previously set in mysql and granted sufficient permissions.

The missing mysql-connector-java-5.1.34.tar.gz package in the libdirectory under the hiveinstallation directory.

: Http://ftp.jaist.ac.jp/pub/mysql/Downloads/Connector-J/

(Previously, this file was put in the sqoop directory, So copy it directly from there)

Switch to the hvie directory and start the metadata service process.

Hive #./bin/hive -- service metastore

Create a connection or terminal and go to hive:

Successful! Then you can use hive to perform the operation.

About


WARN conf. HiveConf: DEPRECATED: hive. metastore. ds. retry. * no longer has any effect. Use hive. hmshandler. retry. * instead

Solution:

Replace hive. metastore. ds. retry with hive. hmshandler. retry in the configuration file hive-site.xml under hive

Then there will be no such warning.

Zookeeper

Related Article

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.