摘要:华为 GaussDB 100 安装数据库集群执行安装
1. 环境准备
1.1 系统规划
服务器类型 | 操作系统 | IP | 主机名 | 内存 | 磁盘 |
---|---|---|---|---|---|
服务器 1 | CentOS 7.4 | 192.168.8.48 | gs-100-01 | 16G | 200G |
服务器 2 | CentOS 7.4 | 192.168.8.49 | gs-100-02 | 16G | 200G |
服务器 3 | CentOS 7.4 | 192.168.8.50 | gs-100-03 | 16G | 200G |
1.2 操作系统设置
-
操作系统安装
各集群系统节点操作系统必须一致
-
ROOT用户设置
各集群系统节点root密码设置一致
-
时间同步设置
转载参考:NTP 时钟同步设置
-
安装包准备
安装包存放到/opt目录下,并解压
目录结构如下:/opt/software/gaussdb/
2. 运行前置脚本
2.1 准备 clusterconfig.xml 文件
提供准确的 hostname 和 IP地址
2.2 运行前置脚本
root 用户下下运行
/opt/software/gaussdb/script/gs_preinstall -X ../clusterconfig.xml -U omm -G dbgrp
命令运行结果如下
[root@gs-100-01 script]# ./gs_preinstall -X ../clusterconfig.xml -U omm -G dbgrp
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)? yes
Please enter password for root.
Password:
Creating SSH trust for the root permission user.
Successfully created SSH trust for the root permission user.
All host RAM is consistent
Distributing package.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Creating [omm] user on all nodes.
Successfully created [omm] user on all nodes.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking system resource.
Successfully check system resource.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Start creating SSH trust for [omm] user.
Successfully created SSH trust for [omm] user.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Successfully set NTP service.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/gaussdb/script/gs_checkos -i A -h TDH01,TDH02,TDH03 -X /opt/software/gaussdb/clusterconfig.xml".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Preparing SSH service.
Successfully prepared SSH service.
Setting user environmental variables.
Successfully set user environmental variables.
Configuring alarms on the cluster nodes.
Successfully configured alarms on the cluster nodes.
Setting the dynamic link library.
Successfully set the dynamic link library.
Fixing server package owner.
Successfully fixed server package owner.
Create logrotate service.
Successfully create logrotate service.
Setting finish flag.
Successfully set finish flag.
check time consistency(maximum execution time 10 minutes).
Time consistent is running(20/20)...
Clean SSH trust for the root permission user.
Successfully cleaned SSH trust for the root permission user.
Preinstallation succeeded.
注意:各节点时间不一致时,安装程序会自动修复时间不一致问题,会花费较长的时间
check time consistency(maximum execution time 10 minutes).
Time consistent is running(20/20)…
3. 运行安装脚本
omm 用户下执行命令
/opt/software/gaussdb/script/gs_install -X ../clusterconfig.xml
[omm@gs-100-01 script]$ ./gs_install -X ../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
...........3461s
Initializing cluster instances is completed.
Configuring standby datanode.
...................2719s
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.
==============================================
............42s
Successfully starting the cluster.
==============================================
检查运行状态
gs_om -t status
[omm@gs-100-01 ~]$ 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:gs-100-01 AZ:AZ1 STATUS:ONLINE IP:192.168.8.48
HOST:gs-100-02 AZ:AZ1 STATUS:ONLINE IP:192.168.8.49
HOST:gs-100-03 AZ:AZ1 STATUS:ONLINE IP:192.168.8.50
----------------------------------------------------------------Cluster Manager Status----------------------------------------------------------------
INSTANCE:CM1 ROLE:slave STATUS:ONLINE HOST:gs-100-01 ID:601
INSTANCE:CM2 ROLE:primary STATUS:ONLINE HOST:gs-100-02 ID:602
INSTANCE:CM3 ROLE:slave STATUS:ONLINE HOST:gs-100-03 ID:603
---------------------------------------------------------------------ETCD Status----------------------------------------------------------------------
INSTANCE:ETCD1 ROLE:leader STATUS:ONLINE HOST:gs-100-01 ID:701 PORT:2379 DataDir:/opt/huawei/gaussdb/data/data_etcd1
INSTANCE:ETCD2 ROLE:follower STATUS:ONLINE HOST:gs-100-02 ID:702 PORT:2379 DataDir:/opt/huawei/gaussdb/data/data_etcd1
INSTANCE:ETCD3 ROLE:follower STATUS:ONLINE HOST:gs-100-03 ID:703 PORT:2379 DataDir:/opt/huawei/gaussdb/data/data_etcd1
----------------------------------------------------------------------CN Status-----------------------------------------------------------------------
INSTANCE:cn_401 ROLE:no role STATUS:ONLINE HOST:gs-100-01 ID:401 PORT:8000 DataDir:/opt/huawei/gaussdb/data/data_cn
INSTANCE:cn_402 ROLE:no role STATUS:ONLINE HOST:gs-100-02 ID:402 PORT:8000 DataDir:/opt/huawei/gaussdb/data/data_cn
INSTANCE:cn_403 ROLE:no role STATUS:ONLINE HOST:gs-100-03 ID:403 PORT:8000 DataDir:/opt/huawei/gaussdb/data/data_cn
---------------------------------------------------------Instances Status in Group (group_1)----------------------------------------------------------
INSTANCE:DB1_1 ROLE:primary STATUS:ONLINE HOST:gs-100-01 ID:1 PORT:40000 DataDir:/opt/huawei/gaussdb/data/data_dn1
INSTANCE:DB1_2 ROLE:standby STATUS:ONLINE HOST:gs-100-02 ID:2 PORT:40042 DataDir:/opt/huawei/gaussdb/data/data_dn1
INSTANCE:DB1_3 ROLE:standby STATUS:ONLINE HOST:gs-100-03 ID:3 PORT:40021 DataDir:/opt/huawei/gaussdb/data/data_dn1
---------------------------------------------------------Instances Status in Group (group_2)----------------------------------------------------------
INSTANCE:DB2_5 ROLE:standby STATUS:ONLINE HOST:gs-100-01 ID:5 PORT:40021 DataDir:/opt/huawei/gaussdb/data/data_dn2
INSTANCE:DB2_4 ROLE:primary STATUS:ONLINE HOST:gs-100-02 ID:4 PORT:40000 DataDir:/opt/huawei/gaussdb/data/data_dn2
INSTANCE:DB2_6 ROLE:standby STATUS:ONLINE HOST:gs-100-03 ID:6 PORT:40042 DataDir:/opt/huawei/gaussdb/data/data_dn2
---------------------------------------------------------Instances Status in Group (group_3)----------------------------------------------------------
INSTANCE:DB3_8 ROLE:standby STATUS:ONLINE HOST:gs-100-01 ID:8 PORT:40042 DataDir:/opt/huawei/gaussdb/data/data_dn3
INSTANCE:DB3_9 ROLE:standby STATUS:ONLINE HOST:gs-100-02 ID:9 PORT:40021 DataDir:/opt/huawei/gaussdb/data/data_dn3
INSTANCE:DB3_7 ROLE:primary STATUS:ONLINE HOST:gs-100-03 ID:7 PORT:40000 DataDir:/opt/huawei/gaussdb/data/data_dn3
-----------------------------------------------------------------------Manage IP----------------------------------------------------------------------
HOST:gs-100-01 IP:192.168.8.48
HOST:gs-100-02 IP:192.168.8.49
HOST:gs-100-03 IP:192.168.8.50
-------------------------------------------------------------------Query Action Info------------------------------------------------------------------
HOSTNAME: gs-100-01 TIME: 2019-12-01 04:41:27.193341
------------------------------------------------------------------------Float Ip------------------------------------------------------------------
HOST:gs-100-01 DB1_1:192.168.8.48 IP:
HOST:gs-100-02 DB2_4:192.168.8.49 IP:
HOST:gs-100-03 DB3_7:192.168.8.50 IP:
4. 测试安装结果
4.1 连接数据库
omm 用户下
zsql omm@127.0.0.1:8000
4.2 数据库用户操作
查看数据库用户
SELECT * FROM DB_USERS;
修改用户密码
ALTER USER user_name IDENTIFIED BY new_password REPLACE old_password;
新建用户
CREATE USER jessica IDENTIFIED BY gaussdb_123;
GRANT CREATE SESSION TO Jessica;
建表
CREATE TABLE films(
id NUMBER(6) not null,
ADDRESS VARCHAR(40),
CITY VARCHAR(64)
) DISTRIBUTE BY HASH(id);
创建角色
CREATE ROLE role_r;
GRANT SELECT ON films TO role_r;
GRANT ROLE_R TO user_read;
查看系统用户权限
SELECT * FROM ADM_SYS_PRIVS WHERE GRANTEE ='JOE';
数据库内置用户列表
用户名 | 默认密码 | 备注 |
---|---|---|
omm | gaussdb_123 | dba 管理员用户 |
sys | Changeme_123 | sys 用户 |
附录:
安装遇到的问题
问题一: 端口被占用问题
[omm@gs-100-01 script]$ ./gs_install -X ../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
..............104s
[FAILURE] gs-100-01:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
clean etcd data directory /opt/huawei/gaussdb/data/data_etcd1.
Initialize cn_401 instance
[GAUSS-50601] : The port [8001] is occupied.
[FAILURE] gs-100-02:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
clean etcd data directory /opt/huawei/gaussdb/data/data_etcd1.
Initialize cn_402 instance
[GAUSS-51300] : Failed to execute SQL: /opt/huawei/gaussdb/data/data_cn/admin/scripts/create_database.sample.sql.
connected.
SQL>
GS-00304, tcp connection is closed
SQL> SQL> . The fail instance data directory: /opt/huawei/gaussdb/data/data_cn
[FAILURE] gs-100-03:
Using omm:dbgrp to install database.
Using installation program path : /home/omm
clean etcd data directory /opt/huawei/gaussdb/data/data_etcd1.
Initialize cn_403 instance
[GAUSS-50601] : The port [8001] is occupied.
最后修改时间:2019-11-30 21:37:28
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。