码迷,mamicode.com
首页 > 数据库 > 详细

hadoop hive2.0 mysql本地仓库安装 错误解决

时间:2016-05-08 14:54:54      阅读:505      评论:0      收藏:0      [点我收藏+]

标签:

参考资料:

hive安装手册。

Hadoop2.7实战v1.0之Hive-2.0.0+MySQL远程模式安装  http://m.blog.itpub.net/30089851/viewspace-2082805/

 

安装环境

Ubuntu 12.04 server

java 1.7.0_95

hadoop 2.6.4

 

步骤:

1、安装mysql

直接使用命令安装:

更新源

sudo apt-get update

安装

sudo apt-get install mysql-server mysql-client

 

2、Mysql创建新用户以及数据库并授权

mysql> create database hive_remote_meta;
Query OK, 1 row affected (0.04 sec)

mysql> create user ‘hive‘ identified by ‘hive‘;
Query OK, 0 rows affected (0.05 sec)

mysql> grant all privileges on hive_remote_meta.* to ‘hive‘@‘%‘;
Query OK, 0 rows affected (0.03 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

查看Mysql监听地址

nestart -an | grep 3306
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN

结果如上即修改Mysql监听IP地址

sudo vim /etc/mysql/my.cnf


# localhost which is more compatible and is not less secure.
bind-address          = 127.0.0.1 #注释掉
#
# * Fine Tuning

 

3、安装hive

官网下载hive2.0安装包

解压到指定文件夹

sudo tar -zxvf apache-hive-2.0.0-bin.tar.gz -C /you_hive_path

配置环境变量

sudo vim ~/.bashrc
export HIVE_HOME=/you_hive_path/apache-hive-2.0.0-bin
export PATH=$PATH:$HIVE_HOME/bin

 

4、配置hive-size.xml文件,位于 HIVE_HOME下的conf中,新建。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
     
      <property>
     #设置为本地仓库 <name>hive.metastore.local</name> <value>true</value> </property> <property>
     #设置仓库地址, value更换为你创建的mysql数据库 <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://Master:3306/hive_remote_meta?characterEncoding=UTF-8</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property>
     #设置使用 JDBC <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> <property>
     #数据库用户名 <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> <description>username to use against metastore database</description> </property>
<property>
#数据库密码 <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> <description>password to use against metastore database</description> </property> </configuration>

 

5、初始化hive仓库

schematool -initSchema -dbType mysql

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/usr/local/hadoop/hive/apache-hive-2.0.0-bin/lib/hive-jdbc-2.0.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/hive/apache-hive-2.0.0-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:mysql://Master:3306/hive_remote_meta?createDatabaseIfNotExist=true
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: hive
Starting metastore schema initialization to 2.0.0
Initialization script hive-schema-2.0.0.mysql.sql
Initialization script completed
schemaTool completed

 

6、启动

hive

hive>

若出现

Name node is in safe mode.

则关闭hdfs安全模式

hadoop dfsadmin -safemode leave

 

 

完。

 

hadoop hive2.0 mysql本地仓库安装 错误解决

标签:

原文地址:http://www.cnblogs.com/yicoder/p/5470491.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!