简要介绍
本文次要用于领导在openEuler 20.03 sp1 操作系统上部署mysql数据库。
MySQL 是一款平安、跨平台、高效的,并与 PHP、Java 等支流编程语言紧密结合的数据库系统。 本案例应用x86_64架构虚拟机,通过评估工具x2openEuler评估MySQL 5.7.21软件移植到openEuler操作系统的兼容性,再施行数据搬迁。
倡议应用版本为MySQL 5.7.21。
阐明: 本文档实用于MySQL 5.7.21,其余版本的MySQL移植步骤也可参考本文档。
案例环境
服务器
我的项目 | 阐明 |
---|---|
服务器 | 磁盘容量 |
CPU | 华为鲲鹏920处理器 |
Raid卡 | SAS3508 |
网络卡 | SAS3508 |
SAS3508 | |
SAS3508 | |
磁盘容量 | 500GB以上 |
OS
软件 | 版本 | 备注 |
---|---|---|
OS | Centos 7.6.1810 | 以后mysql集群服务器 |
OS | openEuler 20.03 SP1 | 以后mysql集群服务器 |
软件包
软件 | 版本 |
---|---|
mysql5 | 5.7.21 |
mysql5-common | 5.7.21 |
mysql5-embedded | 5.7.21 |
mysql5-embedded-devel | 5.7.21 |
mysql5-errmsg | 5.7.21 |
mysql5-libs | 5.7.21 |
mysql5-server | 5.7.21 |
mysql5-test | 5.7.21 |
软件兼容性评估
openEuler社区提供了 x2openEuler 工具 ,针对曾经编译好的二进制程序,进行次要实现软件包、接口级评估,明确应用软件是否须要移植适配,是否有依赖的软件包待引入;同时评估软件调用的接口原型在两个零碎中是否有差别。
注:曾经编译好的二进制程序,难以保障全副兼容新OS,重大时会引发才内存危险,往往这种问题很难通过验证的形式辨认进去,迁徙前针对软件兼容性评估尤为重要。
获取mysql的RPM包并解压到/opt/mysql目录下
wget -P /opt https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
cd /opt/mkdir mysqltar -xf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar -C mysql
下载x2openEuler工具到/opt/mysql
下载x2openEuler工具到/opt/mysql
部署工具
cd /opt/mysqlrpm -ivh x2openEuler-2.0.0-1.x86_64.rpm
留神:装置rpm时须要应用root用户,且目前须要网络(用于下载安装依赖) 留神:依据提醒装置依赖包如bzip2-devel等
su x2openEulerx2openEuler redis-db -init
顺次录入redis数据库的ip:127.0.0.1 端口:6379 数据库索引号(0-16):0 明码(工具会对明码加密解决):如果redis明码没有设置或者为空时,间接回车即可
x2openEuler init source_centos7.6-openEuler20.03-LTS-SP1.tar.gz
备注:x2openEuler应用rpm装置实现后会在/opt/x2openEuler目录下带有source_centos7.6-openEuler20.03-LTS-SP1.tar.gz这个默认资源包 须要反对centos8.2到openEuler20.03-LTS-SP1的评估,则需获取对应的动态资源包导入,如对应的资源包为source_centos8.2-openEuler20.03-LTS-SP1.tar.gz,导入此包命令:x2openEuler init source_centos8.2-openEuler20.03-LTS-SP1.tar.gz,请示状况抉择对应的资源包
扫描mysql
x2openEuler scan /opt/mysql/留神要剖析的移植文件须要有可能让x2openEuler用户能够读取的权限扫描实现后会在/opt/x2openEuler/output目录生成html格局的报告
评估后果剖析
软件兼容性评估报告分三块内容展现软件兼容性,别离是依赖包兼容性、C/C++接口兼容性、java接口兼容性,依赖包兼容性反映了软件包装置过程中的间接依赖,非100%表明无奈正确装置;接口兼容性反映的是单个软件运行过程中对其余软件包、动静库或零碎接口的调用变动,非100%表明在某个性能调用时可能会触发异样,未调用到时可能体现失常;局部后果倡议人工复核,最终软件包应用建优先级倡议 openEuler已移植包>openEuler上人工重编译包>centos软件包。
报告剖析
关上html报告,逐行剖析,得出结论:在openEuler上间接应用centos的mysql包存在危险,危险如下:1个待确认接口表明mysql系列软件包会调用到libaio.so.1.0.1,其函数参数数量从4变为5,间接影响了性能,在某个性能调用时可能会触发异样;另外,报告显示须要确认3个依赖软件包,通过人工确认属于mysql系列包自闭环的依赖,故软件包装置无影响
剖析后果倡议
倡议:因为函数调用危险,倡议间接应用在openEuler官网编译移植过的mysql-5.7.21系列软件包https://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/x86_64/Packages/mysql5-5.7.21-3.oe1.x86_64.rpmhttps://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/x86_64/Packages/mariadb-common-10.3.9-9.oe1.x86_64.rpmhttps://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/x86_64/Packages/mysql5-common-5.7.21-3.oe1.x86_64.rpmhttps://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/x86_64/Packages/mysql5-server-5.7.21-3.oe1.x86_64.rpmhttps://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/x86_64/Packages/mysql5-errmsg-5.7.21-3.oe1.x86_64.rpmhttps://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/x86_64/Packages/mecab-0.996-2.oe1.x86_64.rpm
装置数据库mysql
装置mysql并配置明码
- 装置mariadb及mysql相干服务。
rpm -ivh mysql5-5.7.21-3.oe1.x86_64.rpm mariadb-common-10.3.9-9.oe1.x86_64.rpm mysql5-common-5.7.21-3.oe1.x86_64.rpm mysql5-server-5.7.21-3.oe1.x86_64.rpm mecab-0.996-2.oe1.x86_64.rpm mysql5-errmsg-5.7.21-3.oe1.x86_64.rpm
- 启动mysql。
systemctl start mysqld
- mysql状态查问。
systemctl status mysqld
状态为running则启动胜利:
[email protected] ~# systemctl status mysqld● mysqld.service - MySQL 5.7 database server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2021-09-09 10:23:25 CST; 1 day 4h ago Process: 103715 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Process: 103738 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, sta> Process: 103773 ExecStart=/usr/libexec/mysqld --daemonize --basedir=/usr --pid-file=/run/mysqld> Process: 103803 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS) Main PID: 103775 (mysqld) Tasks: 37 Memory: 188.4M CGroup: /system.slice/mysqld.service └─103775 /usr/libexec/mysqld --daemonize --basedir=/usr --pid-file=/run/mysqld/mysqld.
- 登录并批改默认明码。
mysql -uroot -p
a. 默认没有明码,按回车即可登录。
[email protected] /# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.21 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
b. 设置明码。
alter user 'user'@'localhost' identified by 'passward';
mysql> alter user 'root'@'localhost' identified by '123456';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql>
flush privileges必须执行,否则设置不失效。
5) 验证明码。
退出后从新登录,查看明码是否批改胜利。
[email protected] /# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.21 MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
相干链接:
- openEuler官网:www.openeuler.org/
- OS迁徙专区: https://www.openeuler.org/zh/...
- openEuler兼容性列表:https://www.openeuler.org/zh/...
- openEuler迁徙指南:https://www.openeuler.org/zh/...