# 卸载mariadb
rpm -qa|grep mariadb
rpm -e --nodeps 文件名
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
#解压
tar xvf mysql-5.7.32-1.el7.x86_64.rpm-bundle.tar
# 安装
yum localinstall -y mysql-community-common-5.7.32-1.el7.x86_64.rpm
yum localinstall -y mysql-community-libs-5.7.32-1.el7.x86_64.rpm
yum localinstall -y mysql-community-libs-compat-5.7.32-1.el7.x86_64.rpm
yum localinstall -y mysql-community-devel-5.7.32-1.el7.x86_64.rpm
yum localinstall -y mysql-community-client-5.7.32-1.el7.x86_64.rpm
yum localinstall -y mysql-community-server-5.7.32-1.el7.x86_64.rpm
# 启动
systemctl start mysqld
systemctl enable mysqld
# 查看临时密码
grep 'temporary password' /var/log/mysqld.log
2021-07-21T18:12:59.181619Z 1 [Note] A temporary password is generated for root@localhost: P)MkN5&zb6,<
# 登录MySQL
mysql -uroot -p'临时密码'
# 修改密码强度策略
set global validate_password_length=4;
set global validate_password_policy=0;
# 修改密码
set password=password('000000');
修改mysql root用户的登录权限
update mysql.user set Host='%' where HOST='localhost' and User='root';
# 创建cdh组件数据库
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 hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
# 授权
grant all on scm.* to 'scm'@'%' identified by '000000';
grant all on amon.* to 'amon'@'%' identified by '000000';
grant all on hue.* to 'hue'@'%' identified by '000000';
grant all on hive.* to 'hive'@'%' identified by '000000';
grant all on sentry.* to 'sentry'@'%' identified by '000000';
grant all on oozie.* to 'oozie'@'%' identified by '000000';
grant all on rman.* to 'rman'@'%' identified by '000000';
flush privileges;
# 上传node01配置mysql驱动包
mv mysql-connector-java-5.1.47.jar mysql-connector-java.jar
mkdir /usr/share/java
cp mysql-connector-java.jar /usr/share/java
# 从node01 拷贝到 node02、node03
scp -r /usr/share/java/mysql-connector-java.jar root@node02:/usr/share/java/
scp -r /usr/share/java/mysql-connector-java.jar root@node03:/usr/share/java/
主节点安装cm
yum localinstall -y cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
# 配置 scm 库
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm 000000
vim /etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=node01
com.cloudera.cmf.db.name=scm
com.cloudera.cmf.db.user=scm
com.cloudera.cmf.db.setupType=EXTERNAL
com.cloudera.cmf.db.password=000000
vim /etc/cloudera-scm-agent/config.ini
[General]
# Hostname of the CM server.
server_host=node01