【Centos7.6安裝CDH6.1.0】第二節 JDK、Mysql配置

JDK(已安裝者跳過)

下載linux適用版jdk

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

下載後分發至mini1、mini2、mini3,解壓,配置環境變量至/etc/profile,這裏貼一下博主的profile相關內容:

export JAVA_HOME=/home/hadoop/apps/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

環境變量配置完成後,執行:

[root@mini2 ~]# source /etc/profile

驗證:

[root@mini2 ~]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

mysql配置

root用戶下,在mini1上依次執行如下命令(:

yum remove mysql
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server
yum install mysql-devel
systemctl start mysqld
systemctl enable mysqld

等待安裝完成後,尋找初始密碼:

[root@mini1 mysql]# cat /var/log/mysqld.log | grep "temporary password"
2020-01-31T18:48:39.318109Z 1 [Note] A temporary password is generated for root@localhost: 9.Hkdd:t??2m

使用初始密碼登錄:

[root@mini1 mysql]# mysql -uroot -p9.Hkdd:t??2m
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

修改mysql root登錄密碼:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '1QAZ@wsx';

注意,新密碼設置要求包含大寫字母、小寫字母及特殊符號(如~!@#)。

安裝jdbc

root用戶下,在mini1上執行命令:

wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
tar zxvf mysql-connector-java-5.1.46.tar.gz
mkdir -p /usr/share/java/
cd mysql-connector-java-5.1.46
cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar

建庫、建用戶、設置用戶訪問權限

root用戶下,創建腳本mysql_init.sh:

#!/bin/bash
################################################################################################################################
#--設計人員:Jack-Roy
#--設計日期:2019-06-18
#--聯繫方式:[email protected]
#--功能說明: 建庫、建用戶、設置用戶訪問權限
#--版    本:v-1.0.0
################################################################################################################################

HOST=192.168.26.11
USER=root
export MYSQL_PASSWORD=1QAZ@wsx
PORT=3306
mysql -h$HOST -P$PORT -u$USER -p$MYSQL_PASSWORD <<EOF
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'scm'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'amon'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'rman'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'hue'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'hive'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'sentry'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'nav'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'navms'@'%' IDENTIFIED BY '1QAZ@wsx';
CREATE USER 'oozie'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '1QAZ@wsx';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '1QAZ@wsx';
EOF

執行腳本:

[root@mini1 ~]# sh mysql_init.sh

登錄mysql驗證:

[root@mini1 ~]# mysql -uroot -p1QAZ@wsx
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| JackRoy            |
| Test               |
| amon               |
| bigeye             |
| bigeye_barnyard    |
| hue                |
| information_schema |
| metastore          |
| mysql              |
| nav                |
| navms              |
| oozie              |
| performance_schema |
| rman               |
| scm                |
| sentry             |
| sys                |
+--------------------+
17 rows in set (0.00 sec)

跳轉

第一節 基礎環境準備(host域名及免密登錄)
第二節 JDK、mysql配置
第三節 Python2.7.5安裝、時鐘同步及CDH本地Yum源搭建
第四節 安裝並啓動CM組件
第五節 WebUI方式安裝CDH6

發佈了48 篇原創文章 · 獲贊 71 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章