如何在CDH集群的非元数据库节点安装MySQL5.7.12
温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。
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实操
- Linq to xml API中 XName 的奇怪实现
- Vue.js系列之一初识Vue
- EF 数据库连接约定(Connection String Conventions in Code First)
- 微信小程序使用WebSokcet实现相关请求
- Vue.js系列之二Vue实例
- autoload自动加载机制使用
- EF 约定介绍
- 关于EF Code First模式不同建模方式对建表产生的影响
- C# 命名空间和程序集
- C# new关键字和对象类型转换(双括号、is操作符、as操作符)
- 防止小程序多次点击跳转解决方案
- 详述 SQL 中的 distinct 和 row_number() over() 的区别及用法
- Web API系列之三 基本功能实现
- 微信小程序的省市选择组件 citySelector分享
- MySQL 教程
- MySQL 安装
- MySQL 管理与配置
- MySQL PHP 语法
- MySQL 连接
- MySQL 创建数据库
- MySQL 删除数据库
- MySQL 选择数据库
- MySQL 数据类型
- MySQL 创建数据表
- MySQL 删除数据表
- MySQL 插入数据
- MySQL 查询数据
- MySQL where 子句
- MySQL UPDATE 查询
- MySQL DELETE 语句
- MySQL LIKE 子句
- mysql order by
- Mysql Join的使用
- MySQL NULL 值处理
- MySQL 正则表达式
- MySQL 事务
- MySQL ALTER命令
- MySQL 索引
- MySQL 临时表
- MySQL 复制表
- 查看MySQL 元数据
- MySQL 序列 AUTO_INCREMENT
- MySQL 处理重复数据
- MySQL 及 SQL 注入
- MySQL 导出数据
- MySQL 导入数据
- MYSQL 函数大全
- MySQL Group By 实例讲解
- MySQL Max()函数实例讲解
- mysql count函数实例
- MYSQL UNION和UNION ALL实例
- MySQL IN 用法
- MySQL between and 实例讲解
- 用Python爬取自主品牌汽车,看看国产汽车究竟长什么样?(上)
- 工具包 | 使用Python绘制Sci学术期刊配图
- 深入剖析AQS和CAS,看了都说好
- 用Python爬取自主品牌汽车,看看国产汽车究竟长什么样?(下)
- 读者问:小林怎么学操作系统和计算机网络呀?
- 用Python搭建一个简单的代理池
- 用Python模拟登陆GitHub并获取信息
- APUE学习手札 编写一个与3.12节中dup2功能相同的函数,要求不调用fcntl函数,并且要有正确的出错处理
- Python教程 | 最标准的地图调用方式(国家测绘局提供数据)
- Python数据可视化:Python大佬有哪些?
- 新手一看就懂的线程池
- 「面试」破(B)站之旅
- 想过为你的应用加上skywalking(链路监控)吗?
- 结合注意力机制的UNet降水短临预报框架
- 用Python全自动下载抖音视频!