GBase 8a
其他
文章

虚拟集群gn节点扩容

发表于2025-01-01 10:45:4034次浏览0个评论

千万不要操作错节点
安装时保证源和目标的字符集要一样,都是gbk。另外环境还要再检查下
执行importvc,所有gc都会重启
alter user root identified by 'xx';
此次扩容7台机器,另外机器用于后期创建新VC

east集群之前卸数bug打过补丁,新扩容机器没打,触发了bug,应该提前处理

1、在目标管理节点: 
import vc
(1)创建示范配置文件
gcadmin importvc e import_vc.xml
--    <imported_vc_gcluster_ip ip_list="192.168.5.36"/>    源端管理节点IP

vi import_vc.xml
-------
<?xml version='1.0' encoding="utf-8"?>
<import_vc_parameter>

   <source_vc_name name="vcso"/>
   <target_vc_name name="vcso"/>

   <imported_vc_gcluster_ip ip_list="6.6.6.8"/>

   <imported_vc_os_dba_user_name os_user_name="gbase"/>
   <imported_vc_os_dba_password os_password="Z2Jhc2U="/>

   <imported_vc_db_user_name db_user_name="root"/>
   <imported_vc_db_password db_password="Z2Jhc2UyMDExMDUzMQ=="/>

   <importing_os_dba_user_name os_user_name="gbase"/>
   <importing_os_dba_password os_password="Z2Jhc2U="/>

   <importing_db_user_name db_user_name="root"/>
   <importing_db_password db_password="Z2Jhc2UyMDExMDUzMQ=="/>

   <import_vc_timeout timeout="60"/>

   <import_vc_include_large_data_info include_large_data_info="0"/>

</import_vc_parameter>
----------------------------------
[gbase@vm1 ~]$ python
>>> import base64
>>> base64.b64encode('ndty@2022')
'bmR0eUAyMDIy'
>>> base64.b64encode('gbase20110531')
'Z2Jhc2UyMDExMDUzMQ=='
>>> exit()

要保证集群状态正常,导入过程中会重启集群
测试:执行导入报错:gcadmin addnodes to cluster error: [14]->[GC_AIS_ERR_EXIST],重新执行导入成功了

尽管同为95327.17,但该版本在x86和aarch64下的 gcadmin –v 版本号不一致,在x86下是c111049, aarch64下是5115357205
1、修改执行节点gcware目录下脚本,路径gcware/bin/gadm_python_tools.py,  注释掉509行后执行导入,报错提示版本不一致;
509 #    SSHExec(cmd, timeout, os_pwd)
执行导入
gcadmin importvc import_vc.xml

2、源管理节点生成/tmp/imported_vc_info,拷贝到执行导入的管理节点/tmp,然后修改imported_vc_info 的gcware版本号(x86版本号,即c111049)
"version":"9.5 build 5115357205"改成 "version":"9.5 build c111049"

3、再修改 gadm_python_tools.py,将1928行注释掉并将1929行改成sys.exit(0)
1928         #ret = importvc_get_source_info()
1929         sys.exit(0)
再次导入
gcadmin importvc import_vc.xml

确认其gcware等信息变为了导入集群的gcware
# less /opt/192.168.5.78/gnode/config/cluster_common.cnf

导入成功后查询,源端VC没有了,目标端出现导入的vc

8、新加入vc GC没有gclustered数据库,但是gn层有,需要手工删除
$ gncli -gbase -pgbase20110531 -h172.16.9.184   
--等价于 gccli -ugbase -pgbase20110531 -h6.6.6.8 -P5050
show databases;      该命令能成功执行,说明进到了GN;
drop database gclusterdb;
执行以下:
--h 和P一定要联合使用
gccli -ugbase -pgbase20110531 -h192.168.192.59 -P5050 -e"show vcs"  -报错才正常
gccli -ugbase -pgbase20110531 -h192.168.192.59 -P5050 -e"show databases"  --成功执行
gccli -ugbase -pgbase20110531 -h192.168.192.59 -P5050 -e"drop database gclusterdb"
gccli -ugbase -pgbase20110531 -h192.168.192.59 -P5050 -e"show databases" --再检查


9、gcadmin查看distributionid,gc层删除gclusterdb.rebalancing_status和dual
gccli -ugbase -pgbase20110531
select * from gbase.table_distribution where data_distribution_id=18;  --先查询再删,有2条记录
delete gbase.table_distribution where data_distribution_id=18;

select * from gbase.nodedatamap;--不做
delete gbase.nodedatamap where data_distribution_id=3;--不做

====================================
第二部分:只在混合节点执行:  
将源集群的复合节点改成纯数据节点:对照其他数据节点杀掉多余进程,只要gnode进程,还要拉起gcmonit & gcmmonit
ps -ef|grep opt
gcluster_services all stop  
gcware_services all stop
gcluster_services gbase start   
gcluster_services syncserver start
现在只有gc_sync_server & gbased进程

1、cd  gcluster/server/bin
只保留以下3个文件gcrcman_node.py、gcrcman.py、gcrcmans(目录)
mv gcrcman* 111

2、cd gcluster/config
新建目录,把所有文件移进去

3、/opt/172.16.9.183/gcware只保留以下2个文件include、lib64

在另一个gn操作:
4、拷贝gnode/sever/bin下的gcmonit、gcmmonit,拷贝过去属主是gbase
scp gcm* gbase@6.6.6.8:/opt/6.6.6.8/gnode/server/bin

5、拷贝gnode/config下的gcmonit.cnf、gccmonit.cnf
scp gcm* gbase@6.6.6.8:/opt/6.6.6.8/gnode/config
修改gcmonit.conf & gcmmonit.conf对应ip

6、~/.gbase_profile删除最后几行,和其余GNODE一样

7、/opt/172.16.9.183/gbase_profile拷贝其他GNODE,并改成对应ip

8、执行 gcluster_services all restart
检查 ps -ef|grep opt

=========================================
第3部分:在目标管理节点操作
拆分成freenode
gcadmin rmvc vcso

迁移数据:
将freenode加入到指定VC
vi 2.xml --只写拆分后的其中7个ip!!
cd /opt/gcinstall
cp gcChangeInfo.xml 2.xml
gcadmin addnodes 2.xml vc_east
gcadmin showcluster vc vc_east

创建distribution
--区别当前vc的distribution,每个distribution只能存在一种OS
vi 3.xml ----写vc_east所有ip,已有8个+新的7个
extension:当前节点的分片信息还在当前机器
gcadmin distribution 3.xml p 1 d 1 extension vc vc_east  db_user gbase db_pwd gbase20110531  dba_os_password ndty@2022

gcadmin showcluster vc vc_east
gcadmin showdistribution node vc vc_east

关闭管理节点
gccli -ugbase -pgbase20110531
use vc vc_east;
initnodedatamap;
rebalance instance to xx;

如果不初始化直接rebalance,报错:table can't be rebalanced when only one distribution rule
select * from gclusterdb.rebalancing_status;
-查看同步

select * from gbase.table_distribution;
-查看表分布

优先迁移复制表
对所有的表执行update操作
select distinct dbName from gbase.table_distribution where  isReplicate='YES' and vc_id='vc00004' ;
select tbName,dbName from gbase.table_distribution where  isReplicate='YES' and vc_id='vc00004' and dbName  not in ('gclusterdb') into outfile '/tmp/0416.txt';   
| aml    |
| zxbs   |
| label  |
| jsbips

55

[root@vmm1 tmp]# cat 0416_1.txt |awk  '{print "update gclusterdb.rebalancing_status set priority =1 where table_name = \47"$1"\47 and db_name = \47"$2"\47;"}' > 22.txt

less /tmp/22.txt 
update gclusterdb.rebalancing_status set priority =1 where table_name = 't1' and db_name = 'db1';
update gclusterdb.rebalancing_status set priority =1 where table_name = 'tmp_core_jh_org_cust' and db_name = 'aml';

gccli -ugbase -pgbase20110531  -Dvc_east. < 22.txt
确认修改成功
select count(1) from gclusterdb.rebalancing_status where priority=1;

确认复制表都已经迁过去了
select count(1) from gclusterdb.rebalancing_status where priority=1 and distribution_id =4;
--0
select count(1) from gclusterdb.rebalancing_status where priority=1 and distribution_id =19;

监控同步情况
gccli -ugbase -pgbase20110531 -Dvc_east. -e"select status,count(1) from gclusterdb.rebalancing_status group by status;"

gccli -ugbase -pgbase20110531 -Dvc_east. -e"select * from gclusterdb.rebalancing_status where status='RUNNING'"

gccli -ugbase -pgbase20110531 -e"set global gcluster_rebalancing_concurrent_count=30;"
gccli -ugbase -pgbase20110531 -e"show variables like  'gcluster_rebalancing_concurrent_count'"

取消
use vc vc_east;
cancel rebalance table 库.xx;
0条返回记录是正常的
需要等一会儿才查不到

重新做分布
1、gccli -ugbase -pgbase20110531 -e"show variables like  'gcluster_rebalancing_concurrent_count'"
确定是0

2、取消现有的任务,running是空的
use vc vc_east;
cancel rebalance table 库.xx;
cancel如果上时间取消不了,可以杀sql
gccli -ugbase -pgbase20110531 -Dvc_east. -e"select * from gclusterdb.rebalancing_status where status='RUNNING'"


3、
use vc vc_east;
select count(*) from gclusterdb.rebalancing_status;
truncate table gclusterdb.rebalancing_status;
rebalance instance to 19;


----------------------------
rebalance做完,新建表会建在新的disid。

删除旧分片信息之前,确认没有表使用旧的 Distribution ID
select count(*) from gbase.table_distribution where data_distribution_id=4 ;  --old
select count(*) from gbase.table_distribution where data_distribution_id=4 ; --new

(1)删除hashmap
gbase> use vc vc_east;
gbase> refreshnodedatamap drop x;
整个集群不能有DDL

(2)删除distribution
gcadmin rmdistribution x vc vc_east
检查
gcadmin showcluster vc vc_east
gcadmin showdistribution node vc vc_east

 

评论

登录后才可以发表评论