熱線電話:13121318867

登錄
2023-07-16 閱讀量: 697
Linux安裝hive

1.準備

安裝Linux http://www.ruiqisteel.com/discuss/post/details/649fba2a34a19c3cbf04a7c5

安裝hadoop http://www.ruiqisteel.com/discuss/post/details/64b36e35f6b83a33b072c5fb

下載hive 和 mysql 安裝包

Hive:apache-hive-3.1.2-bin.tar.gz(地址: https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-3.1.2/)

Mysql:mysql-8.0.30-1.el9.aarch64.rpm-bundle.tar(地址:https://downloads.mysql.com/archives/community/)

mysql-connector-java:MySQL Connector Java ? 8.0.30:(地址:https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar)

2.安裝hive

2.1將安裝包上傳到 linux cd /opt/module/software


2.2解壓安裝包

[nigel@nigel1 software]$ cd /opt/module/software

[nigel@nigel1 software]$ tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /opt/module/

2.3修改目錄名字

[nigel@nigel1 software]$ mv /opt/module/apache-hive-3.1.2-bin/ /opt/module/hive-3.1.2

2.4配置環境變量

[nigel@nigel1 software]$ sudo vim /etc/profile.d/my_env.sh

添加以下內容

#HIVE_HOME

export HIVE_HOME=/opt/module/hive-3.1.2

export PATH=$PATH:$HIVE_HOME/bin

[nigel@nigel1 software]$ source /etc/profile

2.5刪除沖突的jar包

[nigel@nigel1 software]$ rm /opt/module/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar

2.6啟動hadoop

[nigel@nigel1 software]$ start-dfs.sh

Starting namenodes on [nigel1]

Starting datanodes

Starting secondary namenodes [nigel1]

[nigel@nigel1 software]$ start-yarn.sh

Starting resourcemanager

Starting nodemanagers

[nigel@nigel1 software]$ mapred --daemon start historyserver

2.7初始化元數據

[nigel@nigel1 software]$ cd /opt/module/hive-3.1.2/bin/

[nigel@nigel1 bin]$ schematool -dbType derby -initSchema

2.8啟動與退出hive

[nigel@nigel1 bin]$ hive

hive> exit;


3.安裝mysql

3.1先查看是否自帶mariadb-libs,南大鏡像源下載的almalinux9.1是沒有自帶mariadb-libs。

[nigel@nigel1 bin]$ rpm -qa|grep mariadb

[nigel@nigel1 bin]$ sudo rpm -e --nodeps mariadb-libs

[sudo] nigel 的密碼:

錯誤:未安裝軟件包 mariadb-libs

3.2解壓mysql安裝包

[nigel@nigel1 software]$ tar -xf mysql-8.0.30-1.el9.aarch64.rpm-bundle.tar

[nigel@nigel1 software]$ sudo yum install -y libaio

3.3安裝mysql

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-common-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-client-plugins-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-libs-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-debuginfo-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-libs-debuginfo-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-client-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-icu-data-files-8.0.30-1.el9.aarch64.rpm

[nigel@nigel1 software]$ sudo rpm -ivh mysql-community-server-8.0.30-1.el9.aarch64.rpm


3.4初始化數據庫

[nigel@nigel1 software]$ sudo mysqld --initialize —user=mysql

3.5查看臨時密碼

[nigel@nigel1 software]$ sudo cat /var/log/mysqld.log

2023-07-15T09:54:57.682375Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.30) initializing of server in progress as process 38705

2023-07-15T09:54:57.689621Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2023-07-15T09:54:57.895260Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2023-07-15T09:54:58.548774Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Q2acj_y9di3h

可以看到臨時密碼為 Q2acj_y9di3h

3.6修改mysql密碼

3.6.1啟動mysql

[nigel@nigel1 software]$ sudo systemctl start mysqld

[nigel@nigel1 software]$ mysql -uroot -p

Enter password:

輸入臨時密碼


3.6.2設置密碼,并允許任意ip連接

mysql> SET PASSWORD FOR root@localhost = ‘nigel’;

mysql> update mysql.user set host='%' where user='root';

mysql> flush privileges;

mysql> exit;


3.7拷貝MySQLJDBC驅動至hive-3.1.2下的lib/

[nigel@nigel1 software]$ cp mysql-connector-java-8.0.30.redhat-00001.jar /opt/module/hive-3.1.2/lib/

3.8mysql服務自動啟動

[nigel@nigel1 ~]$ systemctl enable mysqld


4hive配置

4.1修改hive-site.xml

[nigel@nigel1 software]$ cd /opt/module/hive-3.1.2/conf/

[nigel@nigel1 conf]$ vim hive-site.xml

輸入以下內容,注意修改主機名稱

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

<!-- jdbc接的URL -->

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://nigel1:3306/metastore?useSSL=false</value>

</property>

<!-- jdbc接的Driver -->

<property>

<name>javax.jdo.option.ConnectionDriverName</name>

<value>com.mysql.jdbc.Driver</value>

</property>

<!-- jdbc接的username -->

<property>

<name>javax.jdo.option.ConnectionUserName</name>

<value>root</value>

</property>

<!-- jdbc接的password -->

<property>

<name>javax.jdo.option.ConnectionPassword</name>

<value>nigel</value>

</property>

<!-- Hive元據存版本的驗證 -->

<property>

<name>hive.metastore.schema.verification</name>

<value>false</value>

</property>

<!-- 元據存 -->

<property>

<name>hive.metastore.event.db.notification.api.auth</name>

<value>false</value>

</property>

<!-- Hive默在HDFS的工作目 -->

<property>

<name>hive.metastore.warehouse.dir</name>

<value>/user/hive/warehouse</value>

</property>

<!-- 指定存據要接的地址 -->

<property>

<name>hive.metastore.uris</name>

<value>thrift://nigel1:9083</value>

</property>

<!-- 指定hiveserver2接的主機名 -->

<property>

<name>hive.server2.thrift.bind.host</name>

<value>nigel1</value>

</property>

<!-- 指定hiveserver2接的端口 -->

<property>

<name>hive.server2.thrift.port</name>

<value>10000</value>

</property>

</configuration>

4.2新建hive元數據庫

[nigel@nigel1 conf]$ mysql -uroot -p

mysql> use mysql

mysql> select user, host from user;

mysql> update user set host="%" where user=“root";

mysql> flush privileges;

mysql> exit;

[nigel@nigel1 conf]$ mysql -uroot -p

mysql> create database metastore;

mysql> exit;

4.3初始化元數據庫

[nigel@nigel1 conf]$ schematool -initSchema -dbType mysql -verbose

4.4啟動hive 退出hive

[nigel@nigel1 conf]$ hive

hive> exit;




0.0000
0
關注作者
收藏
評論(0)

發表評論

暫無數據
推薦帖子
日韩人妻系列无码专区视频,先锋高清无码,无码免费视欧非,国精产品一区一区三区无码