#-------------Mysql安装---------------------- #卸载Centos7自带mariadb rpm -qa|grep mariadb mariadb-libs-5.5.64-1.el7.x86_64 rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps #创建mysql安装包存放点 mkdir /kkb/install/mysql #上传mysql-5.7.29安装包到上述文件夹下、解压 tar xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar #执行安装 yum -y install libaio rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm #初始化mysql mysqld --initialize #更改所属组 chown mysql:mysql /var/lib/mysql -R #启动mysql systemctl start mysqld.service #查看生成的临时root密码 cat /var/log/mysqld.log #这行日志的最后就是随机生成的临时密码 [Note] A temporary password is generated for root@localhost: o+TU+KDOm004 #修改mysql root密码、授权远程访问 mysql -u root -p Enter password: #这里输入在日志中生成的临时密码 #更新root密码 设置为hadoop mysql> alter user user() identified by "hadoop"; Query OK, 0 rows affected (0.00 sec) #授权 mysql> use mysql; mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; #mysql的启动和关闭 状态查看 systemctl stop mysqld systemctl status mysqld systemctl start mysqld #建议设置为开机自启动服务 systemctl enable mysqld #查看是否已经设置自启动成功 systemctl list-unit-files | grep mysqld #--------------------Hive安装配置---------------------- # 上传解压安装包 cd /kkb/install/ tar zxvf apache-hive-3.1.2-bin.tar.gz mv apache-hive-3.1.2-bin hive #解决hadoop、hive之间guava版本差异 cd /kkb/install/hive rm -rf lib/guava-19.0.jar cp /kkb/install/hadoop-3.1.4/share/hadoop/common/lib/guava-27.0-jre.jar ./lib/ #添加mysql jdbc驱动到hive安装包lib/文件下 mysql-connector-java-5.1.32.jar #修改hive环境变量文件 添加Hadoop_HOME cd /kkb/install/hive/conf/ mv hive-env.sh.template hive-env.sh vim hive-env.sh export HADOOP_HOME=/kkb/install/hadoop-3.1.4 export HIVE_CONF_DIR=/kkb/install/hive/conf export HIVE_AUX_JARS_PATH=/kkb/install/hive/lib #新增hive-site.xml 配置mysql等相关信息 vim hive-site.xml #初始化metadata cd /kkb/install/hive bin/schematool -initSchema -dbType mysql -verbos #初始化成功会在mysql中创建74张表 #-----------------hive-site.xml-------------- <configuration> <!-- 存储元数据mysql相关配置 --> <property> <name>javax.jdo.option.ConnectionURL</name> <value> jdbc:mysql://node01:3306/hive?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>root</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hadoop</value> </property> <!-- H2S运行绑定host --> <property> <name>hive.server2.thrift.bind.host</name> <value>node01</value> </property> <!-- 远程模式部署metastore 服务地址 --> <property> <name>hive.metastore.uris</name> <value>thrift://node01:9083</value> </property> <!-- 关闭元数据存储授权 --> <property> <name>hive.metastore.event.db.notification.api.auth</name> <value>false</value> </property> <!-- 关闭元数据存储版本的验证 --> <property> <name>hive.metastore.schema.verification</name> <value>false</value> </property> </configuration> #-----------------Metastore Hiveserver2启动---- #前台启动 关闭ctrl+c /kkb/install/hive/bin/hive --service metastore #后台启动 进程挂起 关闭使用jps + kill #输入命令回车执行 再次回车 进程将挂起后台 nohup /kkb/install/hive/bin/hive --service metastore & #前台启动开启debug日志 /kkb/install/hive/bin/hive --service metastore --hiveconf hive.root.logger=DEBUG,console