Hive安装_独立模式
2015-11-20 00:00
393 查看
这时候需要独立数据库,这里使用mysql
上传mysql和mysql驱动
[hadoop@master conf]$ pwd
/home/hadoop/hive/conf
修改配置文件,如果没有修改都是从hivedefault配置文件中读取相应的信息。
[hadoop@master ~]$ su - root
口令:
aa
[root@master ~]# cd installer/
[root@master installer]# ls
jdk-6u27-linux-i586.rpm sun-javadb-common-10.6.2-1.1.i386.rpm
jdk-6u27-linux-i586-rpm.bin sun-javadb-core-10.6.2-1.1.i386.rpm
MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar sun-javadb-demo-10.6.2-1.1.i386.rpm
mysql-connector-java-5.1.29.tar.gz sun-javadb-docs-10.6.2-1.1.i386.rpm
sun-javadb-client-10.6.2-1.1.i386.rpm sun-javadb-javadoc-10.6.2-1.1.i386.rpm
[root@master installer]# mv mysql-connector-java-5.1.29.tar.gz /home/hadoop/installer/
[root@master installer]# mv MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar /home/hadoop/installer/
[root@master installer]# chown hadoop mysql-connector-java-5.1.29.tar.gz
[root@master installer]# chown hadoop MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar
[root@master installer]#
解压
[root@master installer]# tar xf MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar
[hadoop@master installer]$ tar xzf mysql-connector-java-5.1.29.tar.gz
Mysql解压出来的包比较多,我们单独建立一个文件夹
[root@master installer]# mkdir mysql
[root@master installer]# mv MySQL-* mysql
[root@master installer]# cd mysql
[root@master mysql]# pwd
/home/hadoop/installer/mysql
[root@master mysql]#
安装注意使用root用户
[root@master installer]# cd mysql
[root@master mysql]# pwd
/home/hadoop/installer/mysql
[root@master mysql]# rpm -ivh MySQL-server-5.5.40-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h master password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
[root@master mysql]#
[root@master mysql]# rpm -ivh MySQL-devel-5.5.40-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
[root@master mysql]# rpm -ivh MySQL-client-5.5.40-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@master mysql]#
[root@master mysql]# service mysql status
MySQL is not running [失败
[root@master mysql]# service mysql start
Starting MySQL... [确定]
[root@master mysql]#
更改密码
[root@master mysql]# /usr/bin/mysqladmin -u root password '123456'
登陆mysql
[root@master mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> set password=password('123456');
Query OK, 0 rows affected (0.01 sec)
这样也能
为hive创建数据库和用户
mysql> grant all on *.* to mysql@'%' identified by 'mysql' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql>grant all on *.* to hadoop@'localhost' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@master mysql]#
[root@master mysql]# mysql -uhadoop -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 30
Server version: 5.5.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> create database hive;
Query OK, 1 row affected (0.05 sec)
配置
[root@master ~]# su - hadoop
[hadoop@master ~]$ cd hive
[hadoop@master hive]$ cd conf
[hadoop@master conf]$ cd ..
[hadoop@master hive]$ cd bin
[hadoop@master bin]$ ls
beeline ext hive hive-config.sh hiveserver2 metatool
[hadoop@master bin]$ vim hive-config.sh
[hadoop@master bin]$ pwd
/home/hadoop/hive/bin
拉到最后添加下面三条信息
export JAVA_HOME=/usr/java/jdk1.6.0_27
export HADOOP_HOME=/home/hadoop/hadoop
export HIVE_HOME=/home/hadoop/hive
[hadoop@master conf]$ cp hive-default.xml.template hive-site.xml
[hadoop@master conf]$ vim hive-site.xml
130 <property>
131 <name>javax.jdo.option.ConnectionURL</name>
132 <value>jdbc:mysql://localhost:3306/hive?=createDatabaseIfNotExsit=true</value>
133 <description>JDBC connect string for a JDBC metastore</description>
134 </property>
135
136 <property>
137 <name>javax.jdo.option.ConnectionDriverName</name>
138 <value>com.mysql.jdbc.Driver</value>
139 <description>Driver class name for a JDBC metastore</description>
140 </property>
141
160 <property>
161 <name>javax.jdo.option.ConnectionUserName</name>
162 <value>hadoop</value>
163 <description>username to use against metastore database</description>
164 </property>
165
166 <property>
167 <name>javax.jdo.option.ConnectionPassword</name>
168 <value>123456</value>
169 <description>password to use against metastore database</description>
170 </property>
171
拷贝驱动
[hadoop@master mysql-connector-java-5.1.29]$ pwd
/home/hadoop/installer/mysql-connector-java-5.1.29
[hadoop@master mysql-connector-java-5.1.29]$ cp mysql-connector-java-5.1.29-bin.jar /home/hadoop/hive/lib/
[hadoop@master mysql-connector-java-5.1.29]$
[hadoop@master conf]$ hive
Logging initialized using configuration in jar:file:/home/hadoop/hive-0.11.0/lib/hive-common-0.11.0.jar!/hive-log4j.properties
Hive history file=/tmp/hadoop/hive_job_log_hadoop_32276@master_201411130616_948032439.txt
hive> show tables;
OK
Time taken: 3.847 seconds
上传mysql和mysql驱动
[hadoop@master conf]$ pwd
/home/hadoop/hive/conf
修改配置文件,如果没有修改都是从hivedefault配置文件中读取相应的信息。
[hadoop@master ~]$ su - root
口令:
aa
[root@master ~]# cd installer/
[root@master installer]# ls
jdk-6u27-linux-i586.rpm sun-javadb-common-10.6.2-1.1.i386.rpm
jdk-6u27-linux-i586-rpm.bin sun-javadb-core-10.6.2-1.1.i386.rpm
MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar sun-javadb-demo-10.6.2-1.1.i386.rpm
mysql-connector-java-5.1.29.tar.gz sun-javadb-docs-10.6.2-1.1.i386.rpm
sun-javadb-client-10.6.2-1.1.i386.rpm sun-javadb-javadoc-10.6.2-1.1.i386.rpm
[root@master installer]# mv mysql-connector-java-5.1.29.tar.gz /home/hadoop/installer/
[root@master installer]# mv MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar /home/hadoop/installer/
[root@master installer]# chown hadoop mysql-connector-java-5.1.29.tar.gz
[root@master installer]# chown hadoop MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar
[root@master installer]#
解压
[root@master installer]# tar xf MySQL-5.5.40-1.rhel5.i386.rpm-bundle.tar
[hadoop@master installer]$ tar xzf mysql-connector-java-5.1.29.tar.gz
Mysql解压出来的包比较多,我们单独建立一个文件夹
[root@master installer]# mkdir mysql
[root@master installer]# mv MySQL-* mysql
[root@master installer]# cd mysql
[root@master mysql]# pwd
/home/hadoop/installer/mysql
[root@master mysql]#
安装注意使用root用户
[root@master installer]# cd mysql
[root@master mysql]# pwd
/home/hadoop/installer/mysql
[root@master mysql]# rpm -ivh MySQL-server-5.5.40-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h master password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
[root@master mysql]#
[root@master mysql]# rpm -ivh MySQL-devel-5.5.40-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
[root@master mysql]# rpm -ivh MySQL-client-5.5.40-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@master mysql]#
[root@master mysql]# service mysql status
MySQL is not running [失败
[root@master mysql]# service mysql start
Starting MySQL... [确定]
[root@master mysql]#
更改密码
[root@master mysql]# /usr/bin/mysqladmin -u root password '123456'
登陆mysql
[root@master mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> set password=password('123456');
Query OK, 0 rows affected (0.01 sec)
这样也能
为hive创建数据库和用户
mysql> grant all on *.* to mysql@'%' identified by 'mysql' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql>grant all on *.* to hadoop@'localhost' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@master mysql]#
[root@master mysql]# mysql -uhadoop -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 30
Server version: 5.5.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> create database hive;
Query OK, 1 row affected (0.05 sec)
配置
[root@master ~]# su - hadoop
[hadoop@master ~]$ cd hive
[hadoop@master hive]$ cd conf
[hadoop@master conf]$ cd ..
[hadoop@master hive]$ cd bin
[hadoop@master bin]$ ls
beeline ext hive hive-config.sh hiveserver2 metatool
[hadoop@master bin]$ vim hive-config.sh
[hadoop@master bin]$ pwd
/home/hadoop/hive/bin
拉到最后添加下面三条信息
export JAVA_HOME=/usr/java/jdk1.6.0_27
export HADOOP_HOME=/home/hadoop/hadoop
export HIVE_HOME=/home/hadoop/hive
[hadoop@master conf]$ cp hive-default.xml.template hive-site.xml
[hadoop@master conf]$ vim hive-site.xml
130 <property>
131 <name>javax.jdo.option.ConnectionURL</name>
132 <value>jdbc:mysql://localhost:3306/hive?=createDatabaseIfNotExsit=true</value>
133 <description>JDBC connect string for a JDBC metastore</description>
134 </property>
135
136 <property>
137 <name>javax.jdo.option.ConnectionDriverName</name>
138 <value>com.mysql.jdbc.Driver</value>
139 <description>Driver class name for a JDBC metastore</description>
140 </property>
141
160 <property>
161 <name>javax.jdo.option.ConnectionUserName</name>
162 <value>hadoop</value>
163 <description>username to use against metastore database</description>
164 </property>
165
166 <property>
167 <name>javax.jdo.option.ConnectionPassword</name>
168 <value>123456</value>
169 <description>password to use against metastore database</description>
170 </property>
171
拷贝驱动
[hadoop@master mysql-connector-java-5.1.29]$ pwd
/home/hadoop/installer/mysql-connector-java-5.1.29
[hadoop@master mysql-connector-java-5.1.29]$ cp mysql-connector-java-5.1.29-bin.jar /home/hadoop/hive/lib/
[hadoop@master mysql-connector-java-5.1.29]$
[hadoop@master conf]$ hive
Logging initialized using configuration in jar:file:/home/hadoop/hive-0.11.0/lib/hive-common-0.11.0.jar!/hive-log4j.properties
Hive history file=/tmp/hadoop/hive_job_log_hadoop_32276@master_201411130616_948032439.txt
hive> show tables;
OK
Time taken: 3.847 seconds
相关文章推荐
- getOutputStream() has already been called 异常
- PHP性能分析 xhprof
- 用python简单实现将整数转化为英文字符串
- 学习 kityminder 笔记(七)
- 附件在客户端打开或下载
- Java网络学习笔记4:ServerSocket用法
- IOS 百度地图使用问题(动画同时执行)
- ios 百度地图 使用详解
- Centos安装SVN以及配置
- ubuntu 部署 dubbo
- sqlserver作业--嵌套查询
- asp.net mvc开发中,web.config文件如何配置数据库链接
- 关于sql server之sa登录失败的解决办法
- 关于asp.net MVC发布后,网站无法读取数据库的问题
- Cyber Physics System
- Java PinBall 简单弹球小游戏【4】碰撞检测及边界检测
- 使用ember-simple-auth实现Ember.js应用的权限控制
- Spring mvc 中使用 kaptcha 验证码
- 理解 HTTPS 原理,SSL/TLS 协议
- hbase二级索引相关资料