软件
|
hadoop1
|
hadoop2
|
hadoop3
|
Hadoop
|
√
|
√
|
√
|
MySQL
|
√
|
||
Hive
|
√
|
# 查询是否安装了mariadb rpm -aq | grep mariadb # 删除mariadb。-e 删除指定的套件;--nodeps 不验证套件的相互关联性 rpm -e --nodeps mariadb-libs
yum install perl -y
yum install net-tools -y
# 接压缩 tar xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar # 依次运行以下命令 rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
systemctl start mysqld
grep password /var/log/mysqld.log
# 进入MySQL,使用前面查询到的口令 mysql -u root -p # 设置口令强度;将root口令设置为12345678; set global validate_password_policy=0; set password for ‘root‘@‘localhost‘ =password(‘12345678‘); flush privileg
CREATE USER ‘hive‘@‘%‘ IDENTIFIED BY ‘12345678‘; GRANT ALL ON *.* TO ‘hive‘@‘%‘; FLUSH PRIVILEGES;
# tar zxvf apache-hive-2.3.7-bin.tar.gz -C /opt/lagou/servers/ # cd /opt/lagou/server # mv apache-hive-2.3.7-bin hive-2.3.7
# 在 /etc/profile 文件中增加环境变量 export HIVE_HOME=/opt/lagou/servers/hive-2.3.7 export PATH=$PATH:$HIVE_HOME/bin # 执行并生效 source /etc/profile
cd $HIVE_HOME/conf
vi hive-site.xml
<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <!-- hive元数据的存储位置 --> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://linux123:3306/hivemetadata?createDatabaseIfNotExist=true&useSSL=false</value> <description>JDBC connect string for a JDBCmetastore</description> </property> <!-- 指定驱动程序 --> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBCmetastore</description> </property> <!-- 连接数据库的用户名 --> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> <description>username to use against metastoredatabase</description> </property> <!-- 连接数据库的口令 --> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>12345678</value> <description>password to use against metastoredatabase</description> </property> </configuration>
cp /soft/hive/mysql-connector-java-5.1.46.jar $HIVE_HOME/lib
[root@hadoop1 conf]# which schematool /opt/lagou/servers/hive-2.3.7/bin/schematool [root@hadoop1 conf]# schematool -dbType mysql -initSchema
# hive
<!-- 数据默认的存储位置(HDFS)--> <property> <name>hive.metastore.warehouse.dir</name> <value>/user/hive/warehouse</value> <description>location of default database for thewarehouse</description> </property> <property> <!-- 在命令行中,显示当前操作的数据库 --> <name>hive.cli.print.current.db</name> <value>true</value> <description>Whether to include the current database in theHive prompt.</description> </property> <property> <!-- 在命令行中,显示数据的表头 --> <name>hive.cli.print.header</name> <value>true</value> </property> <property> <!-- 操作小规模数据时,使用本地模式,提高效率 --> <name>hive.exec.mode.local.auto</name> <value>true</value> <description>Let Hive determine whether to run in local modeautomatically</description> </property>
vi $HIVE_HOME/conf/hive-log4j2.properties # 添加以下内容: property.hive.log.dir = /opt/lagou/servers/hive-2.3.7/logs
可以不修改,但是要知道位置。
groupadd hadoop # -m:自动建立用户的登入目录 # -g:指定用户所属的起始群组 # -G<群组>:指定用户所属的附加群组 # -s:指定用户登入后所使用的shell useradd -m hadoop -g hadoop -s /bin/bash passwd hadoop visudo # 在100行后添加。允许用户执行sudo,免密 hadoop ALL=(ALL) NOPASSWD:ALL
-- 查看全部参数 hive> set; -- 查看某个参数 hive> set hive.exec.mode.local.auto; hive.exec.mode.local.auto=false
1、用户自定义配置文件(hive-site.xml)
2、启动hive时指定参数(-hiveconf)
3、hive命令行指定参数(set)
配置信息的优先级: set > -hiveconf > hive-site.xml > hive-default.xml
# 启动时指定参数 hive -hiveconf hive.exec.mode.local.auto=true # 在命令行检查参数是否生效 hive> set hive.exec.mode.local.auto; hive.exec.mode.local.auto=true
hive> set hive.exec.mode.local.auto=false; hive> set hive.exec.mode.local.auto; hive.exec.mode.local.auto=false
原文:https://www.cnblogs.com/lizhao01/p/14499767.html