Apache Hive2 HA Cookie2

安装系统

Debian 11

wget https://mirrors.tuna.tsinghua.edu.cn/debian-cd/11.0.0/amd64/iso-cd/debian-11.0.0-amd64-netinst.iso

安装JDK11(main, node2)

1
2
apt-get update && apt-get upgrade
apt-get install openjdk-11-jre openjdk-11-jdk

安装Mysql (main)

1
apt install default-mysql-server

更新密码

1
mysql_secure_installation

调整绑定IP

vim /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 0.0.0.0

添加访问授权

1
2
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges ;

启动mysql

1
2
3
systemctl stop mysql
systemctl start mysql
systemctl restart mysql

安装HIVE(main节点)

将hive2解压至所有节点 /data/apache-hive-2.3.9-bin

在/etc/profile中配置hive工具

配置 hive

cd /data/apache-hive-2.3.9-bin/conf
cp hive-default.xml.template hive-site.xml
vim hive-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

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


<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://main:3306/hive_remote?createDatabaseIfNotExist=true&amp;verifyServerCertificate=false&amp;useSSL=false</value></value>
</property>

<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>

<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>

<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
</property>

拷贝jdbc drivers

scp mysql-connector-java-8.0.26.jar dev@172.16.11.6:/data/apache-hive-2.3.9-bin/lib/

安装HIVE node2节点

cd /data/apache-hive-2.3.9-bin/conf
cp hive-default.xml.template hive-site.xml
vim hive-site.xml

1
2
3
4
5
6
7
8
9
10
11
12


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

<property>
<name>hive.metastore.uris</name>
<value>thrift://main:9083</value>
</property>

hosts 配置

vim /etc/hosts

1
2
172.16.11.6 main
172.16.11.7 node2

172.16.11.6 node1
172.16.11.7 node2
172.16.11.8 node3