8ampp集群sudo模式的安装替换

Sudo:linux系统管理命令,是允许系统管理员让普通用户执行一些或者全部root命令的一个工具。可在没有root用户或者密码时使用

测试集群版本:86243_r36_patch.1

测试场景:现场没有root用户密码。所以需要在没有root密码的情况下,对集群进行安装,升级,扩容和节点替换

测试前提:sudo权限需要设置如下:

1、在各个节点上创建loginUse = test

groupadd test

useradd -m -g test test

passwd test

2、在各个节点上配置sudo vim /etc/sudoers 或者执行visudo

test ALL=(ALL) NOPASSWD:ALL

[root@anolis-8-6-1 ~]# cat /etc/sudoers.d/gbase

# User rules for gbase

gbase ALL=(ALL) NOPASSWD:ALL

#zx ALL=(ALL) NOPASSWD:ALL

test ALL=(ALL) NOPASSWD:ALL

3、设置root用户禁止登录(可不进行设置,设置完成root不可登录)

vim /etc/passwd 将root那一行启动脚本 /bin/bash 改为 /bin/bash/nologin

4、修改demo.optioins(区分大小写)

添加sudoMode = True loginUser= test

安装测试场景:

[test@anolis-8-6-1 gcinstall8.6.2_build43-R36.6-centos8]$ cat demo.options

installPrefix= /opt

coordinateHost = 10.10.14.159

coordinateHostNodeID = 234,235,237

dataHost = 10.10.14.159

#existCoordinateHost =

#existDataHost =

loginUser= test ===》sudo用户

loginUserPwd = ‘111111’ ===》sudo用户密码

#loginUserPwdFile = loginUserPwd.json

dbaUser = gbase

dbaGroup = gbase

dbaPwd = ‘gbase’

rootPwd = ‘xxxxxx’===》root密码错误

sudoMode = True ===》走sudo模式

#rootPwdFile = rootPwd.json

dbRootPwd = ‘’

#mcastAddr = 226.94.1.39

mcastPort = 5493

#gbase用户执行安装(-i是安装时忽略操作系统和集群安装包不一致的参数。本次使用龙晰系统和centos8的安装包)

[gbase@anolis-8-6-1 gcinstall8.6.2_build43-R36.6_patch.1]$ ./gcinstall.py --silent=demo.options -a -i

。。。

10.10.14.159 Install gcluster on host 10.10.14.159 successfully.

Starting all gcluster nodes…

Adding new datanodes to gcware…

InstallCluster Successfully

卸载测试场景:

#停止集群服务使用test用户

[root@anolis-8-6-1 ~]# su - test

Last login: Thu Aug 3 14:40:44 CST 2023 from 10.10.14.159 on pts/4

[test@anolis-8-6-1 ~]$ sudo service gcware stop

Stopping gcware (via systemctl): [ OK ]

#gbase用户执行卸载

[gbase@anolis-8-6-1 gcinstall8.6.2_build43-R36.6_patch.1]$ ./unInstall.py --silent=demo.options -a

These GCluster nodes will be uninstalled.

CoordinateHost:

10.10.14.159

DataHost:

10.10.14.159

10.10.14.159 UnInstall 10.10.14.159 successfully.

扩容测试场景:

su - test

sudo service gcware stop

[gbase@anolis-8-6-1 gcinstall8.6.2_build43-R36.6_patch.1]$ cat demo.options

installPrefix= /opt

coordinateHost = 10.10.11.228

coordinateHostNodeID = 234

dataHost = 10.10.11.228

existCoordinateHost =10.10.14.159

existDataHost =10.10.14.159

loginUser= test

loginUserPwd = ‘111111’

#loginUserPwdFile = loginUserPwd.json

dbaUser = gbase

dbaGroup = gbase

dbaPwd = ‘gbase’

rootPwd = ‘xxxxxx’===》错误密码

sudoMode = True

#rootPwdFile = rootPwd.json

dbRootPwd = ‘’

#mcastAddr = 226.94.1.39

mcastPort = 5493

[gbase@anolis-8-6-1 opt]$ ./gcinstall.py --silent=demo.options -a -i

10.10.14.159 Install gcluster on host 10.10.14.159 successfully.

10.10.11.228 Install gcluster on host 10.10.11.228 successfully.

Update and sync configuration file…

Starting all gcluster nodes…

Sync coordinator system tables…

check database password …

check database password successful

check rsync command status

use rsync command sync metadata

Adding new datanodes to gcware…

ExtendCluster Successfully

Ps:缩容,操作步骤和扩容类似不做说明

节点替换测试场景:

[gbase@anolis-8-6-1 gcinstall8.6.2_build43-R36.6_patch.1]$ ./replace.py --host=10.10.11.228 --sudo=True --login_user=test --login_user_pwd=111111 --dbaUser=gbase --dbaUserPwd=gbase --i --overwrite

check os password …

check os password successful

check database password …

check database password successful

10.10.11.228

Are you sure to replace install these nodes ([Y,y]/[N,n])? y

some gcluster process still running on host 10.10.11.228, use ‘pidof gclusterd gbased corosync gcmonit gcrecover gc_sync_server;’ to check.

Starting all gcluster nodes…

check rsync command status on available coordinator and replaced coordinator

copy sync command file to available coordinator

execute sync gcluster metadata command on coordinator

check target coordinator metadata begin

check target coordinator metadata end

restart target coordinator gclusterd

sync coordinator metadata end …

get table id and set dmlstorageevent on node [::ffff:10.10.14.159], please wait a moment

load gbase client dll start …

load gbase client dll end …

check node data map and cluster state start …

check node data map and cluster state end …

get distribution information start …

get distribution information end …

check ip start …

check ip end …

switch cluster mode into READONLY start …

wait all ddl statement stop …

all ddl statement stoped

switch cluster mode into READONLY end …

delete all fevent log on replace nodes start …

delete ddl event log on node 10.10.11.228 start

delete ddl event log on node 10.10.11.228 end

delete dml event log on node 10.10.11.228 start

delete dml event log on node 10.10.11.228 end

delete dml storage event log on node 10.10.11.228 start

delete dml storage event log on node 10.10.11.228 end

delete all fevent log on replace nodes end …

sync metedata start …

sync coordinator metedata start …

sync coordinator metedata end,spend time 37832 ms …

sync data server metedata start …

copy script to data node begin

copy script to data node end

build data packet begin

build data packet end

copy data packet to target node begin

copy data packet to target node end

extract data packet begin

extract data packet end

sync dataserver metedata end,spend time 29902 ms …

sync metedata end …

set sync data flag start …

create database start …

create database end …

create database and set table dml storage event spend time 11491 ms …

set sync data flag end …

restore cluster mode start …

restore cluster mode end …

restore node state start …

restore node state end …

all nodes replace success end

replace nodes spend time: 154553 ms

Replace gcluster nodes successfully.

[gbase@anolis-8-6-1 gcinstall8.6.2_build43-R36.6_patch.1]$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值