hive单用户模式安装

这种存储方式需要在本地运行一个mysql服务器

安装前,需先安装hadoop,jdk,和mysql。详见https://www.cnblogs.com/hzcjd/p/13669270.html

第一步:Liunx环境下安装mysql

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server -y
service mysqld start
mysql
mysql>grant all privileges on *.* to 'root'@'%' identified by '1' with grant option;

启动mysql

service mysqld start;

设置开机自启

chkconfig mysqld on;

第二步:安装hive

解压

cd /usr/local/software
tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /usr/local/

jar包放入lib

cd /usr/local/software
cp mysql-connector-java-5.1.32-bin.jar /usr/local/apache-hive-3.1.2-bin/lib

环境变量设置

vim /etc/profile
输入
export HIVE_HOME=/usr/local/apache-hive-3.1.2-bin
path $HIVE_HOME/bin
:wq
source /etc/profile

编辑hive-site.xml

cd /usr/local/apache-hive-3.1.2-bin/conf
cp hive-default.xml.template  hive-site.xml
vim hive-site.xml
configuration间录入
<property>  
  <name>hive.metastore.warehouse.dir</name>  
  <value>/user/hive_remote/warehouse</value>  
</property>  
   
<property>  
  <name>hive.metastore.local</name>  
  <value>false</value>  
</property>  

<property>
    <name>datanucleus.schema.autoCreateAll</name>
    <value>true</value>
</property>
   
<property>  
  <name>javax.jdo.option.ConnectionURL</name>  
  <value>jdbc:mysql://ha:3306/hive_remote?createDatabaseIfNotExist=true</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionDriverName</name>  
  <value>com.mysql.jdbc.Driver</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionUserName</name>  
  <value>root</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionPassword</name>  
  <value>1</value>  
</property>  

编辑core-site.xml

采用(hiveserver2)启动服务,需配置此xml

cd /usr/local/hadoop-3.2.0/etc/hadoop

vim core-site.xml 
添加
<property>
        <name>hadoop.proxyuser.root.hosts</name>
        <value>*</value>
</property>
<property>
        <name>hadoop.proxyuser.root.groups</name>
        <value>*</value>
</property>

初始化mysql

schematool -dbType mysql -initSchema

启动  服务端口10000

方式一

启动    hive
退出    hive>quit;

方式二

启动服务    nohup hiveserver2 &
启动客户端    beeline -u jdbc:hive2://localhost:10000/default -n root
退出客户端    hive>!quit

 

相关安装文件下载

https://download.csdn.net/download/qq_31552723/12889540


 

posted @ 2020-09-26 17:20  咔咔kk  阅读(208)  评论(0编辑  收藏  举报