前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何在CDH集群的非元数据库节点安装MySQL5.7.12

如何在CDH集群的非元数据库节点安装MySQL5.7.12

作者头像
Fayson
修改2018-04-01 19:20:05
1K0
修改2018-04-01 19:20:05
举报
文章被收录于专栏:Hadoop实操Hadoop实操Hadoop实操

温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。

1.文档编写目的


在CDH集群中默认使用的MySQL版本是操作系统自带的版本,一般操作系统自带的MySQL版本都会比较低,对于企业已有应用可能会用较新的MySQL版本,使用集群中安装的MySQL时可能会出现SQL不兼容的问题,那么解决方法一是在集群中安装新版本的MySQL,二是升级集群中老版本的MySQL。本文主要选择第一种方法在集群中安装新版本的MySQL,在RedHat6安装时会遇到mysql-community-libs包冲突的问题,卸载冲突包时会将cloudera-manager-agent包也卸载导致Agent异常,在RedHat7安装时会自动更新mysql-community-libs依赖包,本文档主要讲述基于RedHat7.2系统的CDH集群中的非元数据库节点安装MySQL5.7.12。

  • 内容概述

1.安装前准备

2.安装及配置

3.验证

  • 测试环境

1.操作系统:RedHat7.2

2.采用sudo权限的ec2-user用户操作

  • 前置条件

1.集群运行正常

2.选择非元数据库节点安装MySQL5.7.12

2.安装前准备


1.下载MySQL5.7.12的RPM包

https://downloads.mysql.com/archives/community/

2.将下载的MySQL安装包上传至服务器并解压

[ec2-user@ip-172-31-21-45 mysql5.7.12]$ tar -xvf mysql-5.7.12-1.el7.x86_64.rpm-bundle.tar 
[root@ip-172-31-26-102 mysql5.7.12]# ll
total 539776
-rw-r--r-- 1 ec2-user ec2-user  24991304 Mar 29  2016 mysql-community-client-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user    276736 Mar 29  2016 mysql-community-common-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user   3786120 Mar 29  2016 mysql-community-devel-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user  45150068 Mar 29  2016 mysql-community-embedded-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user  23829224 Mar 29  2016 mysql-community-embedded-compat-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 124953868 Mar 29  2016 mysql-community-embedded-devel-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user   2237968 Mar 29  2016 mysql-community-libs-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user   2115948 Mar 29  2016 mysql-community-libs-compat-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user  51016520 Mar 29  2016 mysql-community-minimal-debuginfo-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 158252992 Mar 29  2016 mysql-community-server-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 116098332 Mar 29  2016 mysql-community-test-5.7.12-1.el7.x86_64.rpm

注意:解压出来的文件中,需要删除mysql-community-server-minimal-5.7.12-1.el7.x86_64.rpm,该RPM包和mysql-community-server-5.7.12-1.el7.x86_64.rpm冲突(一个最简版一个完整版根据需要删除)。

3.安装及配置


1.执行如下命令安装

[ec2-user@ip-172-31-26-102 mysql5.7.12]$ sudo yum -y install mysql-community-*

注意:在安装的过程中mariadb-libs.x86_64会被mysql-community-libs-compat和mysql-community-libs替换。在安装过程中可能会出现无法替换导致包冲突问题,需要手动卸载mariadb-libs.x84_64,因为cloudera-manager-agent服务依赖mariadb-libs.x86_64包,在卸载mariadb-libs.x84_64的时候需要注意,避免将Cloudera-manager-agent服务卸载。

2.启动MySQL服务并添加mysqld到自启动

[ec2-user@ip-172-31-21-45 log]$ sudo service mysqld start
[ec2-user@ip-172-31-21-45 log]$ sudo systemctl enable mysqld

3.MySQL的初始密码

MsSQL5.7.12版本安装完成后,已默认设置了初始密码,需要在/var/log/mysqld.log日志文件中查找初始密码。

4.执行mysql_secure_installation脚本初始化MySQL

[ec2-user@ip-172-31-21-45 ~]$ mysql_secure_installation     

Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 
[ec2-user@ip-172-31-21-45 ~]$ 

5.验证MySQL登录

[ec2-user@ip-172-31-21-45 ~]$ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.12 MySQL Community Server (GPL)
…
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

4.验证建表SQL


1.创建测试库

[ec2-user@ip-172-31-21-45 ~]$ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.12 MySQL Community Server (GPL)
…
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database test;
Query OK, 1 row affected (0.00 sec)

mysql>

2.导入sql

[ec2-user@ip-172-31-21-45 ~]$ mysql -uroot -p test < graph_api_test.sql 
Enter password: 
[ec2-user@ip-172-31-21-45 ~]$ 

3.验证表是否创建成功

5.总结


cloudera-manager-agent服务依赖mariadb-libs.x86_64或mysql-libs.x86_64包,如果在卸载mariadb-libs.x86_64或mysql-libs.x86_64包时将相应的依赖包卸载,这样cloudera-manager-agent服务被卸载,就会导致安装节点的Agent服务异常。

在RedHat7操作系统安装的过程中mariadb-libs.x86_64会被mysql-community-libs-compat和mysql-community-libs替换。那么在RedHat6操作系统安装MySQL新版本的时候如何解决依赖包冲突问题及确保Agent服务正常会在后续的文章做详细说明。

醉酒鞭名马,少年多浮夸! 岭南浣溪沙,呕吐酒肆下!挚友不肯放,数据玩的花! 温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看


推荐关注Hadoop实操,第一时间,分享更多Hadoop干货,欢迎转发和分享。

原创文章,欢迎转载,转载请注明:转载自微信公众号Hadoop实操

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-10-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Hadoop实操 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档