Hive安装
软件需求与环境说明
假设已经搭建好 Hadoop-2.6.0 环境,并能正常运行
mysql 安装软件
服务端:MySQL-server-5.5.16-1.rhel5.x86_64.rpm
客户端:MySQL-client-5.5.16-1.rhel5.x86_64.rpm
hive安装软件:apache-hive-1.2.1-bin.tar.gz
Java 连接 MySQL 驱动软件: mysql-connector-java-5.1.17-bin.jar
安装mysql
使用 rpm -ivh MySQL-server-5.5.16-1.rhel5.x86_64.rpm 安装服务端
使用 rpm -ivh MySQL-client-5.5.16-1.rhel5.x86_64.rpm 安装客户端
在命令行界面输入 mysql 命令,进入 MySQL 界面,新增 hive 用户,并赋予权限,以后 Hive 就使用该用户登录 MySQL
create database hive;
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' IDENTIFIED BY 'hadoop01' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost' IDENTIFIED BY 'hadoop01' WITH GRANT OPTION;
flush privileges;
alter database hive character set latin1;
使用 hive 登录 MySQL: mysql -u hive -p;
注意:如果已经安装mysql需要先卸载,需要修改root密码再进行操作,具体见mysql安装笔记
安装Hive
把 apache-hive-1.2.1-bin.tar 解压至 /home/cluster 目录下,并重命名为 hive
把 mysql-connector-java-5.1.17-bin.jar 拷贝到 /home/cluster/hive/lib 目录下
配置环境变量或者hive-env.sh
export HIVE_HOME=/home/cluster/hive
export PATH=$HIVE_HOME/bin:$PATH
hive-site.xml
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
javax.jdo.option.ConnectionURL
jdbc:mysql://192.168.56.13/hive?createDatabaseIfNotExist=true
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
hive
javax.jdo.option.ConnectionPassword
hadoop01
datanucleus.autoCreateSchema
false
datanucleus.autoCreateTables
true
hive.metastore.schema.verification
false
hive命令行下,set javax.jdo.option.ConnectionURL 检查是否是连接到 mysql
hive客户端安装
hive服务端安装好之后,服务端如何连接使用?
* 服务端需要启动hive metastore服务,客户端才能远程使用hive元信息
hive --service metastore -p
如果不加端口默认启动:hive –service metastore,则默认监听端口是:9083
客户端hive-site.xml配置
hive.metastore.uris
thrift://192.168.56.10:9083
Thrift uri for the remote metastore. Used by metastore client to connect to remote metastore.
hive.metastore.client.socket.timeout
3600
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
喜欢 (1)or分享 (0)