立即注册 登录
About云-梭伦科技 返回首页

Aningorg的个人空间 https://aboutyun.com/?70889 [收藏] [复制] [分享] [RSS]

日志

CDH集群修改IP后,无法启动默认postgre元数据库

已有 968 次阅读2020-6-4 14:05 |个人分类:postgresql|系统分类:Cloudera系列

由于CDH集群迁移,
涉及到IP修改
故准备登陆postgre数据库进行信息修改

1.执行service cloudera-scm-server-db status 查看数据库是否启动:
提示:pg_ctl: no server running

2.执行service cloudera-scm-server-db start
报错:DB initialization done. waiting for server to start...............................could not start server
无法启动数据库

3.查看元数据库日志/var/log/cloudera-scm-server/db.log
报错:FATAL:  could not create shared memory segment: Invalid argument
DETAIL:  Failed system call was shmget(key=7432001, size=8579350528, 03600).
HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMMAX.  To reduce the request size (currently 8579350528 bytes), reduce PostgreSQL's shared_buffers parameter (currently 1022611) and/or its max_connections parameter (currently 503).
        If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
        The PostgreSQL documentation contains more information about shared memory configuration.

从报错信息看,并查看 postgresql.conf 其它参数,觉得应该是 SHMMAX 设置的问题。shmmax、shmall 都设置的太小会出现无法创建共享内存段的问题,所以可以适当增大,在这里我修改vim /etc/sysctl.conf文件,
kernel.shmmax = 4398046511104。
再启动,则元数据库可以启动。

4.元数据库启动之后
(1)执行
service cloudera-scm-agent stop(所有节点执行) service cloudera-scm-server stop(master节点执行)
将节点上服务停止

(2)查看对应数据库的scm用户密码
vim /etc/cloudera-scm-server/db.properties
里边com.cloudera.cmf.db.password=对应的即是scm用户的密码,先记住,后边登录用

(3)在CDH Manager管理节点上登录数据库(默认Postgresql)
执行psql -h localhost -p 7432 -U scm,登录元数据库,提示输入密码,输入刚才查到的密码即可。
进入数据库后执行:select host_id, host_identifier, name, ip_address from hosts;
 host_id |           host_identifier            |        name         | ip_address
---------+--------------------------------------+---------------------+-------------
       8 | 40bce2b1-d718-467b-b757-49b55ed2fed6 | esg11.esgyncn.local | 10.10.10.11
       6 | f63edca9-b64b-4d03-9339-724d520ffeef | esg08.esgyncn.local | 10.10.10.8

找到需要修改的IP对应行,执行
update hosts set ip_address='...' where ip_address='';
依次修改即可。
(4)数据库修改完成退出数据库(:\q)

5.修改所有节点的Agent配置文件
(1)将server_hosts的值修改为新的CDH Manager管理节点的IP vi /etc/cloudera-scm-agent/config.ini
(2)修改所有节点的/etc/hosts,将IP修改为新的IP
(3)重启启动CDH Manager对应的管理进程及Agent服务即可
service cloudera-scm-server-db restart(主节点) 
service cloudera-scm-server start (主节点)
service cloudera-scm-agent start(所有节点)


以下为元数据库为MYSQL的修改步骤


1. 修改/etc/hosts中的IP为新IP

2. 进入mysql
[root@YXnode01 ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9593
Server version: 5.6.31-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

3. 找到hosts表
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| amon               |
| cm                 |
| hive               |
| mysql              |
| performance_schema |
| rman               |
| test               |
+--------------------+
8 rows in set (0.00 sec)
mysql> use cm
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+--------------------------------+
| Tables_in_cm                   |
+--------------------------------+
| AUDITS                         |
| CLIENT_CONFIGS                 |
| CLIENT_CONFIGS_TO_HOSTS        |
| CLUSTERS                       |
| CLUSTERS_AUD                   |
| CLUSTER_ACTIVATED_RELEASES     |
| CLUSTER_ACTIVATED_RELEASES_AUD |
| CLUSTER_MANAGED_RELEASES       |
| CLUSTER_UNDISTRIBUTED_RELEASES |
| CM_PEERS                       |
| CM_VERSION                     |
| COMMANDS                       |
| COMMANDS_DETAIL                |
| COMMAND_SCHEDULES              |
| CONFIGS                        |
| CONFIGS_AUD                    |
| CONFIG_CONTAINERS              |
| CREDENTIALS                    |
| DIAGNOSTICS_EVENTS             |
| EXTERNAL_ACCOUNTS              |
| EXTERNAL_ACCOUNTS_AUD          |
| GLOBAL_SETTINGS                |
| HOSTS                          |
| HOSTS_AUD                      |
| HOST_TEMPLATES                 |
| HOST_TEMPLATE_TO_ROLE_CONF_GRP |
| METRICS                        |
| PARCELS                        |
| PARCEL_COMPONENTS              |
| PROCESSES                      |
| PROCESSES_DETAIL               |
| PROCESS_ACTIVE_RELEASES        |
| RELEASES                       |
| RELEASES_AUD                   |
| REVISIONS                      |
| ROLES                          |
| ROLES_AUD                      |
| ROLE_CONFIG_GROUPS             |
| ROLE_CONFIG_GROUPS_AUD         |
| ROLE_STALENESS_STATUS          |
| SCHEMA_VERSION                 |
| SERVICES                       |
| SERVICES_AUD                   |
| SNAPSHOT_POLICIES              |
| USERS                          |
| USER_ROLES                     |
| USER_SETTINGS                  |
+--------------------------------+
47 rows in set (0.00 sec)

4. 查询HOSTS
mysql> select * from hosts;
ERROR 1146 (42S02): Table 'cm.hosts' doesn't exist
mysql> select * from HOSTS;
+---------+-------------------------+--------------------------------------+-------------------+----------------+----------+--------+----
| HOST_ID | OPTIMISTIC_LOCK_VERSION | HOST_IDENTIFIER                      | NAME              | IP_ADDRESS     | RACK_ID  | STATUS | CONFIG_CONTAINER_ID | MAINTENANCE_COUNT | DECOMMISSION_COUNT | CLUSTER_ID | NUM_CORES | TOTAL_PHYS_MEM_BYTES | PUBLIC_NAME | PUBLIC_IP_ADDRESS | CLOUD_PROVIDER |
+---------+-------------------------+--------------------------------------+-------------------+----------------+----------+--------+----
|1 |25 | d3c2a68c-8f3a-4b81-bfd9-fddfe91fba9c | YXnode01.esgyn.cn | 172.16.253.117 | /default |NA|1 |0 |0 |1 |8 |25112600576 | NULL| NULL| NULL|
|2 |21 | 897848be-cbe1-4171-93ef-53750cbfd156 | YXnode03.esgyn.cn | 172.16.253.119 | /default |NA|1 |0 |0 |1 |8 |16657936384 | NULL| NULL| NULL|
|3 |23 | 41569980-d8db-418e-88fd-26cbd3898499 | YXnode02.esgyn.cn | 172.16.253.118 | /default |NA|1 |0 |0 |1 |8 |16657936384 | NULL| NULL| NULL|
+---------+-------------------------+--------------------------------------+-------------------+----------------+----------+--------+----
3 rows in set (0.00 sec)

5. 更新HOSTS中的IP
update HOSTS set IP_ADDRESS='172.16.253.217' where IP_ADDRESS='172.16.253.117';
update HOSTS set IP_ADDRESS='172.16.253.218' where IP_ADDRESS='172.16.253.118';
update HOSTS set IP_ADDRESS='172.16.253.219' where IP_ADDRESS='172.16.253.119';

6. 检查是否修改成功
mysql> select * from HOSTS;
+---------+-------------------------+--------------------------------------+-------------------+----------------+----------+--------+----
| HOST_ID | OPTIMISTIC_LOCK_VERSION | HOST_IDENTIFIER                      | NAME              | IP_ADDRESS     | RACK_ID  | STATUS | CONFIG_CONTAINER_ID | MAINTENANCE_COUNT | DECOMMISSION_COUNT | CLUSTER_ID | NUM_CORES | TOTAL_PHYS_MEM_BYTES | PUBLIC_NAME | PUBLIC_IP_ADDRESS | CLOUD_PROVIDER |
+---------+-------------------------+--------------------------------------+-------------------+----------------+----------+--------+----
|1 |25 | d3c2a68c-8f3a-4b81-bfd9-fddfe91fba9c | YXnode01.esgyn.cn | 172.16.253.217 | /default | NA|1 |0 |0 |1 |8 |25112600576 | NULL| NULL| NULL|
|2 |21 | 897848be-cbe1-4171-93ef-53750cbfd156 | YXnode03.esgyn.cn | 172.16.253.219 | /default | NA|1 |0 |0 |1 |8 |16657936384 | NULL| NULL| NULL|
|3 |23 | 41569980-d8db-418e-88fd-26cbd3898499 | YXnode02.esgyn.cn | 172.16.253.218 | /default | NA|1 |0 |0 |1 |8 |16657936384 | NULL| NULL| NULL|
+---------+-------------------------+--------------------------------------+-------------------+----------------+----------+--------+----
3 rows in set (0.00 sec)

7. 修改所有节点的/etc/cloudera-scm-agent/config.ini

8. 重启Cloudera agent及server服务




路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

关闭

推荐上一条 /2 下一条