当前位置:网站首页>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
边栏推荐
- Application of Flody
- [untitled]
- [lgr-109] Luogu may race II & windy round 6
- Postman manage test cases
- Ora-01779: the column corresponding to the non key value saving table cannot be modified
- SQLite queries the maximum value and returns the whole row of data
- Easy to understand I2C protocol
- 麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
- [mathematical modeling] differential equation -- sustainable development of fishing industry
- RT thread analysis log system RT_ Kprintf analysis
猜你喜欢
Cuda11.1 online installation
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
In 2022, we must enter the big factory as soon as possible
GAMES202-WebGL中shader的編譯和連接(了解向)
Vite configures the development environment and production environment
flutter 实现一个有加载动画的按钮(loadingButton)
JS quick start (II)
Please wait while Jenkins is getting ready to work
Application of Flody
Unity Vector3. Use and calculation principle of reflect
随机推荐
树莓派3.5寸屏幕白屏显示连接
Postman assertion
C# AES对字符串进行加密
趋势前沿 | 达摩院语音 AI 最新技术大全
Oracle deletes duplicate data, leaving only one
GAMES202-WebGL中shader的編譯和連接(了解向)
Principle and performance analysis of lepton lossless compression
Postman前置脚本-全局变量和环境变量
pix2pix:使用条件对抗网络的图像到图像转换
nacos-高可用seata之TC搭建(02)
【OSPF 和 ISIS 在多路访问网络中对掩码的要求】
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
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
Realize a binary read-write address book
Set detailed map + interview questions
[buuctf.reverse] 159_[watevrCTF 2019]Watshell
Talking about the type and function of lens filter
Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
Postman测试报告
【LeetCode】18、四数之和