hive的安装和升级

目录

  1. 安装
  2. 升级

安装

nohup hive –service hiveserver  &

启动:

sudo nohup ./hive --service metastore &-----------Startup Hive Embedded(如果metastore配置成 remote方式 那就应该把metastore也启动) 测试standalone,必须用remote mysql那种设置

  • 1,hive 命令行模式。
    • 直接输入/hive/bin/hive的执行程序
    • 或者输入 hive –service cli 用于linux平台命令行查询,查询语句基本跟mysql查询语句类似
  • 2, hive web界面的启动方式,hive –service hwi
    用于通过浏览器来访问hive,感觉没多大用途
  • 3, hive 远程服务 (端口号10000) 启动方式,nohup hive –service hiveserver &
    用java等程序实现通过jdbc等驱动的访问hive就用这种起动方式了,这个是程序员最需要的方式了.启动hive service :$HIVE_HOME/bin/hive --service hiveserver 10001 >/dev/null 2>/dev/null &
    参考:调用javaAPI访问hive

参考:
hive-1.2.1安装步骤

升级

目标

  • 对hive从0.14.0升级到1.2.1,
  • 集群中使用了hue,升级后检查hue是否能够正常。

整个过程如下

  • 检查环境、当前配置
  • 当前运行情况
  • 下载最新版
  • 上传并替换现有目录
    • 用最新的密码。在金山云主机.XLS
    • 在登录生产线的时候选择sftp协议
  • 修改配置文件
  • 修改权限为hive
  • 启动
  • 升级参考

检查环境

hive、hue都是只用部署在一个节点上的,只考虑一个节点,确认下安装位置。
配置文件
确定hue安装节点

[kduser@master1 conf]$ netstat -ano | grep 9401
tcp        0      0 0.0.0.0:9401                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 10.63.7.30:9401             219.133.170.76:60402        TIME_WAIT   timewait (14.46/0/0)
tcp        0      0 10.63.7.30:9401             219.133.170.76:50811        ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:9401             219.133.170.172:8322        ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:9401             219.133.170.76:19791        TIME_WAIT   timewait (44.73/0/0)
tcp        0      0 10.63.7.30:9401             219.133.170.76:39595        ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:9401             219.133.170.76:2382         ESTABLISHED off (0.00/0/0)

确定hive的安装节点

[kduser@master1 conf]$ netstat -ano | grep 9300
tcp        0      0 10.63.7.30:9300             0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 10.63.7.30:9300             10.63.7.30:48307            ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:9300             10.63.7.30:64415            ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:7435             10.63.7.30:9300             ESTABLISHED off (0.00/0/0)
tcp        1      0 10.63.7.30:41196            10.63.7.30:9300             CLOSE_WAIT  off (0.00/0/0)
tcp        0      0 10.63.7.30:64428            10.63.7.30:9300             ESTABLISHED off (0.00/0/0)
tcp        1      0 10.63.7.30:34734            10.63.7.30:9300             CLOSE_WAIT  off (0.00/0/0)
tcp        0      0 10.63.7.30:53330            10.63.7.30:9300             ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:48307            10.63.7.30:9300             ESTABLISHED off (0.00/0/0)
tcp        1      0 10.63.7.30:32012            10.63.7.30:9300             CLOSE_WAIT  off (0.00/0/0)
tcp        0      0 10.63.7.30:9300             10.63.7.30:64428            ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:64415            10.63.7.30:9300             ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:54545            10.63.7.30:9300             ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:9300             10.63.7.30:7435             ESTABLISHED off (0.00/0/0)
tcp        1      0 10.63.7.30:32153            10.63.7.30:9300             CLOSE_WAIT  off (0.00/0/0)
tcp        0      0 10.63.7.30:9300             10.63.7.30:53330            ESTABLISHED off (0.00/0/0)
tcp        0      0 10.63.7.30:9300             10.63.7.30:54545            ESTABLISHED off (0.00/0/0)

查看hue的目录

[kduser@master1 hue]$ cd hue
[kduser@master1 hue]$ ll
total 80
-rw-rw-r--  1 hue hue  2782 Jun 17  2015 app.reg
drwxrwxr-x 22 hue hue  4096 Jun 17  2015 apps
drwxrwxr-x  4 hue hue  4096 Jun 17  2015 build
drwxrwxr-x  5 hue hue  4096 Jun 17  2015 desktop
drwxrwxr-x  3 hue hue  4096 May  4  2015 ext
-rw-rw-r--  1 hue hue 11358 May  4  2015 LICENSE.txt
drwxrwxr-x  2 hue hue  4096 Apr  7 13:56 logs
-rw-rw-r--  1 hue hue  4715 May  4  2015 Makefile
-rw-rw-r--  1 hue hue    44 Jun 17  2015 Makefile.buildvars
-rw-rw-r--  1 hue hue  8505 May  4  2015 Makefile.sdk
-rw-rw-r--  1 hue hue  3498 May  4  2015 Makefile.vars
-rw-rw-r--  1 hue hue  2192 May  4  2015 Makefile.vars.priv
-rw-rw-r--  1 hue hue  1562 May  4  2015 README
drwxrwxr-x  4 hue hue  4096 Jun 17  2015 tools
-rw-rw-r--  1 hue hue   932 May  4  2015 VERSION
[kduser@master1 hue]$ cd desktop/
[kduser@master1 desktop]$ ll
total 244
drwxrwxr-x  2 hue hue   4096 Nov 28 17:56 conf
drwxrwxr-x  4 hue hue   4096 Jun 17  2015 core
-rw-r--r--  1 hue hue 227328 Jun 17  2015 desktop.db
drwxrwxr-x 11 hue hue   4096 Jun 17  2015 libs
-rw-rw-r--  1 hue hue   3400 May  4  2015 Makefile
[kduser@master1 desktop]$ cd  conf/
[kduser@master1 conf]$ ll
total 48
-rw-rw-r-- 1 hue hue 37237 Nov 21 20:06 hue.ini
-rw-rw-r-- 1 hue hue  1843 May  4  2015 log4j.properties
-rw-rw-r-- 1 hue hue  1550 May  4  2015 log.conf
[kduser@master1 conf]$ more hue.ini
# Hue configuration file
# ===================================
#
# For complete documentation about the contents of this file, run
#   $ <hue_root>/build/env/bin/hue config_help
#
# All .ini files under the current directory are treated equally.  Their
# contents are merged to form the Hue configuration, which can
# can be viewed on the Hue at
#   http://<hue_host>:<port>/dump_config


###########################################################################
# General configuration for core Desktop features (authentication, etc)
###########################################################################

[desktop]

  # Set this to a random string, the longer the better.
  # This is used for secure hashing in the session store.
  secret_key=

  # Webserver listens on this address and port
  http_host=0.0.0.0
  http_port=9401

  # Time zone name
  time_zone=UTC

  # Enable or disable Django debug mode.
  django_debug_mode=false

  # Enable or disable database debug mode.
  ## database_logging=false

  # Enable or disable backtrace for server error
  http_500_debug_mode=false

  # Enable or disable memory profiling.
  ## memory_profiler=false

  # Server email for internal error messages
  ## django_server_email='hue@localhost.localdomain'

  # Email backend

找hue和hive的关系,发现hue.ini中的beeswax就是hive相关的

[kduser@master1 hue]$  find . -name hive
./apps/oozie/examples/unmanaged/hive
./apps/oozie/examples/managed/hive
[kduser@master1 hue]$



[kduser@master1 conf]$ pwd
/mnt/vdc/hue/hue/desktop/conf
[kduser@master1 conf]$ ll
total 48
-rw-rw-r-- 1 hue hue 37237 Nov 21 20:06 hue.ini
-rw-rw-r-- 1 hue hue  1843 May  4  2015 log4j.properties
-rw-rw-r-- 1 hue hue  1550 May  4  2015 log.conf

 more hue.ini
[beeswax]

  # Host where HiveServer2 is running.
  # If Kerberos security is enabled, use fully-qualified domain name (FQDN).
  hive_server_host=master1

  # Port where HiveServer2 Thrift server runs on.
  hive_server_port=9300

  # Hive configuration directory, where hive-site.xml is located
  hive_conf_dir=/mnt/vdc/hive/conf

  # Timeout in seconds for thrift calls to Hive service
  ## server_conn_timeout=120

  # Choose whether to use the old GetLog() thrift call from before Hive 0.14 to retrieve the logs.
  # If false, use the FetchResults() thrift call from Hive 1.0 or more instead.
  ## use_get_log_api=false

  # Set a LIMIT clause when browsing a partitioned table.
  # A positive value will be set as the LIMIT. If 0 or negative, do not set any limit.
  ## browse_partitioned_table_limit=250

  # A limit to the number of rows that can be downloaded from a query.
  # A value of -1 means there will be no limit.
  # A maximum of 65,000 is applied to XLS downloads.
  ## download_row_limit=1000000

  # Hue will try to close the Hive query when the user leaves the editor page.
  # This will free all the query resources in HiveServer2, but also make its results inaccessible.
  ## close_queries=false

  # Thrift version to use when communicating with HiveServer2.
  # New column format is from version 7.
  thrift_version=7

解压上传的压缩包

tar -zxvf apache-hive-1.2.1-bin.tar.gz
mv apache-hive-1.2.1-bin hive

把旧版本中conf的配置文件复制到新版本目录中

cp  /mnt/vdc/hive/conf/hive-env.sh  .
cp  /mnt/vdc/hive/conf/hive-site.xml   .

添加其他配置文件

cp beeline-log4j.properties.template  beeline-log4j.properties
sudo cp beeline-log4j.properties.template  beeline-log4j.properties
sudo hive-default.xml.template  hive-default.xml
sudo cp  hive-default.xml.template  hive-default.xml
sudo cp  hive-log4j.properties.template  hive-log4j.properties
sudo cp hive-exec-log4j.properties.template  hive-exec-log4j.properties

因为配置的hive用mysql数据库,需要加连接驱动

cd hive/lib
sudo cp /mnt/vdc/hive_old/lib/mysql-connector-java-5.1.38.jar

修改权限

sudo chown -R  hive:hive hive

遇到的问题:
启动hive annot access /mnt/vdc/spark/lib/spark-assembly-*.jar: No such file
在命令行敲入hive启动的时候

  • 无法访问/home/ndscbigdata/soft/spark-2.0.0/lib/spark-assembly-*.jar: 没有那个文件或目录。
  • 无法找到hadoop相关的类
    hive默认了一些类库的位置。说明我在/etc/profile中配置的环境变量没起作用。
    解决方法:
    在hive/conf的中的hive.env中添加:

参考:无法访问../lib/spark-assembly-*.jar: 没有那个文件或目录的解决办法

参考

HUE配置HIVE - 单行道| - 博客园 http://www.cnblogs.com/one--way/p/5687857.html

转载于:https://www.cnblogs.com/xfly/p/6681263.html

Hive是一个基于Hadoop的开源数据仓库工具,用于处理大规模的数据集。滚动升级是指在不中断现有的Hive服务数据的情况下,将Hive升级到更高版本。下面是Hive滚动升级的一般步骤: 1.备份数据:在开始滚动升级之前,务必备份Hive的元数据数据。可以使用Hive metastore的导出功能来备份元数据,并将Hadoop集群上的Hive数据库目录复制到一个安全的位置。 2.安装新版本:下载并安装Hive的新版本,确保新版本与当前的Hadoop集群兼容。可以通过解压安装包或使用软件包管理器来安装新版本。 3.测试新版本:在进行正式升级之前,建议在一个测试环境中对新版本进行测试。可以使用一些示例查询表来验证新版本是否正常工作。 4.停止Hive服务:在进行滚动升级之前,需要停止当前运行的Hive服务。可以使用以下命令停止Hive服务: hive --service hiveserver2 stop 5.升级元数据:在停止Hive服务后,需要升级Hive元数据。可以使用Hive的元数据升级工具来完成此操作。运行升级工具时,需要指定先前备份的元数据路径。 6.修改配置文件(可选):在升级过程中,可能需要修改Hive的配置文件以适应新版本的要求。可以将先前备份的配置与新版本的配置进行比较,并进行相应的更改。 7.启动Hive服务:在完成元数据升级配置修改后,可以启动Hive服务以使升级生效。可以使用以下命令启动Hive服务: hive --service hiveserver2 start 8.验证升级:一旦Hive服务启动,可以使用一些查询操作来验证升级是否成功。可以确认数据可以正常读取写入,并确保查询结果与预期一致。 滚动升级Hive时,需要非常小心并仔细遵循官方文档中的指导。此外,在进行升级之前,最好在一个测试环境中对整个过程进行实施并验证。如果升级出现任何问题,可以通过还原元数据数据的备份来恢复到之前的状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值