Hive的安装

Hive的安装

  1. mysql数据 远程连接权限

1)linux中登录mysal:mysql -uroot -proot
2) set global validate_password_policy=0;
3) set global validate_password_length=1;
这个两个设置以后 密码很简单不会报错
4) 设置允许远程连接linux: grant all privileges on . to ‘root’@’%’ identified by ‘root’ with grant option;
5) 刷新:flush privileges;

  1. hive 解压 配置 mysql的驱动包
rz
tar -axvf apache-hive-3.1.2-bin.tar.gz

然后上传mysql的驱动包到/opt/apps/hive-3.1.2/lib目录下

  1. 修改配置文件

mv /opt/apps/hive-3.1.2/conf/hive-env.sh.template hive-env.sh vi
conf/hive-env.sh

export HADOOP_HOME=/opt/apps/hadoop-3.1.1/
export HIVE_CONF_DIR=/opt/apps/hive-3.1.2/conf
  1. 继续配置文件

/opt/apps/hive-3.1.2/conf/hive-site.xml

<configuration>
<!-- 记录HIve中的元数据信息  记录在mysql中 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://linux01:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<!-- mysql的用户名和密码 -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
</property>

<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>

<property>
<name>hive.exec.scratchdir</name>
<value>/user/hive/tmp</value>
</property>
<property>
<name>hive.querylog.location</name>
<value>/user/hive/log</value>
</property>
<!-- 客户端远程连接的端口 -->
<property> 
<name>hive.server2.thrift.port</name> 
<value>10000</value>
</property>
<property> 
<name>hive.server2.thrift.bind.host</name> 
<value>0.0.0.0</value>
</property>
<property>
<name>hive.server2.webui.host</name>
<value>0.0.0.0</value>
</property>
<!-- hive服务的页面的端口 -->
<property>
<name>hive.server2.webui.port</name>
<value>10002</value>
</property>
<property> 
<name>hive.server2.long.polling.timeout</name> 
<value>5000</value>                               
</property>
<property>
<name>hive.server2.enable.doAs</name>
<value>true</value>
</property>
<property>
<name>datanucleus.autoCreateSchema</name>
<value>false</value>
</property>
<property>
<name>datanucleus.fixedDatastore</name>
<value>true</value>
</property>

<property>
<name>hive.execution.engine</name>
<value>mr</value>
</property>
<!-- 添加元数据服务配置 -->
<property>
     <name>hive.metastore.local</name>
     <value>false</value>
     <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description>
</property>
<property>
    <name>hive.metastore.uris</name>
     <value>thrift://linux01:9083</value>
</property>
</configuration>
  1. 继续修改配置文件

vi /opt/apps/hadoop-3.1.1/etc/hadoop/core-site.xml

<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>

<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
</property>

<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
</property>
  1. 启动hadoop

start-all.sh

  1. 配置环境变量

vi /etc/profile
source /etc/profile

  1. 初始化

/opt/apps/hive-3.1.2/bin/schematool -initSchema -dbType mysql

  1. 开启元数据服务 (前台启动)

hive --service metastore &

  1. 启动测试(HDFS正常)

hive

上一篇:要命的nginx-基础一


下一篇:zookeeper的安装