CDH 元数据库升级 元数据库切换
元数据库设计到的服务:
scm库:server
hive库:hive元数据信息
amon库:cloudera management服务
hue库:存储hue的账户及查询信息
元数据库要从5.7.24升级到5.7.25,为了避免升级失败导致 集群不可用,我们计划在另一个节点安装5.7.25数据库,然后导入数据,并完成cm数据库切换。
1.关闭hive、clouderamanagement服务
/etc/init.d/cloudera-scm-server stop
2.关闭主节点server、所有节点agent进程
for i in {21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40} ; do ssh root@yz-pdip-0$i '/etc/init.d/cloudera-scm-agent stop' ;done;
3.备份my.cnf和mysql里面的数据
cp /etc/my.cnf /etc/my.cnf.bak
mysqldump -uroot -proot --all-databases > mysqlbak.sql
4.安装mysql、初始化、启动、设置root密码、倒入数据、查看用户、创建用户、授予用户权限;
ll mysql-community-common-5.7.25-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm mysql-community-client-5.7.25-1.el7.x86_64.rpm mysql-community-libs-5.7.25-1.el7.x86_64.rpm mysql-community-server-5.7.25-1.el7.x86_64.rpm #安装 rpm -ivh * #初始化 mysqld --initialize --user=mysql #启动 systemctl start mysqld mysql -uroot -p #修改密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; #查看用户 select Host,user from mysql.user; 创建用户、授权 create user 'scm'@'%' identified by 'scm'; grant all privileges on scm.* on 'scm'@'%';
5.修改cloudera-scm-server主机的配置
/etc/cloudera-scm-server/db.properties
指定server的db为新集群hostname
6、启动cloudera-scm-server
/etc/init.d/cloudera-scm-server start for i in {21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40} ; do ssh root@yz-pdip-0$i ‘/etc/init.d/cloudera-scm-agent start’ ;done;
7.可视化页面修改amon、hive数据库信息。