Mac OSX on Brew install hive

Source: Internet
Author: User

This article describes the Brew install hive and modifies the default Metastore storage scheme, changing the Derby database to the MySQL method and the solution to the problems that may be encountered.

1. Installing hive via Homebrew

1 brewinstallhive

2. Add environment variables for Hadoop and hive

123456 sudovim ~/.bash_profile export HADOOP_HOME=/usr/local/Cellar/hadoop/hadoop.version.noexport HIVE_HOME=/usr/local/Cellar/hive/hive.version.no/libexec source~/.bash_profile

3. Download MySQL connector

123 curl -L‘http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.22.tar.gz/from/http://mysql.he.net/‘ | tar xz sudo cp mysql-connector-java-5.1.15/mysql-connector-java-5.1.22-bin.jar/usr/local/Cellar/hive/hive.version.no/libexec/lib/

4. Create MySQL metastore

1234 mysql>CREATE DATABASE metastore;mysql> USE metastore;mysql> CREATE USER ‘hiveuser‘@‘localhost‘ IDENTIFIED BY ‘password‘;mysql> GRANT SELECT,INSERT,UPDATE,DELETE,ALTER,CREATE ON metastore.* TO‘hiveuser‘@‘localhost‘;

5. Configure configuration files for hive

123456789101112131415161718192021222324 cd /usr/local/Cellar/hive/hive.version.no/libexec/confcp hive-default.xml.template hive-site.xml#添加或者编辑如下内容<property>  <name>javax.jdo.option.ConnectionURL</name>  <value>jdbc:mysql://localhost/metastore</value></property><property>  <name>javax.jdo.option.ConnectionDriverName</name>  <value>com.mysql.jdbc.Driver</value></property><property>  <name>javax.jdo.option.ConnectionUserName</name>  <value>hiveuser</value></property><property>  <name>javax.jdo.option.ConnectionPassword</name>  <value>password</value></property><property>  <name>datanucleus.fixedDatastore</name>  <value>false</value></property>

6. Test whether Hive is working

123 $ hive;hive > show tables;hive> create table temp_table temp_col string;

7. Revoke Few permissions on the MySQL metastore

12 $ mysqlmysql> REVOKE ALTER,CREATE ON metastore.* FROM‘hiveuser‘@‘localhost‘;

9. Further troubleshooting:
(a) If you get a bin log error saying statement format was not support. Login to your MySQL console as root

$ mysql-urootmysql > SET GLOBAL binlog_format = ' ROW ';

(b) You could also try reading the logs as follows. Logs can emitted to the bash prompt and running hive by setting Hive.root.logger to Info,console.

$ hive-hiveconf Hive.root.logger=info,console

(c) You could also read the RAW hive logs which are usually located at/tmp/user_name/hive.log

(d) If you still has any errors, feel free to comment. problem solutions that you may encounter after configuration is complete: One, Reference error solution: Use sequel Pro, modify the permissions of the hive user, and add Reference global permissions. Second, "caused by:java.net.URISyntaxException:Relative path in absolute URI: ${system:java.io.tmpdir%7d/$%" encountered when starting hive 7bsystem:user.name%7d "Solution: Modify the following key value in the Hive-site.xml configuration: <name>hive.exec.scratchdir</name>< Value>/tmp/hive-${user.name}</value> <name>hive.exec.local.scratchdir</name> <value>/ Tmp/${user.name}</value> <name>hive.downloaded.resources.dir</name><value>/tmp/${ User.name}_resources</value> <name>hive.scratch.dir.permission</name> <value>733</ value> Restart Hive Metastore and Hiveserver2

Mac OSX on Brew install hive

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.