GaussDB T 分布式集群部署(2)
【摘要】 上一篇链接:https://bbs.huaweicloud.com/blogs/1408195.部署安装[root@Gauss1 ~]# su - ommLast login: Sat Dec 14 20:55:28 CST 2019[omm@Gauss1 ~]$ cd /opt/software/gaussdb/script/[omm@Gauss1 script]$ ./gs_instal...
上一篇链接:https://bbs.huaweicloud.com/blogs/140819
5.部署安装
[root@Gauss1 ~]# su - omm
Last login: Sat Dec 14 20:55:28 CST 2019
[omm@Gauss1 ~]$ cd /opt/software/gaussdb/script/
[omm@Gauss1 script]$ ./gs_install -X /opt/software/gaussdb/clusterconfig.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
Check the time difference between hosts in the cluster.
Installing the cluster.
Installing applications on all nodes.
Successfully installed APP.
Distribute etcd communication keys.
Successfully distrbute etcd communication keys.
Initializing cluster instances
.............1........111s
[SUCCESS] Gauss1:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
Initialize cn_401 instance
Successfully Initialize cn_401 instance.
Initialize DB1_1 instance
Successfully Initialize DB1_1 instance.
Initialize DB4_8 instance
Successfully Initialize DB4_8 instance.
Modifying user's environmental variable $GAUSS_ENV.
Successfully modified user's environmental variable $GAUSS_ENV.
[FAILURE] Gauss2:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
Initialize cn_402 instance
[GAUSS-50601] : The port [8000] is occupied.
[SUCCESS] Gauss3:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
Initialize cn_403 instance
Successfully Initialize cn_403 instance.
Initialize DB2_4 instance
Successfully Initialize DB2_4 instance.
Initialize DB3_5 instance
Successfully Initialize DB3_5 instance.
Modifying user's environmental variable $GAUSS_ENV.
Successfully modified user's environmental variable $GAUSS_ENV.
[SUCCESS] Gauss4:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
Initialize cn_404 instance
Successfully Initialize cn_404 instance.
Initialize DB3_6 instance
Successfully Initialize DB3_6 instance.
Initialize DB4_7 instance
Successfully Initialize DB4_7 instance.
Modifying user's environmental variable $GAUSS_ENV.
Successfully modified user's environmental variable $GAUSS_ENV. .[omm@Gauss1 script]$
发现端口占用,修改clusterconfig.xml 中CN_402端口换8001
[root@Gauss1 ~]# lsof | grep 8000
master 1285 root 43u unix 0xffff88a877878000 0t0 21308 socket
master 1285 root 74u unix 0xffff88a8778f8000 0t0 21339 private/local
su 115231 root 4u unix 0xffff88a96c208000 0t0 463998 socket
[root@Gauss1 ~]# lsof | grep 8001
[root@Gauss1 ~]#
再次执行安装脚本
[omm@Gauss1 script]$ ./gs_install -X /opt/software/gaussdb/clusterconfig.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Last time end with Install cluster.
Continue this step.
Successfully created the backup directory.
Check the time difference between hosts in the cluster.
Rolling back.
Creating the backup directory.
Successfully created the backup directory.
Rollback succeeded.
Installing the cluster.
Installing applications on all nodes.
Successfully installed APP.
Distribute etcd communication keys.
Successfully distrbute etcd communication keys.
Initializing cluster instances
...............225s
Initializing cluster instances is completed.
Configuring standby datanode. ............99s
Successfully configure datanode.
Cluster installation is completed. .Configuring.
Load cluster configuration file.
Configuring the cluster.
Successfully configuring the cluster.
Configuration is completed.
Start cm agent.
Successfully start cm agent and ETCD in cluster.
Starting the cluster.
==============================================
...........11s
Successfully starting the cluster.
==============================================
[omm@Gauss1 script]$
安装完成,查看集群状态
[omm@Gauss1 om]$ gs_om -t status
Set output to terminal.
--------------------------------------------------------------------Cluster Status--------------------------------------------------------------------
az_state : single_az
cluster_state : Normal
balanced : true
----------------------------------------------------------------------AZ Status-----------------------------------------------------------------------
AZ:AZ1 ROLE:primary STATUS:ONLINE
---------------------------------------------------------------------Host Status----------------------------------------------------------------------
HOST:Gauss1 AZ:AZ1 STATUS:ONLINE IP:192.168.10.11
HOST:Gauss2 AZ:AZ1 STATUS:ONLINE IP:192.168.10.12
HOST:Gauss3 AZ:AZ1 STATUS:ONLINE IP:192.168.10.13
HOST:Gauss4 AZ:AZ1 STATUS:ONLINE IP:192.168.10.14
----------------------------------------------------------------Cluster Manager Status----------------------------------------------------------------
INSTANCE:CM1 ROLE:primary STATUS:ONLINE HOST:Gauss1 ID:601
INSTANCE:CM2 ROLE:slave STATUS:ONLINE HOST:Gauss2 ID:602
INSTANCE:CM3 ROLE:slave STATUS:ONLINE HOST:Gauss3 ID:603
INSTANCE:CM4 ROLE:slave STATUS:ONLINE HOST:Gauss4 ID:604
---------------------------------------------------------------------ETCD Status----------------------------------------------------------------------
INSTANCE:ETCD1 ROLE:follower STATUS:ONLINE HOST:Gauss1 ID:701 PORT:2379 DataDir:/opt/huawei/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD2 ROLE:leader STATUS:ONLINE HOST:Gauss2 ID:702 PORT:2379 DataDir:/opt/huawei/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD3 ROLE:follower STATUS:ONLINE HOST:Gauss3 ID:703 PORT:2379 DataDir:/opt/huawei/gaussdb/data/etcd/data_etcd1
----------------------------------------------------------------------CN Status-----------------------------------------------------------------------
INSTANCE:cn_401 ROLE:no role STATUS:ONLINE HOST:Gauss1 ID:401 PORT:8000 DataDir:/opt/gaussdb/data/cn
INSTANCE:cn_402 ROLE:no role STATUS:ONLINE HOST:Gauss2 ID:402 PORT:8001 DataDir:/opt/gaussdb/data/cn
INSTANCE:cn_403 ROLE:no role STATUS:ONLINE HOST:Gauss3 ID:403 PORT:8000 DataDir:/opt/gaussdb/data/cn
INSTANCE:cn_404 ROLE:no role STATUS:ONLINE HOST:Gauss4 ID:404 PORT:8000 DataDir:/opt/gaussdb/data/cn
---------------------------------------------------------Instances Status in Group (group_1)----------------------------------------------------------
INSTANCE:DB1_1 ROLE:primary STATUS:ONLINE HOST:Gauss1 ID:1 PORT:40000 DataDir:/opt/gaussdb/data/dn1
INSTANCE:DB1_2 ROLE:standby STATUS:ONLINE HOST:Gauss2 ID:2 PORT:40021 DataDir:/opt/gaussdb/data/dn1
---------------------------------------------------------Instances Status in Group (group_2)----------------------------------------------------------
INSTANCE:DB2_3 ROLE:primary STATUS:ONLINE HOST:Gauss2 ID:3 PORT:40000 DataDir:/opt/gaussdb/data/dn2
INSTANCE:DB2_4 ROLE:standby STATUS:ONLINE HOST:Gauss3 ID:4 PORT:40021 DataDir:/opt/gaussdb/data/dn2
---------------------------------------------------------Instances Status in Group (group_3)----------------------------------------------------------
INSTANCE:DB3_5 ROLE:primary STATUS:ONLINE HOST:Gauss3 ID:5 PORT:40000 DataDir:/opt/gaussdb/data/dn3
INSTANCE:DB3_6 ROLE:standby STATUS:ONLINE HOST:Gauss4 ID:6 PORT:40021 DataDir:/opt/gaussdb/data/dn3
---------------------------------------------------------Instances Status in Group (group_4)----------------------------------------------------------
INSTANCE:DB4_8 ROLE:standby STATUS:ONLINE HOST:Gauss1 ID:8 PORT:40021 DataDir:/opt/gaussdb/data/dn4
INSTANCE:DB4_7 ROLE:primary STATUS:ONLINE HOST:Gauss4 ID:7 PORT:40000 DataDir:/opt/gaussdb/data/dn4
--------------------------------------------------Manage IP--------------------------------------------------
HOST:Gauss1 IP:192.168.10.11
HOST:Gauss2 IP:192.168.10.12
HOST:Gauss3 IP:192.168.10.13
HOST:Gauss4 IP:192.168.10.14
[omm@Gauss1 om]$
6.测试使用:
[omm@Gauss1 ~]$ zsql omm/'kevinA1!'@127.0.0.1:8000 -q --以omm链接到cn进行管理
connected.
SQL> select * from db_users;
USER_ID USERNAME CREATED
------------ ---------------------------------------------------------------- ---------------------
0 SYS 2019-12-15 18:33:28
1 PUBLIC 2019-12-15 18:33:28
2 OMM 2019-12-15 18:33:31
3 rows fetched.
SQL> create user kevin identified by 'kevinA1!';
SQL> grant resource,connect,dba to kevin;
SQL> conn kevin/'kevinA1!'@127.0.0.1:8000
SQL> create table T_test(id number(20) not null,name varchar(40)) distribute by hash(id); --创建分布式表。
SQL> insert into t_test values(1,'kevin');
SQL> insert into t_test values(2,'kinser');
SQL> insert into t_test select * from t_test;
... --重复插入
SQL> set timing on
ON
SQL> insert into t_test select * from t_test;
524288 rows affected.
Elapsed: 198.247 sec
SQL> insert into t_test select * from t_test;
1048576 rows affected.
Elapsed: 390.385 sec
SQL> insert into t_test select * from t_test;
2097152 rows affected.
Elapsed: 791.999 sec
SQL> select count(*) from t_test;
COUNT(*)
--------------------
4194304
1 rows fetched.
Elapsed: 0.122 sec
SQL>
如上,分布式插入性能明显低于单机。
7.补充
启停集群命令:
启集群:
[omm@Gauss1 om]$ gs_om -t startetcd
[omm@Gauss1 om]$ gs_om -t start
停集群:
[omm@Gauss1 ~]$ gs_om -t stop
[omm@Gauss1 ~]$ gs_om -t stopetcd
本文转自“墨天轮”社区GaussDB频道
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)