Press "Enter" to skip to content

cloudera manager服务迁移

万分重要----------------umask一定要设置为022,不然可能服务起不来!!!!!----------------

1、postgresql数据库导入以及导出

postgresql数据库安装以及配置过程略。

-------数据库配置文件为/etc/cloudera-scm-server/db.properties
-------新建用户和库(cloudera-scm为原postgresql数据库超级用户)
create user cloudera-scm password '1234567890' superuser createrole createdb;
grant postgres to cloudera-scm 
-------
CREATE USER amon WITH PASSWORD '1234567890';
CREATE DATABASE amon OWNER amon ;
GRANT ALL PRIVILEGES ON DATABASE amon to amon;
-------
CREATE USER hive WITH PASSWORD '1234567890';
CREATE DATABASE hive OWNER hive ;
GRANT ALL PRIVILEGES ON DATABASE hive to hive;
-------
CREATE USER hue WITH PASSWORD '1234567890';
CREATE DATABASE hue OWNER hue ;
GRANT ALL PRIVILEGES ON DATABASE hue to hue;
-------
CREATE USER nav WITH PASSWORD '1234567890';
CREATE DATABASE nav OWNER nav ;
GRANT ALL PRIVILEGES ON DATABASE nav to nav;
-------
CREATE USER navms WITH PASSWORD '1234567890';
CREATE DATABASE navms OWNER navms ;
GRANT ALL PRIVILEGES ON DATABASE navms to navms;
-------
CREATE USER oozie_oozie_server WITH PASSWORD '1234567890';
CREATE DATABASE oozie_oozie_server OWNER oozie_oozie_server ;
GRANT ALL PRIVILEGES ON DATABASE oozie_oozie_server to oozie_oozie_server;
-------
CREATE USER rman WITH PASSWORD '1234567890';
CREATE DATABASE rman OWNER rman ;
GRANT ALL PRIVILEGES ON DATABASE rman to rman;
-------
CREATE USER scm WITH PASSWORD '1234567890';
CREATE DATABASE scm OWNER scm ;
GRANT ALL PRIVILEGES ON DATABASE scm to scm;
-------导出老数据
pg_dump -h localhost amon -U cloudera-scm -p 7432  -f amon.sql
pg_dump -h localhost hive -U cloudera-scm -p 7432  -f hive.sql
pg_dump -h localhost hue -U cloudera-scm -p 7432  -f hue.sql
pg_dump -h localhost nav -U cloudera-scm -p 7432  -f nav.sql
pg_dump -h localhost navms -U cloudera-scm -p 7432  -f navms.sql
pg_dump -h localhost oozie_oozie_server -U cloudera-scm -p 7432  -f oozie_oozie_server.sql
pg_dump -h localhost rman -U cloudera-scm -p 7432  -f rman.sql
pg_dump -h localhost scm -U cloudera-scm -p 7432  -f scm.sql
-------删除表(新的数据库如果有错误数据的话,可能需要此步骤,没有的话就跳过此步骤)
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname='oozie_oozie_server' AND pid<>pg_backend_pid();-------如果database drop不掉被占用的话,先执行这个sql
drop database hive;
drop database hue;
drop database oozie_oozie_server;
drop database scm;
-------查看库
\l
-------切换数据库
\c hue
-------查看库下面的表
\d
-------查看以及删除用户  
\du
drop user hive;
drop user hue;
drop user hue1;
drop user oozie_oozie_server;
drop user oozie_oozie_server1;
drop user scm;
-------查看有哪些用户
\du
--------------初始化cloudera-scm-server服务
/usr/share/cmf/schema/scm_prepare_database.sh postgresql scm scm  -h 1.2.3.4 -P 7432(自己修改IP,如果不是默认5432端口的话,加参数-P[大写P])
-------------导入新数据
psql -p 7432 -U amon amon < amon.sql
psql -p 7432 -U hive hive < hive.sql
psql -p 7432 -U hue hue < hue.sql
psql -p 7432 -U nav nav < nav.sql
psql -p 7432 -U navms navms < navms.sql
psql -p 7432 -U oozie_oozie_server oozie_oozie_server < oozie_oozie_server.sql
psql -p 7432 -U rman rman < rman.sql
psql -p 7432 -U scm scm < scm.sql

2、安装cloudera-manager-server

yum install -y cloudera-manager-server

3、服务前移

).在cloudera manager页面上停止Cloudera Management Service监控服务
).主节点关闭cloudera-scm-server,所有节点关闭cloudera-scm-agent
主节点:service cloudera-scm-server stop
所有节点:service cloudera-scm-agent stop
.修改新的主节点下 service  cloudera-scm-server/db.properties的配置文件 
vi /etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.host=hadoopNode2
).修改所有节点agent下的配置文件
vi  /etc/cloudera-scm-agent/config.ini
server_host=hadoopNode2
).主节点启动 cloudera-scm-server
service cloudera-scm-server start
所有节点启动cloudera-scm-agent
service cloudera-scm-agent start
).登陆新节点的7180,查看服务状态 

Be First to Comment

发表评论

邮箱地址不会被公开。 必填项已用*标注