当前位置:网站首页>HAC集群修改管理员用户密码
HAC集群修改管理员用户密码
2022-07-06 05:15:00 【瀚高PG实验室】
瀚高数据库
目录
环境
文档用途
详细信息
环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:4.5.6,4.5.7
文档用途
本文档用于指导HAC集群修改管理员用户密码
详细信息
1、检查集群状态,使用A、B两种方法进行判断
方法A:使用集群命令,确保TL时间线一致,Lag in MB数据同步延迟不能过高,最好延迟为0。
[[email protected] ~]# hghactl list
+ Cluster: ha (7072256965608815760) -------+---------+----+-----------+
| Member | Host | Role | State | TL | Lag in MB |
+----------+---------------------+---------+---------+----+-----------+
| hghac228 | 192.168.80.228:5866 | Leader | running | 6 | |
| hghac230 | 192.168.80.230:5866 | Replica | running | 6 | 0 |
+----------+---------------------+---------+---------+----+-----------+
方法B:各个节点查询进程,有sender节点的是主库,有receiver节点的是备库
ps -ef | grep sender
root 26418 3233 0 6月11 ? 00:00:22 postgres: c: walsender sysdba 192.168.80.228(45186) streaming 0/16000000
ps -ef | grep receiver
root 3372 3348 0 6月11 ? 00:13:54 postgres: c: walreceiver streaming 0/16000000
2、暂停集群
(任意节点执行即可,暂停集群只是停止集群主备切换,不影响数据库使用)
hghactl pause
3、修改密码(只能在主库执行)
highgo=# alter user sysdba with password '[email protected]!';
4、主备库修改密码文件
vim ~/.pgpass
#hostname:port:database:username:password
localhost:5866:highgo:sysdba:[email protected]12345
localhost:5866:highgo:syssso:[email protected]12345
冒号为分隔符,倒数第二位用户名,最后一位数据库密码,将密码修改为修改之后的密码即可,保存退出。
5、主备库修改集群配置文件
vim /opt/HighGo/tools/hghac/hghac.yaml
authentication:
replication:
password: [email protected]123
username: sysdba
rewind:
password: [email protected]123
username: sysdba
sysdba:
password: [email protected]123
syssso:
password: [email protected]123
syssao:
password: [email protected]123
根据对应的用户名修改密码即可,保存退出。
6、备库修改data目录下的postgresql.auto.conf文件
vim $PGDATA/postgresql.auto.conf
primary_conninfo = 'user=sysdba password=''[email protected]'' host=192.168.80.228 port=5866 sslmode=prefer sslcompression=0 gssencmode=disable krbsrvname=postgres target_session_attrs=any'
注意:password前边的user为sysdba,即修改用户sysdba的密码
7、恢复集群(任意节点执行即可)
hghactl resume
8、重启集群生效(任意节点执行即可)
hghactl restart c
注意:
最后一个参数c是集群的名字,查看方法
ps -ef | grep -v grep |grep post |awk '{print $9}'|tail -1|awk '{sub(/.$/,"")}1'
9、查看集群状态
hghactl list
10、重新初始化所有节点的hgproxy
(如果没有使用hgproxy请跳过该步骤)
systemctl stop hgproxy-4.0.2.service --停掉hgproxy服务,hgproxy后边具体内容请使用tab健补齐(proxy版本迭代service不一样)
proxy_ctl init -h 192.168.1.54 -U sysdba -d highgo -p 5866 --初始化
systemctl start hgproxy-4.0.2.service --启动hgproxy服务
11、其他
执行hghactl等集群命令提示“未找到命令”,请配置环境变量,参考如下:
vim ~/.bash_profile
export PGPORT=5866
export PGUSER=sysdba
export PGDATABASE=highgo
export PGHOME=/opt/HighGo4.5.7-see
export PGDATA=/opt/HighGo4.5.7-see/data
export PATH=$PGHOME/bin:$PATH:$HOME/bin:/opt/HighGo/tools/hgproxy/bin:/opt/HighGo/tools/hghac:/opt/HighGo/tools/hghac/etcd
export LD_LIBRARY_PATH=$PGHOME/lib:/usr/lib64:$LD_LIBRARY_PATH
export ETCDCTL_ENDPOINTS=http://10.1.194.182:2379,http://10.1.194.191:2379,http://10.1.194.192:2379
export PATRONICTL_CONFIG_FILE=/opt/HighGo/tools/hghac/hghac-see.yaml
source ~/.bash_profile
注意:
1、需要根据实际情况修改环境变量实际路径,可以使用find命令查找文件路径
例:查找hghac find / -iname hghac -print
2、ETCDCTL_ENDPOINTS三个ip需要修改为配置etcd三节点的ip,可以参考/opt/HighGo/tools/hghac/hghac-see.yaml文件中的etcd:hosts
边栏推荐
- Zynq learning notes (3) - partial reconfiguration
- nacos-高可用seata之TC搭建(02)
- Summary of redis AOF and RDB knowledge points
- Pagoda configuration mongodb
- UCF(2022暑期团队赛一)
- Some common skills on unity inspector are generally used for editor extension or others
- Lepton 无损压缩原理及性能分析
- Select knowledge points of structure
- [noip2008 improvement group] stupid monkey
- Postman断言
猜你喜欢
【OSPF 和 ISIS 在多路访问网络中对掩码的要求】
Leetcode dynamic planning day 16
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
[mathematical modeling] differential equation -- sustainable development of fishing industry
Rce code and Command Execution Vulnerability
Crazy God said redis notes
你需要知道的 TCP 三次握手
[leetcode] 18. Sum of four numbers
F12 solve the problem that web pages cannot be copied
Codeforces Round #804 (Div. 2)
随机推荐
饼干(考试版)
CUDA11.1在线安装
JS quick start (II)
Nestjs配置文件上传, 配置中间件以及管道的使用
集合详解之 Map + 面试题
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Codeforces Round #804 (Div. 2) Editorial(A-B)
Postman Association
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
用StopWatch 统计代码耗时
EditorUtility. The role and application of setdirty in untiy
2021robocom robot developer competition (Preliminary)
L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
Codeforces Round #804 (Div. 2)
Class inheritance in yyds dry inventory C
[lgr-109] Luogu may race II & windy round 6
Microblogging hot search stock selection strategy
Yyds dry inventory SSH Remote Connection introduction