-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_hive.yml
68 lines (56 loc) · 2.52 KB
/
install_hive.yml
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
- hosts: hadoop
vars:
target: /opt/soft
java_home: /opt/soft/jdk1.8.0_202
unzip_dir: apache-hive-3.1.2-bin
tarball: apache-hive-3.1.2-bin.tar.gz
tasks:
- name: copy hive remote hosts
copy: src=/root/{{ tarball }} dest={{ target }}
- name: Decompressing files
shell: chdir={{ target }} tar zxvf {{ tarball }}
- name: hive_profile config
shell: /bin/echo {{ item }} >> /etc/profile
with_items:
- \# Hive Env
- export HIVE_HOME=/opt/soft/apache-hive-3.1.2-bin
- export PATH=\$HIVE_HOME/bin:\$PATH
- name: copy mysql driver remote hosts
copy: src=/root/mysql-connector-java-8.0.23.jar dest={{ target }}/{{ unzip_dir }}/lib
- name: rename jar
command: mv {{ target }}/{{ unzip_dir }}/lib/log4j-slf4j-impl-2.10.0.jar {{ target }}/{{ unzip_dir }}/lib/log4j-slf4j-impl-2.10.0.jar.bak
- name: rename config 1
command: mv {{ target }}/{{ unzip_dir }}/conf/hive-env.sh.template {{ target }}/{{ unzip_dir }}/conf/hive-env.sh
- name: rename config 2
command: mv {{ target }}/{{ unzip_dir }}/conf/hive-default.xml.template {{ target }}/{{ unzip_dir }}/conf/hive-site.xml
- name: modify hive-site.xml
shell: /bin/echo {{ item }} >> {{ target }}/{{ unzip_dir }}/conf/hive-env.sh
with_items:
- export JAVA_HOME=/usr/local/java
- export HIVE_HOME=/opt/soft/apache-hive-3.1.2-bin
- export HADOOP_HOME=/opt/soft/hadoop-3.2.0
- name: modify hive-site.xml
replace:
path: "{{ target }}/{{ unzip_dir }}/conf/hive-site.xml"
regexp: "jdbc:derby:;databaseName=metastore_db;create=true"
replace: "jdbc:mysql://mysqlIp:3306/hive?serverTimezone=Asia/Shanghai"
- name: modify hive-site.xml
replace:
path: "{{ target }}/{{ unzip_dir }}/conf/hive-site.xml"
regexp: "org.apache.derby.jdbc.EmbeddedDriver"
replace: "com.mysql.cj.jdbc.Driver"
- name: modify hive-site.xml
replace:
path: "{{ target }}/{{ unzip_dir }}/conf/hive-site.xml"
regexp: "Username to use against metastore database"
replace: "root"
- name: modify hive-site.xml
replace:
path: "{{ target }}/{{ unzip_dir }}/conf/hive-site.xml"
regexp: "<value>mine</value>"
replace: "1404133491Zx."
- name: modify hive-site.xml
replace:
path: "{{ target }}/{{ unzip_dir }}/conf/hive-site.xml"
regexp: "jdbc:derby:;databaseName=metastore_db;create=true"
replace: "jdbc:mysql://mysqlIp:3306/hive?serverTimezone=Asia/Shanghai"