KingbaseES R6 集群sys_monitor.sh change_password一键修改集群用户密码
案例说明:
kingbaseES R6集群用户密码修改,需要修改两处:
1)修改数据库用户密码(alter user);
2)修改.encpwd文件中用户密码;
可以通过sys_monitor.sh change_password一键同时修改数据库内部用户密码和.encpwd文件中密码。
案例测试版本:
test=# select version();
version
----------------------------------------------------------------------------------------------------------------------
KingbaseES V008R006C003B0010 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
(1 row)
集群架构:
sys_monitor.sh change_password user new_password —修改集群使用的用户的密码
描述:
sys_monitor.sh change_password user new_password判断用户是否为集群使用的用户,如果是则修改用户密码,如果不是则提示用户集群未使用该用户,请使用sql方式修改用户密码。
选项:
以下是脚本执行参数:
change_password: 脚本调用修改用户密码函数
user: 要进行修改密码的用户,只能是集群初始化时指定的用户和esrep
new_password: 用户的新密码
注意事项:
1.必须在集群所有节点状态正常的情况下才能执行修改密码操作
2.sys_monitor.sh change_password 用户名 '密码' 使用一键修改密码功能时 密码参数必须使用''括起来
3.用户必须是已经使用.encpwd免密配置文件配置了免密的用户才能进行修改密码,否则会提示集群未使用该用户,请使用sql alter user命令进行修改密码
一、查看esrep用户原密码
1).encpwd文件
[kingbase@node1 ~]$ cat .encpwd
*:*:*:system:MTIzNDU2
*:*:*:esrep:S2luZ2Jhc2VoYTExMA==
[kingbase@node1 ~]$ echo 'S2luZ2Jhc2VoYTExMA=='|base64 -d
Kingbaseha110
2)数据库用户密码
用户密码登录测试(‘Kingbaseha110’):
[kingbase@node3 bin]$ ./ksql -U esrep -W esrep
Password:
ksql (V8.0)
Type "help" for help.
二、一键修改esrep用户密码
[kingbase@node3 bin]$ ./sys_monitor.sh --help
Usage: ./sys_monitor.sh {start|stop|restart|stoplocal|set [--restart]|change_password user password}
[kingbase@node3 bin]$ ./sys_monitor.sh change_password esrep 'beijing'
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+---------+---------+-----------+----------+----------+----------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------
1 | node248 | standby | running | node243 | default | 90 | 26 | host=192.168.7.248 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=2
3 | node243 | primary | * running | | default | 100 | 26 | host=192.168.7.243 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=2
4 | node249 | standby | running | node243 | default | 100 | 26 | host=192.168.7.249 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3
ALTER ROLE
三、新密码登录测试
# 新的用户密码登录(‘beijing’):
[kingbase@node3 bin]$ ./ksql -U esrep -W esrep
Password:
ksql (V8.0)
Type "help" for help.
# 查看.encpwd文件
[kingbase@node3 ~]$ cat .encpwd
*:*:*:system:MTIzNDU2
*:*:*:esrep:YmVpamluZw==
[kingbase@node3 ~]$ echo 'YmVpamluZw=='|base64 -d
beijing
# 所有节点密码都已经被修改
[kingbase@node1 ~]$ cat .encpwd
*:*:*:system:MTIzNDU2
*:*:*:esrep:YmVpamluZw==
[kingbase@node2 ~]$ cat .encpwd
*:*:*:system:MTIzNDU2
*:*:*:esrep:YmVpamluZw==
四、重启集群测试
[kingbase@node3 bin]$ ./sys_monitor.sh restart
2021-03-01 13:07:08 Ready to stop all DB ...
There is no service "node_export" running currently.
There is no service "postgres_ex" running currently.
There is no service "node_export" running currently.
There is no service "postgres_ex" running currently.
There is no service "node_export" running currently.
There is no service "postgres_ex" running currently.
2021-03-01 13:07:18 begin to stop repmgrd on "[192.168.7.248]".
2021-03-01 13:07:18 repmgrd on "[192.168.7.248]" already stopped.
2021-03-01 13:07:18 begin to stop repmgrd on "[192.168.7.243]".
2021-03-01 13:07:19 repmgrd on "[192.168.7.243]" already stopped.
2021-03-01 13:07:19 begin to stop repmgrd on "[192.168.7.249]".
2021-03-01 13:07:20 repmgrd on "[192.168.7.249]" already stopped.
2021-03-01 13:07:20 begin to stop DB on "[192.168.7.248]".
waiting for server to shut down.... done
server stopped
2021-03-01 13:07:21 DB on "[192.168.7.248]" stop success.
2021-03-01 13:07:21 begin to stop DB on "[192.168.7.249]".
sys_ctl: directory "/home/kingbase/cluster/R6HA/KHA/kingbase/data" does not exist
2021-03-01 13:07:23 DB on "[192.168.7.249]" stop success.
2021-03-01 13:07:23 begin to stop DB on "[192.168.7.243]".
waiting for server to shut down..... done
server stopped
2021-03-01 13:07:25 DB on "[192.168.7.243]" stop success.
2021-03-01 13:07:25 Done.
2021-03-01 13:07:25 Ready to start all DB ...
2021-03-01 13:07:25 begin to start DB on "[192.168.7.243]".
waiting for server to start.... done
server started
2021-03-01 13:07:27 execute to start DB on "[192.168.7.243]" success, connect to check it.
2021-03-01 13:07:28 DB on "[192.168.7.243]" start success.
2021-03-01 13:07:28 Try to ping trusted_servers on host 192.168.7.248 ...
2021-03-01 13:07:30 Try to ping trusted_servers on host 192.168.7.243 ...
2021-03-01 13:07:33 Try to ping trusted_servers on host 192.168.7.249 ...
2021-03-01 13:07:36 begin to start DB on "[192.168.7.248]".
waiting for server to start.... done
server started
2021-03-01 13:07:37 execute to start DB on "[192.168.7.248]" success, connect to check it.
2021-03-01 13:07:38 DB on "[192.168.7.248]" start success.
2021-03-01 13:07:38 begin to start DB on "[192.168.7.249]".
sys_ctl: directory "/home/kingbase/cluster/R6HA/KHA/kingbase/data" does not exist
2021-03-01 13:07:40 execute to start DB on "[192.168.7.249]" failed.
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+---------+---------+-----------+----------+----------+----------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------
1 | node248 | standby | running | node243 | default | 90 | 26 | host=192.168.7.248 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=2
3 | node243 | primary | * running | | default | 100 | 26 | host=192.168.7.243 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=2
4 | node249 | standby | running | node243 | default | 100 | 26 | host=192.168.7.249 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3
2021-03-01 13:07:40 The primary DB is started.
2021-03-01 13:07:45 Success to load virtual ip [192.168.7.240/24] on primary host [192.168.7.243].
2021-03-01 13:07:45 Try to ping vip on host 192.168.7.248 ...
2021-03-01 13:07:47 Try to ping vip on host 192.168.7.243 ...
2021-03-01 13:07:50 Try to ping vip on host 192.168.7.249 ...
2021-03-01 13:07:53 begin to start repmgrd on "[192.168.7.248]".
[2021-03-01 13:08:03] [NOTICE] using provided configuration file "/home/kingbase/cluster/R6HA/KHA/kingbase/bin/../etc/repmgr.conf"
[2021-03-01 13:08:03] [NOTICE] redirecting logging output to "/home/kingbase/cluster/R6HA/KHA/kingbase/hamgr.log"
2021-03-01 13:07:53 repmgrd on "[192.168.7.248]" start success.
2021-03-01 13:07:53 begin to start repmgrd on "[192.168.7.243]".
[2021-03-01 13:07:54] [NOTICE] using provided configuration file "/home/kingbase/cluster/R6HA/KHA/kingbase/bin/../etc/repmgr.conf"
[2021-03-01 13:07:54] [NOTICE] redirecting logging output to "/home/kingbase/cluster/R6HA/KHA/kingbase/hamgr.log"
2021-03-01 13:07:54 repmgrd on "[192.168.7.243]" start success.
2021-03-01 13:07:54 begin to start repmgrd on "[192.168.7.249]".
[2021-03-01 13:06:04] [NOTICE] using provided configuration file "/home/kingbase/cluster/R6HA/KHA/kingbase/bin/../etc/repmgr.conf"
[2021-03-01 13:06:04] [NOTICE] redirecting logging output to "/home/kingbase/cluster/R6HA/KHA/kingbase/hamgr.log"
2021-03-01 13:07:56 repmgrd on "[192.168.7.249]" start success.
ID | Name | Role | Status | Upstream | repmgrd | PID | Paused? | Upstream last seen
----+---------+---------+-----------+----------+---------+-------+---------+--------------------
1 | node248 | standby | running | node243 | running | 2625 | no | 0 second(s) ago
3 | node243 | primary | * running | | running | 22122 | no | n/a
4 | node249 | standby | running | node243 | running | 16939 | no | n/a
2021-03-01 13:08:08 Done.
# 查看集群节点状态信息
[kingbase@node3 bin]$ ./repmgr cluster show
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+---------+---------+-----------+----------+----------+----------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------
1 | node248 | standby | running | node243 | default | 90 | 26 | host=192.168.7.248 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=2
3 | node243 | primary | * running | | default | 100 | 26 | host=192.168.7.243 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=2
4 | node249 | standby | running | node243 | default | 100 | 26 | host=192.168.7.249 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3
KingbaseES R6 集群sys_monitor.sh change_password一键修改集群用户密码的更多相关文章
- KingbaseES R6 集群一键修改集群和数据库参数测试案例
案例说明: 集群环境修改集群或数据库参数,需要在每个node上都要修改,在每个节点而执行修改操作,容易出现漏改或节点上参数不一致等错误:在KingbaseES V8R6的集群中增加了,一键修改参数 ...
- KingbaseES R3 集群一键修改集群用户密码案例
案例说明: 在KingbaseES R3集群的最新版本中增加了kingbase_monitor.sh一键修改集群用户密码的功能,本案例是对此功能的测试. kingbaseES R3集群一键修改密码说明 ...
- KingbaseES R6 集群禁用 root ssh 后需要修改集群为es_server 案例
案例说明: 在生产环境下,由于安全需要,主机间不允许建立root用户的ssh信任连接,这样导致KingbaseES R6 repmgr集群,通过sys_monitor.sh脚本启动集群时,节点之间不能 ...
- KingbaseES R3 集群修改system用户密码方案
方案说明: 对于kingbaseES R3集群修改system密码相比单机环境有一定的复杂性,需要修改的位置如下: 1)数据库中system用户密码,可以用alter user命令修改 2)在reco ...
- 网页一键加入QQ群
三步简单实现功能:网页提供加入qq群按钮 让他人一键加入qq群 第一步:进入qq群官网:http://qun.qq.com/join.html 第二步:选择需要加入的群并生成网页代码 第三步:在网页 ...
- KingbaseES R6 集群修改ssh端口执行sys_backup.sh备份案例
数据库环境:** test=# select version(); version ---------------------------------------------------------- ...
- KingbaseES R6 通过脚本构建集群案例
案例说明: KingbaseES V8R6部署一般可采用图形化方式快速部署,但在生产一线,有的服务器系统未启用图形化环境,所以对于KingbaseES V8R6的集群需采用手工字符界面方式部署,本 ...
- KingbaseES R6 主备流复制集群创建级联复制案例
案例环境: 数据库: test=# select version(); version -------------------------------------------------------- ...
- KingbaseES R6 集群修改物理IP和VIP案例
在用户的实际环境里,可能有时需要修改主机的IP,这就涉及到集群的配置修改.以下以例子的方式,介绍下KingbaseES R6集群如何修改IP. 一.案例测试环境 操作系统: [KINGBASE@nod ...
随机推荐
- Vue引入vuetify框架你需要知道的几点
1.命令行安装 npm install vuetify --save 2.在src目录中创建一个名为的文件夹plugins在里面,添加一个vuetify.js文件.代码如下 import Vue fr ...
- Array 数组filter()方法,遍历数组返回符合条件的一个新数组
<script> const arr = [ { id: 1, name: "aa", isDone: false }, { id: 2, name: "bb ...
- 【RPA之家转载RPA创新产业峰会回看】机器人流程自动化专利态势报告
[RPA之家转载RPA创新产业峰会回看]机器人流程自动化专利态势报告 自动化的一个专利情况的监测,就是全球监测的情况.今天我可能给大家汇报的主要是三个方面,第一个方面就是讲一下全球投资智能化的专利的一 ...
- Linux 文件权限相关知识
文件权限说明 Linux中的文件能否被访问和工具(程序)无关,和访问的用户身份有关(谁去运行这个程序) 进程的发起者(谁去运行这个程序). 进程的发起者若是文件的所有者: 拥有文件的属主权限 进程的发 ...
- 使用.NetCore自带的后台作业,出入队简单模拟生产者消费者处理请求响应的数据
环境:Core:3.1的项目 说明:由于该方案为个人测试项目,重启时队列中的部分数据很可能会丢失, 对数据有要求的该方案不适用,不能照搬需要持久化处理, 另外发布到Linux Docker中通常不会自 ...
- bat-命令行配置静态IP地址
查看连接名称ipconfig 打开命令提示符,输入netsh后回车 输入interface后回车 输入ip,回车 输入set address "连接名称" static 新IP地址 ...
- 【问题解决】Alpine镜像中执行jstack、arthas等命令提示Unable to get pid of LinuxThreads manager thread
问题现象 最近在处理项目上问题发现之前同事构建的AlpineLinux的镜像不能执行jstack等JDK命令,报错如下. Unable to get pid of LinuxThreads manag ...
- Future源码一观-JUC系列
背景介绍 在程序中,主线程启动一个子线程进行异步计算,主线程是不阻塞继续执行的,这点看起来是非常自然的,都已经选择启动子线程去异步执行了,主线程如果是阻塞的话,那还不如主线程自己去执行不就好了.那会不 ...
- VS code 远程连接服务器步骤
①安装VS code,并连接远程服务器(本地也需要有ssh).参考 ②免密钥登录设置,参考 具体步骤:WIN+R -->cmd, 输入ssh-keygen,然后一直Enter,最终生成公钥和私钥 ...
- 字符输出流_Writer类&FileWriter类介绍和字符输出流的基本使用_写出单个字符到文件
java.io.Writer:字符输出流,是所有字符输出流的最顶层的父类,是一个抽象类 共性的成员方法: - void write(int c) 写入单个字符 - void write(char[] ...