yanqiufang 发表于 2018-10-31 12:50:23

Hadoop+hive 集群安装部署 (三)

  这节我来介绍在hadoop集群里如何安装hive,
  hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供完整的sql查询功能,可以将sql语句转换为MapReduce任务进行运行。 其优点是学习成本低,可以通过类SQL语句快速实现简单的MapReduce统计,不必开发专门的MapReduce应用,十分适合数据仓库的统计分析。
  版本:
  hive-0.9.0
  安装很简单,只需将下载的包放到相应的目录下,主要是配置文件的配置:
  1hive-env.sh
  在最后加上以下几行:
  export PATH=$PATH:/home/hadoop/hive-0.9.0/bin
  export HADOOP_HOME=/home/hadoop/hadoop
  export HIVE_HOME=/home/hadoop/hive-0.9.0
  export JAVA_HOME=/usr/local/java/jdk1.6.0_24
  2hive-site.xml(hive 的元数据放到了远程Mysql数据库中,如果不这样做,那么hive可能不支持并发)
  
  
  javax.jdo.option.ConnectionURL
  jdbc:mysql://10.129.8.50:3306/hive?characterEncoding=UTF-8
  JDBC connect string for a JDBC metastore
  
  
  javax.jdo.option.ConnectionDriverName
  com.mysql.jdbc.Driver

  Driver>  
  
  javax.jdo.option.ConnectionUserName
  hive
  username to use against metastore database
  
  
  javax.jdo.option.ConnectionPassword
  000000
  password to use against metastore database
  
  
  hive.metastore.uris
  thrift://master:50000
  
  
  hive.hwi.war.file
  lib/hive-hwi-0.9.0.war

  This sets the path to the HWI war file,>  
  
  hive.hwi.listen.host
  0.0.0.0
  This is the host address the Hive Web Interface will listen on
  
  
  hive.hwi.listen.port
  9999
  This is the port the Hive Web Interface will listen on
  
  
  hive.metastore.warehouse.dir
  /home/hive/warehouise
  location of default database for the warehouse
  
  
  hive.exec.scratchdir
  /home/tmp/hive-${user.name}
  Scratch space for Hive jobs
  
  
  hive.metastore.uris
  thrift://master:5000
  
  3 nohup /home/hadoop/hive-0.9.0/bin/hive --service hiveserver &后台启动hive 默认监听的端口是10000
  4/home/hadoop/hive-0.9.0/bin/hive 可以进入到hive的命令行模式中,
  直接执行相应的hql语句,
  注意:有时候启动的时候报错,需要把hadoop的安装路径下的build 目录重命名掉,这应该是一个bug
  下一节讲实际点的,利用hadoop 和hive python 来分析iis日志,最后将分析出来的日志存入到hive中

页: [1]
查看完整版本: Hadoop+hive 集群安装部署 (三)